rubocop-discourse 3.13.3 → 3.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +35 -3
- data/config/default.yml +5 -0
- data/lib/rubocop/cop/discourse/no_system_spec_metadata.rb +98 -0
- data/lib/rubocop/cop/discourse/plugins/call_requires_plugin.rb +1 -2
- data/lib/rubocop/cop/discourse/plugins/no_monkey_patching.rb +5 -12
- data/lib/rubocop/cop/discourse/plugins/use_plugin_instance_on.rb +1 -2
- data/lib/rubocop/cop/discourse/services/empty_lines_around_blocks.rb +6 -12
- data/lib/rubocop/cop/discourse/services/group_keywords.rb +2 -7
- data/lib/rubocop/discourse/version.rb +1 -1
- data/rubocop-core.yml +2 -143
- data/rubocop-discourse.gemspec +15 -2
- data/rubocop-layout.yml +2 -80
- data/rubocop-rspec.yml +9 -215
- metadata +6 -35
- data/.github/workflows/ci.yml +0 -41
- data/.gitignore +0 -1
- data/.rspec +0 -1
- data/.rubocop.yml +0 -9
- data/.streerc +0 -2
- data/Gemfile +0 -11
- data/Rakefile +0 -8
- data/spec/fixtures/controllers/bad_controller.rb +0 -5
- data/spec/fixtures/controllers/base_controller.rb +0 -11
- data/spec/fixtures/controllers/good_controller.rb +0 -4
- data/spec/fixtures/controllers/inherit_from_outside_controller.rb +0 -5
- data/spec/fixtures/controllers/namespaced_parent_controller.rb +0 -5
- data/spec/fixtures/controllers/no_requires_plugin_controller.rb +0 -5
- data/spec/fixtures/controllers/requires_plugin_controller.rb +0 -6
- data/spec/lib/rubocop/cop/discourse/services/empty_lines_around_blocks_spec.rb +0 -309
- data/spec/lib/rubocop/cop/discourse/services/group_keywords_spec.rb +0 -137
- data/spec/lib/rubocop/cop/fabricator_shorthand_spec.rb +0 -71
- data/spec/lib/rubocop/cop/no_add_reference_active_record_migrations_spec.rb +0 -47
- data/spec/lib/rubocop/cop/no_mixing_multisite_and_standard_specs_spec.rb +0 -68
- data/spec/lib/rubocop/cop/no_mocking_jobs_enqueue_spec.rb +0 -31
- data/spec/lib/rubocop/cop/no_reset_column_information_migrations_spec.rb +0 -33
- data/spec/lib/rubocop/cop/only_top_level_multisite_specs_spec.rb +0 -78
- data/spec/lib/rubocop/cop/plugins/call_requires_plugin_spec.rb +0 -79
- data/spec/lib/rubocop/cop/plugins/namespace_constants_spec.rb +0 -40
- data/spec/lib/rubocop/cop/plugins/namespace_methods_spec.rb +0 -84
- data/spec/lib/rubocop/cop/plugins/no_monkey_patching_spec.rb +0 -91
- data/spec/lib/rubocop/cop/plugins/use_plugin_instance_on_spec.rb +0 -37
- data/spec/lib/rubocop/cop/plugins/use_require_relative_spec.rb +0 -24
- data/spec/lib/rubocop/cop/time_eq_matcher_spec.rb +0 -23
- data/spec/spec_helper.rb +0 -15
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f4d1f21065c28440ac92a435fe615ba1aa71be866decb87a34569b5035b6ab28
|
|
4
|
+
data.tar.gz: 40738677dd38eb78850b649f223c5e70f86a487821d28ba66ab8e25fb7fe155c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 161fab4a916b845fe201a36a7b5cdc6d329a25f4069bdaab7a62a9c0dcd9ed36e0ef3984698de67edf1aac6043351b2201a43550470fff3c86b3e531e132ab0e
|
|
7
|
+
data.tar.gz: 4a474ac36e50368a4a62fc6e1dba557f2294c9f498a53b28b589eed150a7abc2917a60ba71943d5821c32148876a309f3e4b3ca6eeee1dab9b40fa44d18c45f8
|
data/README.md
CHANGED
|
@@ -1,11 +1,43 @@
|
|
|
1
1
|
# rubocop-discourse
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Custom Discourse RuboCop cops plus our shared project configuration (RSpec, Rails, Capybara, FactoryBot). Most Discourse projects use Syntax Tree for formatting, so we recommend the Syntax Tree-compatible config by default.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add the gem to your development group:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
group :development, :test do
|
|
11
|
+
gem "rubocop-discourse"
|
|
12
|
+
end
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Configuration
|
|
16
|
+
|
|
17
|
+
Recommended (Syntax Tree-friendly, omits Layout cops so it can be used with the formatter):
|
|
18
|
+
|
|
19
|
+
```yml
|
|
20
|
+
inherit_gem:
|
|
21
|
+
rubocop-discourse: stree-compat.yml
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`stree-compat.yml` includes Discourse cops plus core/RSpec/Rails/Capybara/FactoryBot, but leaves layout to Syntax Tree.
|
|
25
|
+
|
|
26
|
+
Base config with layout cops (for projects not using Syntax Tree):
|
|
7
27
|
|
|
8
28
|
```yml
|
|
9
29
|
inherit_gem:
|
|
10
30
|
rubocop-discourse: default.yml
|
|
11
31
|
```
|
|
32
|
+
|
|
33
|
+
`default.yml` is kept for backwards compatibility and pulls in `stree-compat.yml` plus `rubocop-layout.yml`.
|
|
34
|
+
|
|
35
|
+
Then run `bundle exec rubocop` as usual.
|
|
36
|
+
|
|
37
|
+
Switching an existing project to Syntax Tree:
|
|
38
|
+
|
|
39
|
+
```diff
|
|
40
|
+
inherit_gem:
|
|
41
|
+
- rubocop-discourse: default.yml # includes layout cops
|
|
42
|
+
+ rubocop-discourse: stree-compat.yml # defers layout to Syntax Tree
|
|
43
|
+
```
|
data/config/default.yml
CHANGED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RuboCop
|
|
4
|
+
module Cop
|
|
5
|
+
module Discourse
|
|
6
|
+
# System spec metadata is inferred from the file path, so explicit
|
|
7
|
+
# `type: :system` and `system: true` metadata on `RSpec.describe` is redundant.
|
|
8
|
+
#
|
|
9
|
+
# @example
|
|
10
|
+
# # bad
|
|
11
|
+
# RSpec.describe "login", system: true do
|
|
12
|
+
# end
|
|
13
|
+
#
|
|
14
|
+
# # good
|
|
15
|
+
# RSpec.describe "login" do
|
|
16
|
+
# end
|
|
17
|
+
class NoSystemSpecMetadata < Base
|
|
18
|
+
extend AutoCorrector
|
|
19
|
+
|
|
20
|
+
MSG = "Remove redundant `type: :system` and `system: true` metadata from `RSpec.describe`."
|
|
21
|
+
RESTRICT_ON_SEND = %i[describe].freeze
|
|
22
|
+
|
|
23
|
+
def_node_matcher :describe?, <<~PATTERN
|
|
24
|
+
(send
|
|
25
|
+
{nil? (const nil? :RSpec)}
|
|
26
|
+
:describe
|
|
27
|
+
...
|
|
28
|
+
)
|
|
29
|
+
PATTERN
|
|
30
|
+
|
|
31
|
+
def_node_matcher :system_type_pair?, <<~PATTERN
|
|
32
|
+
(pair (sym :type) (sym :system))
|
|
33
|
+
PATTERN
|
|
34
|
+
|
|
35
|
+
def_node_matcher :system_true_pair?, <<~PATTERN
|
|
36
|
+
(pair (sym :system) true)
|
|
37
|
+
PATTERN
|
|
38
|
+
|
|
39
|
+
def on_send(node)
|
|
40
|
+
return unless describe?(node)
|
|
41
|
+
return unless node.last_argument&.hash_type?
|
|
42
|
+
|
|
43
|
+
hash = node.last_argument
|
|
44
|
+
offending_pairs =
|
|
45
|
+
hash.pairs.select { |pair| system_type_pair?(pair) || system_true_pair?(pair) }
|
|
46
|
+
|
|
47
|
+
return if offending_pairs.empty?
|
|
48
|
+
|
|
49
|
+
add_offense(offending_pairs.first) do |corrector|
|
|
50
|
+
corrector.replace(node, corrected_send_source(node, hash, offending_pairs))
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
private
|
|
55
|
+
|
|
56
|
+
def corrected_send_source(node, hash, offending_pairs)
|
|
57
|
+
remaining_pairs = hash.pairs - offending_pairs
|
|
58
|
+
before_hash = source_for(node.source_range.begin_pos, hash.source_range.begin_pos)
|
|
59
|
+
after_hash = source_for(hash.source_range.end_pos, node.source_range.end_pos)
|
|
60
|
+
|
|
61
|
+
return "#{before_hash.sub(/,\s*\z/m, "")}#{after_hash}" if remaining_pairs.empty?
|
|
62
|
+
|
|
63
|
+
"#{before_hash}#{corrected_hash_source(hash, remaining_pairs)}#{after_hash}"
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def corrected_hash_source(hash, remaining_pairs)
|
|
67
|
+
body =
|
|
68
|
+
remaining_pairs
|
|
69
|
+
.each_with_index
|
|
70
|
+
.map do |pair, index|
|
|
71
|
+
separator = index.zero? ? "" : pair_separator(hash, pair)
|
|
72
|
+
"#{separator}#{pair.source}"
|
|
73
|
+
end
|
|
74
|
+
.join
|
|
75
|
+
|
|
76
|
+
return body unless hash.braces?
|
|
77
|
+
|
|
78
|
+
return "{ #{body} }" unless hash.multiline?
|
|
79
|
+
|
|
80
|
+
indentation = " " * remaining_pairs.first.loc.expression.column
|
|
81
|
+
closing_indentation = " " * hash.loc.end.column
|
|
82
|
+
|
|
83
|
+
"{\n#{indentation}#{body}\n#{closing_indentation}}"
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def pair_separator(hash, pair)
|
|
87
|
+
return ", " unless hash.multiline?
|
|
88
|
+
|
|
89
|
+
",\n#{" " * pair.loc.expression.column}"
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def source_for(begin_pos, end_pos)
|
|
93
|
+
processed_source.buffer.source[begin_pos...end_pos]
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
@@ -44,8 +44,7 @@ module RuboCop
|
|
|
44
44
|
|
|
45
45
|
def requires_plugin_present_in_parent_classes(node)
|
|
46
46
|
return unless processed_source.path
|
|
47
|
-
controller_path =
|
|
48
|
-
base_controller_path(node.parent_class&.const_name.to_s)
|
|
47
|
+
controller_path = base_controller_path(node.parent_class&.const_name.to_s)
|
|
49
48
|
return unless controller_path
|
|
50
49
|
Commissioner
|
|
51
50
|
.new([self.class.new(config, @options)])
|
|
@@ -46,14 +46,11 @@ module RuboCop
|
|
|
46
46
|
# add_to_serializer(:user, :new_method) { do_processing }
|
|
47
47
|
#
|
|
48
48
|
class NoMonkeyPatching < Base
|
|
49
|
-
MSG =
|
|
50
|
-
|
|
51
|
-
MSG_CLASS_EVAL =
|
|
52
|
-
"Don’t call `class_eval`. Instead, create a mixin and use `prepend`."
|
|
49
|
+
MSG = "Don’t reopen existing classes. Instead, create a mixin and use `prepend`."
|
|
50
|
+
MSG_CLASS_EVAL = "Don’t call `class_eval`. Instead, create a mixin and use `prepend`."
|
|
53
51
|
MSG_CLASS_EVAL_SERIALIZERS =
|
|
54
52
|
"Don’t call `class_eval` on a serializer. If you’re adding new methods, use `add_to_serializer`. Otherwise, create a mixin and use `prepend`."
|
|
55
|
-
MSG_SERIALIZERS =
|
|
56
|
-
"Don’t reopen serializers. Instead, use `add_to_serializer`."
|
|
53
|
+
MSG_SERIALIZERS = "Don’t reopen serializers. Instead, use `add_to_serializer`."
|
|
57
54
|
RESTRICT_ON_SEND = [:class_eval].freeze
|
|
58
55
|
|
|
59
56
|
def_node_matcher :existing_class?, <<~MATCHER
|
|
@@ -65,18 +62,14 @@ module RuboCop
|
|
|
65
62
|
MATCHER
|
|
66
63
|
|
|
67
64
|
def on_send(node)
|
|
68
|
-
if serializer?(node)
|
|
69
|
-
return add_offense(node, message: MSG_CLASS_EVAL_SERIALIZERS)
|
|
70
|
-
end
|
|
65
|
+
return add_offense(node, message: MSG_CLASS_EVAL_SERIALIZERS) if serializer?(node)
|
|
71
66
|
add_offense(node, message: MSG_CLASS_EVAL)
|
|
72
67
|
end
|
|
73
68
|
|
|
74
69
|
def on_class(node)
|
|
75
70
|
return unless in_plugin_rb_file?
|
|
76
71
|
return unless existing_class?(node)
|
|
77
|
-
if serializer?(node)
|
|
78
|
-
return add_offense(node, message: MSG_SERIALIZERS)
|
|
79
|
-
end
|
|
72
|
+
return add_offense(node, message: MSG_SERIALIZERS) if serializer?(node)
|
|
80
73
|
add_offense(node, message: MSG)
|
|
81
74
|
end
|
|
82
75
|
|
|
@@ -16,8 +16,7 @@ module RuboCop
|
|
|
16
16
|
class UsePluginInstanceOn < Base
|
|
17
17
|
MSG =
|
|
18
18
|
"Use `on` instead of `DiscourseEvent.on` as the latter will listen to events even if the plugin is disabled."
|
|
19
|
-
NOT_OUTSIDE_PLUGIN_RB =
|
|
20
|
-
"Don’t call `DiscourseEvent.on` outside `plugin.rb`."
|
|
19
|
+
NOT_OUTSIDE_PLUGIN_RB = "Don’t call `DiscourseEvent.on` outside `plugin.rb`."
|
|
21
20
|
RESTRICT_ON_SEND = [:on].freeze
|
|
22
21
|
|
|
23
22
|
def_node_matcher :discourse_event_on?, <<~MATCHER
|
|
@@ -57,18 +57,14 @@ module RuboCop
|
|
|
57
57
|
|
|
58
58
|
if missing_empty_lines?(node)
|
|
59
59
|
add_offense(node, message: MSG) do |corrector|
|
|
60
|
-
if missing_empty_line_before?(node) &&
|
|
61
|
-
corrected_after.exclude?(node.left_sibling)
|
|
60
|
+
if missing_empty_line_before?(node) && corrected_after.exclude?(node.left_sibling)
|
|
62
61
|
corrected_before << node
|
|
63
62
|
corrector.insert_before(
|
|
64
|
-
node.loc.expression.adjust(
|
|
65
|
-
|
|
66
|
-
),
|
|
67
|
-
"\n"
|
|
63
|
+
node.loc.expression.adjust(begin_pos: -node.loc.expression.column),
|
|
64
|
+
"\n",
|
|
68
65
|
)
|
|
69
66
|
end
|
|
70
|
-
if missing_empty_line_after?(node) &&
|
|
71
|
-
corrected_before.exclude?(node.right_sibling)
|
|
67
|
+
if missing_empty_line_after?(node) && corrected_before.exclude?(node.right_sibling)
|
|
72
68
|
corrected_after << node
|
|
73
69
|
corrector.insert_after(node.loc.end, "\n")
|
|
74
70
|
end
|
|
@@ -91,13 +87,11 @@ module RuboCop
|
|
|
91
87
|
end
|
|
92
88
|
|
|
93
89
|
def missing_empty_line_before?(node)
|
|
94
|
-
processed_source[node.loc.expression.line - 2].present? &&
|
|
95
|
-
node.left_siblings.present?
|
|
90
|
+
processed_source[node.loc.expression.line - 2].present? && node.left_siblings.present?
|
|
96
91
|
end
|
|
97
92
|
|
|
98
93
|
def missing_empty_line_after?(node)
|
|
99
|
-
processed_source[node.loc.end.line].present? &&
|
|
100
|
-
node.right_siblings.present?
|
|
94
|
+
processed_source[node.loc.end.line].present? && node.right_siblings.present?
|
|
101
95
|
end
|
|
102
96
|
|
|
103
97
|
def corrected_before
|
|
@@ -46,9 +46,7 @@ module RuboCop
|
|
|
46
46
|
|
|
47
47
|
add_offense(node, message: MSG) do |corrector|
|
|
48
48
|
range =
|
|
49
|
-
node.loc.expression.end.with(
|
|
50
|
-
end_pos: node.right_sibling.loc.expression.begin_pos
|
|
51
|
-
)
|
|
49
|
+
node.loc.expression.end.with(end_pos: node.right_sibling.loc.expression.begin_pos)
|
|
52
50
|
content = range.source.gsub(/^(\n)+/, "\n")
|
|
53
51
|
corrector.replace(range, content)
|
|
54
52
|
end
|
|
@@ -62,10 +60,7 @@ module RuboCop
|
|
|
62
60
|
|
|
63
61
|
def extra_empty_line_after?(node)
|
|
64
62
|
processed_source[node.loc.expression.line].blank? &&
|
|
65
|
-
(
|
|
66
|
-
service_keyword?(node.right_sibling) ||
|
|
67
|
-
single_line_block?(node.right_sibling)
|
|
68
|
-
)
|
|
63
|
+
(service_keyword?(node.right_sibling) || single_line_block?(node.right_sibling))
|
|
69
64
|
end
|
|
70
65
|
|
|
71
66
|
def service_keyword?(node)
|
data/rubocop-core.yml
CHANGED
|
@@ -1,143 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Security/IoMethods:
|
|
5
|
-
Enabled: true
|
|
6
|
-
|
|
7
|
-
Security/CompoundHash:
|
|
8
|
-
Enabled: true
|
|
9
|
-
|
|
10
|
-
# Prefer &&/|| over and/or.
|
|
11
|
-
Style/AndOr:
|
|
12
|
-
Enabled: true
|
|
13
|
-
|
|
14
|
-
Style/FrozenStringLiteralComment:
|
|
15
|
-
Enabled: true
|
|
16
|
-
|
|
17
|
-
# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
|
|
18
|
-
Style/HashSyntax:
|
|
19
|
-
Enabled: true
|
|
20
|
-
EnforcedShorthandSyntax: either
|
|
21
|
-
|
|
22
|
-
# Defining a method with parameters needs parentheses.
|
|
23
|
-
Style/MethodDefParentheses:
|
|
24
|
-
Enabled: true
|
|
25
|
-
|
|
26
|
-
Style/SingleLineMethods:
|
|
27
|
-
Enabled: true
|
|
28
|
-
|
|
29
|
-
Style/Semicolon:
|
|
30
|
-
Enabled: true
|
|
31
|
-
AllowAsExpressionSeparator: true
|
|
32
|
-
|
|
33
|
-
Style/RedundantReturn:
|
|
34
|
-
Enabled: true
|
|
35
|
-
|
|
36
|
-
Style/GlobalVars:
|
|
37
|
-
Enabled: true
|
|
38
|
-
Severity: warning
|
|
39
|
-
Exclude:
|
|
40
|
-
- "lib/tasks/**/*"
|
|
41
|
-
- "script/**/*"
|
|
42
|
-
- "**/spec/**/*"
|
|
43
|
-
|
|
44
|
-
Style/InvertibleUnlessCondition:
|
|
45
|
-
Enabled: true
|
|
46
|
-
|
|
47
|
-
Style/NegatedUnless:
|
|
48
|
-
Enabled: true
|
|
49
|
-
|
|
50
|
-
Style/UnlessElse:
|
|
51
|
-
Enabled: true
|
|
52
|
-
|
|
53
|
-
Style/UnlessLogicalOperators:
|
|
54
|
-
Enabled: true
|
|
55
|
-
|
|
56
|
-
Lint/Debugger:
|
|
57
|
-
Enabled: true
|
|
58
|
-
|
|
59
|
-
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
|
60
|
-
Lint/RequireParentheses:
|
|
61
|
-
Enabled: true
|
|
62
|
-
|
|
63
|
-
Lint/ShadowingOuterLocalVariable:
|
|
64
|
-
Enabled: true
|
|
65
|
-
|
|
66
|
-
Bundler/OrderedGems:
|
|
67
|
-
Enabled: false
|
|
68
|
-
|
|
69
|
-
Layout/LineLength:
|
|
70
|
-
Enabled: false
|
|
71
|
-
|
|
72
|
-
Lint/ParenthesesAsGroupedExpression:
|
|
73
|
-
Enabled: true
|
|
74
|
-
|
|
75
|
-
Lint/DuplicateMethods:
|
|
76
|
-
Enabled: true
|
|
77
|
-
|
|
78
|
-
Lint/RedundantWithIndex:
|
|
79
|
-
Enabled: true
|
|
80
|
-
|
|
81
|
-
Lint/RedundantRequireStatement:
|
|
82
|
-
Enabled: true
|
|
83
|
-
|
|
84
|
-
Lint/LiteralInInterpolation:
|
|
85
|
-
Enabled: true
|
|
86
|
-
|
|
87
|
-
Lint/RedundantStringCoercion:
|
|
88
|
-
Enabled: true
|
|
89
|
-
|
|
90
|
-
Lint/BooleanSymbol:
|
|
91
|
-
Enabled: true
|
|
92
|
-
AutoCorrect: false # it breaks the code
|
|
93
|
-
|
|
94
|
-
Lint/ShadowedArgument:
|
|
95
|
-
Enabled: true
|
|
96
|
-
|
|
97
|
-
Lint/RedundantCopDisableDirective:
|
|
98
|
-
Enabled: true
|
|
99
|
-
|
|
100
|
-
Lint/EmptyEnsure:
|
|
101
|
-
Enabled: true
|
|
102
|
-
|
|
103
|
-
Lint/RedundantWithObject:
|
|
104
|
-
Enabled: true
|
|
105
|
-
|
|
106
|
-
Lint/SelfAssignment:
|
|
107
|
-
Enabled: true
|
|
108
|
-
|
|
109
|
-
Lint/Void:
|
|
110
|
-
Enabled: true
|
|
111
|
-
|
|
112
|
-
Lint/UselessMethodDefinition:
|
|
113
|
-
Enabled: true
|
|
114
|
-
|
|
115
|
-
Lint/UnreachableCode:
|
|
116
|
-
Enabled: true
|
|
117
|
-
|
|
118
|
-
Lint/DeprecatedOpenSSLConstant:
|
|
119
|
-
Enabled: true
|
|
120
|
-
|
|
121
|
-
Lint/DisjunctiveAssignmentInConstructor:
|
|
122
|
-
Enabled: true
|
|
123
|
-
|
|
124
|
-
Lint/NonLocalExitFromIterator:
|
|
125
|
-
Enabled: true
|
|
126
|
-
|
|
127
|
-
Lint/DeprecatedClassMethods:
|
|
128
|
-
Enabled: true
|
|
129
|
-
|
|
130
|
-
Lint/SafeNavigationChain:
|
|
131
|
-
Enabled: true
|
|
132
|
-
|
|
133
|
-
Lint/RedundantSafeNavigation:
|
|
134
|
-
Enabled: true
|
|
135
|
-
|
|
136
|
-
Lint/EmptyConditionalBody:
|
|
137
|
-
Enabled: true
|
|
138
|
-
|
|
139
|
-
Lint/SafeNavigationConsistency:
|
|
140
|
-
Enabled: true
|
|
141
|
-
|
|
142
|
-
Lint/OrAssignmentToConstant:
|
|
143
|
-
Enabled: true
|
|
1
|
+
inherit_gem:
|
|
2
|
+
rubocop-discourse-base: rubocop-core.yml
|
data/rubocop-discourse.gemspec
CHANGED
|
@@ -12,12 +12,25 @@ Gem::Specification.new do |s|
|
|
|
12
12
|
s.license = "MIT"
|
|
13
13
|
s.homepage = "https://github.com/discourse/rubocop-discourse"
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
config_files = %w[
|
|
16
|
+
default.yml
|
|
17
|
+
rubocop-core.yml
|
|
18
|
+
rubocop-layout.yml
|
|
19
|
+
rubocop-capybara.yml
|
|
20
|
+
rubocop-factory_bot.yml
|
|
21
|
+
rubocop-rspec.yml
|
|
22
|
+
rubocop-rails.yml
|
|
23
|
+
stree-compat.yml
|
|
24
|
+
config/default.yml
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
s.files = %w[LICENSE README.md rubocop-discourse.gemspec] + config_files + Dir["lib/**/*.rb"]
|
|
16
28
|
s.require_paths = ["lib"]
|
|
17
29
|
s.metadata["default_lint_roller_plugin"] = "RuboCop::Discourse::Plugin"
|
|
18
30
|
|
|
31
|
+
s.required_ruby_version = ">= 3.0"
|
|
19
32
|
s.add_runtime_dependency "activesupport", ">= 6.1"
|
|
20
|
-
s.add_runtime_dependency "rubocop", ">= 1.
|
|
33
|
+
s.add_runtime_dependency "rubocop-discourse-base", ">= 1.0.0"
|
|
21
34
|
s.add_runtime_dependency "rubocop-rspec", ">= 3.0.1"
|
|
22
35
|
s.add_runtime_dependency "rubocop-factory_bot", ">= 2.27.0"
|
|
23
36
|
s.add_runtime_dependency "rubocop-capybara", ">= 2.22.0"
|
data/rubocop-layout.yml
CHANGED
|
@@ -1,80 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Enabled: true
|
|
4
|
-
|
|
5
|
-
# Align comments with method definitions.
|
|
6
|
-
Layout/CommentIndentation:
|
|
7
|
-
Enabled: true
|
|
8
|
-
|
|
9
|
-
# No extra empty lines.
|
|
10
|
-
Layout/EmptyLines:
|
|
11
|
-
Enabled: true
|
|
12
|
-
|
|
13
|
-
# Use empty lines between definitions.
|
|
14
|
-
Layout/EmptyLineBetweenDefs:
|
|
15
|
-
Enabled: true
|
|
16
|
-
|
|
17
|
-
# Two spaces, no tabs (for indentation).
|
|
18
|
-
Layout/IndentationWidth:
|
|
19
|
-
Enabled: true
|
|
20
|
-
|
|
21
|
-
Layout/SpaceAfterColon:
|
|
22
|
-
Enabled: true
|
|
23
|
-
|
|
24
|
-
Layout/SpaceAfterComma:
|
|
25
|
-
Enabled: true
|
|
26
|
-
|
|
27
|
-
Layout/SpaceAroundEqualsInParameterDefault:
|
|
28
|
-
Enabled: true
|
|
29
|
-
|
|
30
|
-
Layout/SpaceAroundKeyword:
|
|
31
|
-
Enabled: true
|
|
32
|
-
|
|
33
|
-
Layout/SpaceAroundOperators:
|
|
34
|
-
Enabled: true
|
|
35
|
-
|
|
36
|
-
Layout/SpaceBeforeFirstArg:
|
|
37
|
-
Enabled: true
|
|
38
|
-
|
|
39
|
-
# Use `foo {}` not `foo{}`.
|
|
40
|
-
Layout/SpaceBeforeBlockBraces:
|
|
41
|
-
Enabled: true
|
|
42
|
-
|
|
43
|
-
# Use `foo { bar }` not `foo {bar}`.
|
|
44
|
-
Layout/SpaceInsideBlockBraces:
|
|
45
|
-
Enabled: true
|
|
46
|
-
|
|
47
|
-
# Use `{ a: 1 }` not `{a:1}`.
|
|
48
|
-
Layout/SpaceInsideHashLiteralBraces:
|
|
49
|
-
Enabled: true
|
|
50
|
-
|
|
51
|
-
Layout/SpaceInsideParens:
|
|
52
|
-
Enabled: true
|
|
53
|
-
|
|
54
|
-
# Detect hard tabs, no hard tabs.
|
|
55
|
-
Layout/IndentationStyle:
|
|
56
|
-
Enabled: true
|
|
57
|
-
|
|
58
|
-
# Blank lines should not have any spaces.
|
|
59
|
-
Layout/TrailingEmptyLines:
|
|
60
|
-
Enabled: true
|
|
61
|
-
|
|
62
|
-
# No trailing whitespace.
|
|
63
|
-
Layout/TrailingWhitespace:
|
|
64
|
-
Enabled: true
|
|
65
|
-
|
|
66
|
-
Layout/BlockAlignment:
|
|
67
|
-
Enabled: true
|
|
68
|
-
|
|
69
|
-
# Align `end` with the matching keyword or starting expression except for
|
|
70
|
-
# assignments, where it should be aligned with the LHS.
|
|
71
|
-
Layout/EndAlignment:
|
|
72
|
-
Enabled: true
|
|
73
|
-
EnforcedStyleAlignWith: variable
|
|
74
|
-
|
|
75
|
-
Layout/MultilineMethodCallIndentation:
|
|
76
|
-
Enabled: true
|
|
77
|
-
EnforcedStyle: indented
|
|
78
|
-
|
|
79
|
-
Layout/HashAlignment:
|
|
80
|
-
Enabled: true
|
|
1
|
+
inherit_gem:
|
|
2
|
+
rubocop-discourse-base: rubocop-layout.yml
|