Patch #38146 » 0006-Fix-RuboCop-offense-Performance-RedundantEqualityCom.patch
| .rubocop_todo.yml | ||
|---|---|---|
|
- 'test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb'
|
||
|
- 'test/unit/project_test.rb'
|
||
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||
|
Performance/RedundantEqualityComparisonBlock:
|
||
|
Exclude:
|
||
|
- 'app/models/query.rb'
|
||
|
- 'app/models/setting.rb'
|
||
|
- 'lib/redmine/field_format.rb'
|
||
|
- 'test/integration/api_test/issues_test.rb'
|
||
|
# This cop supports safe autocorrection (--autocorrect).
|
||
|
Performance/RedundantMatch:
|
||
|
Exclude:
|
||
| app/models/query.rb | ||
|---|---|---|
|
end
|
||
|
def has_custom_field_column?
|
||
|
columns.any? {|column| column.is_a? QueryCustomFieldColumn}
|
||
|
columns.any?(QueryCustomFieldColumn)
|
||
|
end
|
||
|
def has_default_columns?
|
||
| app/models/setting.rb | ||
|---|---|---|
|
# # => [{'keywords => 'fixes', 'status_id' => "3"}, {'keywords => 'closes', 'status_id' => "5", 'done_ratio' => "100"}]
|
||
|
def self.commit_update_keywords_from_params(params)
|
||
|
s = []
|
||
|
if params.is_a?(Hash) && params.key?(:keywords) && params.values.all? {|v| v.is_a? Array}
|
||
|
if params.is_a?(Hash) && params.key?(:keywords) && params.values.all?(Array)
|
||
|
attributes = params.except(:keywords).keys
|
||
|
params[:keywords].each_with_index do |keywords, i|
|
||
|
next if keywords.blank?
|
||
| lib/redmine/field_format.rb | ||
|---|---|---|
|
attachment_present = true
|
||
|
value = value.except(:blank)
|
||
|
if value.values.any? && value.values.all? {|v| v.is_a?(Hash)}
|
||
|
if value.values.any? && value.values.all?(Hash)
|
||
|
value = value.values.first
|
||
|
end
|
||
| test/integration/api_test/issues_test.rb | ||
|---|---|---|
|
json = ActiveSupport::JSON.decode(response.body)
|
||
|
status_ids_used = json['issues'].collect {|j| j['status']['id']}
|
||
|
assert_equal 3, status_ids_used.length
|
||
|
assert status_ids_used.all? {|id| id == 5}
|
||
|
assert status_ids_used.all?(5)
|
||
|
end
|
||
|
test "GET /issues/:id.xml with journals" do
|
||