rubocop-discourse 3.9.1 → 3.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +1 -1
- data/.rspec +1 -0
- data/config/default.yml +24 -31
- data/lib/rubocop/cop/discourse/services/empty_lines_around_blocks.rb +5 -1
- data/rubocop-core.yml +2 -3
- data/rubocop-discourse.gemspec +1 -1
- data/rubocop-rspec.yml +5 -5
- data/spec/lib/rubocop/cop/discourse/services/empty_lines_around_blocks_spec.rb +17 -2
- data/spec/lib/rubocop/cop/discourse/services/group_keywords_spec.rb +0 -2
- data/spec/lib/rubocop/cop/fabricator_shorthand_spec.rb +1 -3
- data/spec/lib/rubocop/cop/no_add_reference_active_record_migrations_spec.rb +1 -3
- data/spec/lib/rubocop/cop/no_mixing_multisite_and_standard_specs_spec.rb +1 -3
- data/spec/lib/rubocop/cop/no_mocking_jobs_enqueue_spec.rb +1 -3
- data/spec/lib/rubocop/cop/no_reset_column_information_migrations_spec.rb +1 -3
- data/spec/lib/rubocop/cop/only_top_level_multisite_specs_spec.rb +1 -3
- data/spec/lib/rubocop/cop/plugins/call_requires_plugin_spec.rb +0 -2
- data/spec/lib/rubocop/cop/plugins/namespace_constants_spec.rb +0 -2
- data/spec/lib/rubocop/cop/plugins/namespace_methods_spec.rb +0 -2
- data/spec/lib/rubocop/cop/plugins/no_monkey_patching_spec.rb +0 -2
- data/spec/lib/rubocop/cop/plugins/use_plugin_instance_on_spec.rb +0 -2
- data/spec/lib/rubocop/cop/plugins/use_require_relative_spec.rb +0 -2
- data/spec/lib/rubocop/cop/time_eq_matcher_spec.rb +1 -3
- data/stree-compat.yml +8 -9
- metadata +4 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4003717b78bca02f538f48bc23fdd1b0e913bb6816c5d6a1e87401c53c167a14
|
4
|
+
data.tar.gz: acba524c9e7e399a5b69974ce94dfefa33fbd61c5c2197ecb425b1ed22418e23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fd47066d7d8066da4adb2f17d95de3420fbaae18599d07925671a28c58a95a2d39b4ba8319813a0daf2106e7ecce4407a99470a93f2d99f335147bad3142269
|
7
|
+
data.tar.gz: 311df91f7d4cf9b5e296d3dcbf625482a0fdea6ac1da33fe389b7db41ec0339b4918434ce97a13c023ba86e3a54eb81edcb512aba7cb9abd0a21b19bb5b5527d
|
data/.github/workflows/ci.yml
CHANGED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require 'spec_helper'
|
data/config/default.yml
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
Discourse/NoChdir:
|
2
2
|
Enabled: true
|
3
3
|
Exclude:
|
4
|
-
-
|
5
|
-
- 'plugins/*/spec/**/*'
|
4
|
+
- "**/spec/**/*" # Specs are run sequentially, so chdir can be used
|
6
5
|
|
7
6
|
Discourse/NoTimeNewWithoutArgs:
|
8
7
|
Enabled: true
|
@@ -13,8 +12,8 @@ Discourse/NoURIEscapeEncode:
|
|
13
12
|
Discourse/NoAddReferenceOrAliasesActiveRecordMigration:
|
14
13
|
Enabled: true
|
15
14
|
Include:
|
16
|
-
-
|
17
|
-
-
|
15
|
+
- "**/db/migrate/*"
|
16
|
+
- "**/db/post_migrate/*"
|
18
17
|
|
19
18
|
Discourse/NoNokogiriHtmlFragment:
|
20
19
|
Enabled: true
|
@@ -22,51 +21,45 @@ Discourse/NoNokogiriHtmlFragment:
|
|
22
21
|
Discourse/NoResetColumnInformationInMigrations:
|
23
22
|
Enabled: false
|
24
23
|
Include:
|
25
|
-
-
|
26
|
-
-
|
24
|
+
- "**/db/migrate/*"
|
25
|
+
- "**/db/post_migrate/*"
|
27
26
|
|
28
27
|
# Specs
|
29
28
|
|
30
29
|
Discourse/NoDirectMultisiteManipulation:
|
31
30
|
Enabled: true
|
32
|
-
|
33
|
-
-
|
34
|
-
- '(?:^|/)spec/'
|
31
|
+
Include:
|
32
|
+
- "**/spec/**/*"
|
35
33
|
|
36
34
|
Discourse/TimeEqMatcher:
|
37
35
|
Enabled: true
|
38
|
-
|
39
|
-
-
|
40
|
-
- '(?:^|/)spec/'
|
36
|
+
Include:
|
37
|
+
- "**/spec/**/*"
|
41
38
|
|
42
39
|
Discourse/NoJsonParseResponse:
|
43
40
|
Enabled: false
|
44
|
-
|
45
|
-
-
|
46
|
-
- '(?:^|/)spec/'
|
41
|
+
Include:
|
42
|
+
- "**/spec/**/*"
|
47
43
|
|
48
44
|
Discourse/NoMockingJobs:
|
49
45
|
Enabled: true
|
50
|
-
|
51
|
-
-
|
52
|
-
- '(?:^|/)spec/'
|
46
|
+
Include:
|
47
|
+
- "**/spec/**/*"
|
53
48
|
|
54
49
|
Discourse/OnlyTopLevelMultisiteSpecs:
|
55
50
|
Enabled: true
|
56
|
-
|
57
|
-
-
|
58
|
-
- '(?:^|/)spec/'
|
51
|
+
Include:
|
52
|
+
- "**/spec/**/*"
|
59
53
|
|
60
54
|
Discourse/NoMixingMultisiteAndStandardSpecs:
|
61
55
|
Enabled: true
|
62
|
-
|
63
|
-
-
|
64
|
-
- '(?:^|/)spec/'
|
56
|
+
Include:
|
57
|
+
- "**/spec/**/*"
|
65
58
|
|
66
59
|
Discourse/Plugins/CallRequiresPlugin:
|
67
60
|
Enabled: true
|
68
61
|
Include:
|
69
|
-
-
|
62
|
+
- "app/controllers/**/*"
|
70
63
|
|
71
64
|
Discourse/Plugins/UsePluginInstanceOn:
|
72
65
|
Enabled: true
|
@@ -74,16 +67,16 @@ Discourse/Plugins/UsePluginInstanceOn:
|
|
74
67
|
Discourse/Plugins/NamespaceMethods:
|
75
68
|
Enabled: true
|
76
69
|
Exclude:
|
77
|
-
-
|
78
|
-
-
|
79
|
-
-
|
70
|
+
- "**/spec/**/*"
|
71
|
+
- "**/tasks/**/*.rake"
|
72
|
+
- "**/db/fixtures/**/*"
|
80
73
|
|
81
74
|
Discourse/Plugins/NamespaceConstants:
|
82
75
|
Enabled: true
|
83
76
|
Exclude:
|
84
|
-
-
|
85
|
-
-
|
86
|
-
-
|
77
|
+
- "**/spec/**/*"
|
78
|
+
- "**/tasks/**/*.rake"
|
79
|
+
- "**/db/fixtures/**/*"
|
87
80
|
|
88
81
|
Discourse/Plugins/UseRequireRelative:
|
89
82
|
Enabled: true
|
@@ -53,7 +53,7 @@ module RuboCop
|
|
53
53
|
def on_block(node)
|
54
54
|
return unless service?
|
55
55
|
return unless top_level_block?(node)
|
56
|
-
return if node.single_line?
|
56
|
+
return if node.single_line? || single_block?(node)
|
57
57
|
|
58
58
|
if missing_empty_lines?(node)
|
59
59
|
add_offense(node, message: MSG) do |corrector|
|
@@ -78,6 +78,10 @@ module RuboCop
|
|
78
78
|
|
79
79
|
private
|
80
80
|
|
81
|
+
def single_block?(node)
|
82
|
+
!node.ancestors.first.begin_type?
|
83
|
+
end
|
84
|
+
|
81
85
|
def service?
|
82
86
|
@service
|
83
87
|
end
|
data/rubocop-core.yml
CHANGED
@@ -39,8 +39,7 @@ Style/GlobalVars:
|
|
39
39
|
Exclude:
|
40
40
|
- "lib/tasks/**/*"
|
41
41
|
- "script/**/*"
|
42
|
-
- "spec
|
43
|
-
- "plugins/*/spec/**/*"
|
42
|
+
- "**/spec/**/*"
|
44
43
|
|
45
44
|
Style/InvertibleUnlessCondition:
|
46
45
|
Enabled: true
|
@@ -142,4 +141,4 @@ Lint/SafeNavigationConsistency:
|
|
142
141
|
Enabled: true
|
143
142
|
|
144
143
|
Lint/OrAssignmentToConstant:
|
145
|
-
Enabled: true
|
144
|
+
Enabled: true
|
data/rubocop-discourse.gemspec
CHANGED
data/rubocop-rspec.yml
CHANGED
@@ -228,11 +228,11 @@ RSpec/Dialect:
|
|
228
228
|
Enabled: true
|
229
229
|
PreferredMethods:
|
230
230
|
background: :before
|
231
|
-
scenario:
|
232
|
-
xscenario:
|
233
|
-
given:
|
234
|
-
given!:
|
235
|
-
feature:
|
231
|
+
scenario: :it
|
232
|
+
xscenario: :xit
|
233
|
+
given: :let
|
234
|
+
given!: :let!
|
235
|
+
feature: :describe
|
236
236
|
|
237
237
|
RSpecRails/HttpStatus:
|
238
238
|
Enabled: true
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
3
|
RSpec.describe RuboCop::Cop::Discourse::Services::EmptyLinesAroundBlocks,
|
6
4
|
:config do
|
7
5
|
subject(:cop) { described_class.new(config) }
|
@@ -130,6 +128,23 @@ RSpec.describe RuboCop::Cop::Discourse::Services::EmptyLinesAroundBlocks,
|
|
130
128
|
end
|
131
129
|
|
132
130
|
context "when blocks are nested" do
|
131
|
+
context "when there is just one nested block" do
|
132
|
+
it "does not register an offense" do
|
133
|
+
expect_no_offenses(<<~RUBY)
|
134
|
+
class MyService
|
135
|
+
include Service::Base
|
136
|
+
|
137
|
+
transaction do
|
138
|
+
try do
|
139
|
+
step :first_step
|
140
|
+
step :second_step
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
RUBY
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
133
148
|
context "when the nested block is in the first position" do
|
134
149
|
context "when there is no empty line before" do
|
135
150
|
it "does not register an offense" do
|
@@ -1,8 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
describe RuboCop::Cop::Discourse::FabricatorShorthand, :config do
|
3
|
+
RSpec.describe RuboCop::Cop::Discourse::FabricatorShorthand, :config do
|
6
4
|
subject(:cop) { described_class.new(config) }
|
7
5
|
|
8
6
|
let(:config) { RuboCop::Config.new }
|
@@ -1,8 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
describe RuboCop::Cop::Discourse::NoAddReferenceOrAliasesActiveRecordMigration, :config do
|
3
|
+
RSpec.describe RuboCop::Cop::Discourse::NoAddReferenceOrAliasesActiveRecordMigration, :config do
|
6
4
|
subject(:cop) { described_class.new(config) }
|
7
5
|
|
8
6
|
let(:config) { RuboCop::Config.new }
|
@@ -1,8 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
describe RuboCop::Cop::Discourse::NoMixingMultisiteAndStandardSpecs, :config do
|
3
|
+
RSpec.describe RuboCop::Cop::Discourse::NoMixingMultisiteAndStandardSpecs, :config do
|
6
4
|
subject(:cop) { described_class.new(config) }
|
7
5
|
|
8
6
|
let(:config) { RuboCop::Config.new }
|
@@ -1,8 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
describe RuboCop::Cop::Discourse::NoMockingJobs, :config do
|
3
|
+
RSpec.describe RuboCop::Cop::Discourse::NoMockingJobs, :config do
|
6
4
|
subject(:cop) { described_class.new(config) }
|
7
5
|
|
8
6
|
let(:config) { RuboCop::Config.new }
|
@@ -1,8 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
describe RuboCop::Cop::Discourse::NoResetColumnInformationInMigrations, :config do
|
3
|
+
RSpec.describe RuboCop::Cop::Discourse::NoResetColumnInformationInMigrations, :config do
|
6
4
|
subject(:cop) { described_class.new(config) }
|
7
5
|
|
8
6
|
let(:config) { RuboCop::Config.new }
|
@@ -1,8 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
describe RuboCop::Cop::Discourse::OnlyTopLevelMultisiteSpecs, :config do
|
3
|
+
RSpec.describe RuboCop::Cop::Discourse::OnlyTopLevelMultisiteSpecs, :config do
|
6
4
|
subject(:cop) { described_class.new(config) }
|
7
5
|
|
8
6
|
let(:config) { RuboCop::Config.new }
|
@@ -1,8 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
describe RuboCop::Cop::Discourse::TimeEqMatcher, :config do
|
3
|
+
RSpec.describe RuboCop::Cop::Discourse::TimeEqMatcher, :config do
|
6
4
|
subject(:cop) { described_class.new(config) }
|
7
5
|
|
8
6
|
let(:config) { RuboCop::Config.new }
|
data/stree-compat.yml
CHANGED
@@ -13,13 +13,13 @@ AllCops:
|
|
13
13
|
SuggestExtensions: false
|
14
14
|
DisabledByDefault: true
|
15
15
|
Exclude:
|
16
|
-
-
|
17
|
-
-
|
18
|
-
-
|
19
|
-
-
|
20
|
-
-
|
21
|
-
-
|
22
|
-
-
|
16
|
+
- "db/schema.rb"
|
17
|
+
- "bundle/**/*"
|
18
|
+
- "vendor/**/*"
|
19
|
+
- "**/node_modules/**/*"
|
20
|
+
- "public/**/*"
|
21
|
+
- "plugins/**/gems/**/*"
|
22
|
+
- "plugins/**/vendor/**/*"
|
23
23
|
|
24
24
|
Discourse:
|
25
25
|
Enabled: true
|
@@ -27,5 +27,4 @@ Discourse:
|
|
27
27
|
Discourse/FabricatorShorthand:
|
28
28
|
Enabled: true
|
29
29
|
Include:
|
30
|
-
-
|
31
|
-
- 'plugins/*/spec/**/*_spec.rb'
|
30
|
+
- "**/spec/**/*"
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-discourse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.9.
|
4
|
+
version: 3.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Discourse Team
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
10
|
+
date: 2025-01-31 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: activesupport
|
@@ -136,14 +135,13 @@ dependencies:
|
|
136
135
|
- - "~>"
|
137
136
|
- !ruby/object:Gem::Version
|
138
137
|
version: 3.12.0
|
139
|
-
description:
|
140
|
-
email:
|
141
138
|
executables: []
|
142
139
|
extensions: []
|
143
140
|
extra_rdoc_files: []
|
144
141
|
files:
|
145
142
|
- ".github/workflows/ci.yml"
|
146
143
|
- ".gitignore"
|
144
|
+
- ".rspec"
|
147
145
|
- ".rubocop.yml"
|
148
146
|
- Gemfile
|
149
147
|
- LICENSE
|
@@ -211,7 +209,6 @@ homepage: https://github.com/discourse/rubocop-discourse
|
|
211
209
|
licenses:
|
212
210
|
- MIT
|
213
211
|
metadata: {}
|
214
|
-
post_install_message:
|
215
212
|
rdoc_options: []
|
216
213
|
require_paths:
|
217
214
|
- lib
|
@@ -226,8 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
226
223
|
- !ruby/object:Gem::Version
|
227
224
|
version: '0'
|
228
225
|
requirements: []
|
229
|
-
rubygems_version: 3.
|
230
|
-
signing_key:
|
226
|
+
rubygems_version: 3.6.2
|
231
227
|
specification_version: 4
|
232
228
|
summary: Custom rubocop cops used by Discourse
|
233
229
|
test_files: []
|