Project

General

Profile

Defect #37268 » custom_field_visibility_fix.patch

Alexander Meindl, 2022-06-22 07:55

View differences:

.rubocop.yml
1
inherit_from: .rubocop_todo.yml
2

  
3 1
AllCops:
4
  TargetRubyVersion: 2.5
5
  TargetRailsVersion: 6.1
6

  
7
  NewCops: enable
8

  
9
  Exclude:
10
    - '**/vendor/**/*'
11
    - '**/tmp/**/*'
12
    - '**/bin/**/*'
13
    - '**/plugins/**/*'
14
    - '**/extra/**/*'
15
    - '**/lib/generators/**/templates/*'
16
    - '**/lib/tasks/**/*'
17
    - '**/files/**/*'
18
    - 'db/schema.rb'
19

  
20
# Enable extensions
21

  
22
require:
23
  - rubocop-performance
24
  - rubocop-rails
25

  
26
# Rules for Redmine
27

  
28
Bundler/OrderedGems:
29
  Enabled: false
30

  
31
Layout/CaseIndentation:
32
  Exclude:
33
    - 'config/initializers/10-patches.rb'
34

  
35
Layout/ClosingParenthesisIndentation:
36
  Enabled: true
37
  Exclude:
38
    - 'lib/redmine/wiki_formatting/textile/redcloth3.rb'
39

  
40
Layout/EmptyLinesAroundAccessModifier:
41
  Enabled: true
42
  Exclude:
43
    - 'config/initializers/10-patches.rb'
44

  
45
Layout/EmptyLineBetweenDefs:
46
  AllowAdjacentOneLineDefs: true
47

  
48
Layout/FirstHashElementIndentation:
49
  Enabled: true
50
  Exclude:
51
    - 'lib/redmine/wiki_formatting/textile/redcloth3.rb'
52

  
53
Layout/LineLength:
54
  Enabled: true
55
  IgnoredPatterns: ['\A\s+test \".+\" do\z', '\A\s*\#']
56
  Exclude:
57
    - 'db/migrate/0*.rb'
58
    - 'db/migrate/1*.rb'
59
    - 'db/migrate/201*.rb'
60
    - 'db/migrate/20200*.rb'
61
    - 'lib/redmine/wiki_formatting/textile/redcloth3.rb'
62

  
63
Layout/RescueEnsureAlignment:
64
  Enabled: true
65
  Exclude:
66
    - 'db/migrate/085_add_role_tracker_old_status_index_to_workflows.rb'
67

  
68
Layout/SpaceAroundEqualsInParameterDefault:
69
  Enabled: false
70

  
71
Layout/SpaceBeforeSemicolon:
72
  Enabled: true
73
  Exclude:
74
    - 'config/initializers/10-patches.rb'
75

  
76
Layout/SpaceBeforeBlockBraces:
77
  # "space" is used more than "no_space".
78
  # But "no_space" is more natural in one liner.
79
  #   str = path.to_s.split(%r{[/\\]}).select{|p| !p.blank?}.join("/")
80
  Enabled: false
81

  
82
Layout/SpaceInsideBlockBraces:
83
  Enabled: false
84

  
85
Layout/SpaceInsideHashLiteralBraces:
86
  Enabled: false
87

  
88
Lint/RaiseException:
89
  Enabled: true
90

  
91
Lint/StructNewOverride:
92
  Enabled: true
93

  
94
Lint/SuppressedException:
95
  AllowComments: true
96

  
97
Layout/TrailingWhitespace:
98
  AllowInHeredoc: true
99

  
100
Metrics:
101
  Enabled: false
102

  
103
Naming/AccessorMethodName:
104
  Enabled: false
105

  
106
Naming/VariableNumber:
107
  CheckMethodNames: false
108
  CheckSymbols: false
109

  
110
Naming/BinaryOperatorParameterName:
111
  Enabled: false
112

  
113
Naming/PredicateName:
114
  Enabled: false
115

  
116
Rails/BulkChangeTable:
117
  Exclude:
118
    - 'db/migrate/20120714122200_add_workflows_rule_fields.rb'
119
    - 'db/migrate/20131214094309_remove_custom_fields_min_max_length_default_values.rb'
120

  
121
Rails/CompactBlank:
122
  Enabled: false
123

  
124
Rails/EnvironmentVariableAccess:
125
  Enabled: false
126

  
127
Rails/FilePath:
128
  Enabled: false
129

  
130
Rails/HelperInstanceVariable:
131
  Enabled: false
132

  
133
Style/AsciiComments:
134
  Exclude:
135
    # Copyright credit has non ascii character.
136
    # We can not change nor remove it.
137
    - 'app/models/repository/git.rb'
138

  
139
Style/BlockComments:
140
  Enabled: true
141
  Exclude:
142
    - 'lib/redmine/string_array_diff/diff.rb'
143
    - 'lib/redmine/string_array_diff/diffable.rb'
144

  
145
Style/BlockDelimiters:
146
  Enabled: true
147
  Exclude:
148
    - 'db/migrate/007_create_journals.rb'
149
    - 'lib/redmine/string_array_diff/diff.rb'
150
    - 'lib/redmine/string_array_diff/diffable.rb'
151

  
152
Style/EmptyElse:
153
  EnforcedStyle: empty
154

  
155
Style/FormatString:
156
  EnforcedStyle: sprintf
157

  
158
Style/FormatStringToken:
159
  Enabled: false
160

  
161
Style/FrozenStringLiteralComment:
162
  Enabled: true
163
  EnforcedStyle: always
164
  Exclude:
165
    - 'db/**/*.rb'
166
    - 'Gemfile'
167
    - 'Rakefile'
168
    - 'config.ru'
169
    - 'config/additional_environment.rb'
170

  
171
Style/GlobalStdStream:
172
  Enabled: false
173

  
174
Style/HashEachMethods:
175
  Enabled: true
176

  
177
Style/HashSyntax:
178
  Enabled: true
179
  EnforcedStyle: no_mixed_keys
180

  
181
Style/HashTransformKeys:
182
  Enabled: true
183

  
184
Style/HashTransformValues:
185
  Enabled: true
186

  
187
Style/IdenticalConditionalBranches:
188
  Exclude:
189
    - 'config/initializers/10-patches.rb'
190
    - 'lib/redmine/wiki_formatting/textile/redcloth3.rb'
191

  
192
Style/NegatedIfElseCondition:
193
  Enabled: false
194

  
195
Style/RaiseArgs:
196
  Enabled: false
197

  
198
Style/TrailingCommaInArrayLiteral:
199
  Enabled: false
200

  
201
Style/TrailingCommaInHashLiteral:
202
  Enabled: false
2
  DisabledByDefault: true
Gemfile
99 99
  gem 'capybara', (Gem.ruby_version < Gem::Version.new('2.6.0') ? '~> 3.35.3' : '~> 3.36.0')
100 100
  gem "selenium-webdriver", "~> 3.142.7"
101 101
  gem 'webdrivers', '4.6.1', require: false
102
  # RuboCop
103
  gem 'rubocop', '~> 1.26.0'
104
  gem 'rubocop-performance', '~> 1.13.0'
105
  gem 'rubocop-rails', '~> 2.14.0'
106 102
end
107 103

  
108 104
local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local")
app/models/query.rb
1160 1160
      where = "(#{where}) AND #{db_table}.#{db_field} <> ''"
1161 1161
    end
1162 1162
    "#{queried_table_name}.#{customized_key} #{not_in} IN (" \
1163
      "SELECT #{customized_class.table_name}.id FROM #{customized_class.table_name}" \
1163
      "SELECT #{customized_class.table_name}.id FROM #{customized_class.table_name} AS cf_issue" \
1164 1164
      " LEFT OUTER JOIN #{db_table} ON #{db_table}.customized_type='#{customized_class}'" \
1165
      " AND #{db_table}.customized_id=#{customized_class.table_name}.id" \
1165
      " AND #{db_table}.customized_id=cf_issue.id" \
1166
      " AND #{customized_class.table_name}.id=cf_issue.id " \
1166 1167
      " AND #{db_table}.custom_field_id=#{custom_field_id}" \
1167 1168
      " WHERE (#{where}) AND (#{filter[:field].visibility_by_project_condition}))"
1168 1169
  end
(1-1/10)