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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 77217a0f29ec6a88cb9cd14fc09d951b5d6a6801bdc79b4705a3a18d29ca87bd
4
- data.tar.gz: 0ba701b3bb6ef09efacf793df893be4be9808de1d492a0851195dcb95ed01326
3
+ metadata.gz: 4003717b78bca02f538f48bc23fdd1b0e913bb6816c5d6a1e87401c53c167a14
4
+ data.tar.gz: acba524c9e7e399a5b69974ce94dfefa33fbd61c5c2197ecb425b1ed22418e23
5
5
  SHA512:
6
- metadata.gz: 0fc6f9d26180f1b00c98d0c5661776c56489fcda4be09f6431aee482a6a49cf1879e6827475cc374ff7f19cfcf952977f1d47f63e0ecc5bce321900d0e0dcf76
7
- data.tar.gz: 8aa918ebf81e7e5d1c7fa1570b96d92ecd71c90d1d143ef8ae786d5325a2fc49763b87db414d0e7db0aafa0f4af3ab75822432bfee0df63e1cdb5de161bf4747
6
+ metadata.gz: 9fd47066d7d8066da4adb2f17d95de3420fbaae18599d07925671a28c58a95a2d39b4ba8319813a0daf2106e7ecce4407a99470a93f2d99f335147bad3142269
7
+ data.tar.gz: 311df91f7d4cf9b5e296d3dcbf625482a0fdea6ac1da33fe389b7db41ec0339b4918434ce97a13c023ba86e3a54eb81edcb512aba7cb9abd0a21b19bb5b5527d
@@ -34,7 +34,7 @@ jobs:
34
34
  - uses: actions/checkout@v3
35
35
 
36
36
  - name: Release Gem
37
- uses: discourse/publish-rubygems-action@v2
37
+ uses: discourse/publish-rubygems-action@v3
38
38
  env:
39
39
  RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
40
40
  GIT_EMAIL: team@discourse.org
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
- - 'spec/**/*' # Specs are run sequentially, so chdir can be used
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
- - '**/db/migrate/*'
17
- - '**/db/post_migrate/*'
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
- - '**/db/migrate/*'
26
- - '**/db/post_migrate/*'
24
+ - "**/db/migrate/*"
25
+ - "**/db/post_migrate/*"
27
26
 
28
27
  # Specs
29
28
 
30
29
  Discourse/NoDirectMultisiteManipulation:
31
30
  Enabled: true
32
- Patterns:
33
- - _spec.rb
34
- - '(?:^|/)spec/'
31
+ Include:
32
+ - "**/spec/**/*"
35
33
 
36
34
  Discourse/TimeEqMatcher:
37
35
  Enabled: true
38
- Patterns:
39
- - _spec.rb
40
- - '(?:^|/)spec/'
36
+ Include:
37
+ - "**/spec/**/*"
41
38
 
42
39
  Discourse/NoJsonParseResponse:
43
40
  Enabled: false
44
- Patterns:
45
- - _spec.rb
46
- - '(?:^|/)spec/'
41
+ Include:
42
+ - "**/spec/**/*"
47
43
 
48
44
  Discourse/NoMockingJobs:
49
45
  Enabled: true
50
- Patterns:
51
- - _spec.rb
52
- - '(?:^|/)spec/'
46
+ Include:
47
+ - "**/spec/**/*"
53
48
 
54
49
  Discourse/OnlyTopLevelMultisiteSpecs:
55
50
  Enabled: true
56
- Patterns:
57
- - _spec.rb
58
- - '(?:^|/)spec/'
51
+ Include:
52
+ - "**/spec/**/*"
59
53
 
60
54
  Discourse/NoMixingMultisiteAndStandardSpecs:
61
55
  Enabled: true
62
- Patterns:
63
- - _spec.rb
64
- - '(?:^|/)spec/'
56
+ Include:
57
+ - "**/spec/**/*"
65
58
 
66
59
  Discourse/Plugins/CallRequiresPlugin:
67
60
  Enabled: true
68
61
  Include:
69
- - 'app/controllers/**/*'
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
- - '**/spec/**/*'
78
- - '**/tasks/**/*.rake'
79
- - '**/db/fixtures/**/*'
70
+ - "**/spec/**/*"
71
+ - "**/tasks/**/*.rake"
72
+ - "**/db/fixtures/**/*"
80
73
 
81
74
  Discourse/Plugins/NamespaceConstants:
82
75
  Enabled: true
83
76
  Exclude:
84
- - '**/spec/**/*'
85
- - '**/tasks/**/*.rake'
86
- - '**/db/fixtures/**/*'
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/**/*.rb"
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "rubocop-discourse"
5
- s.version = "3.9.1"
5
+ s.version = "3.9.3"
6
6
  s.summary = "Custom rubocop cops used by Discourse"
7
7
  s.authors = ["Discourse Team"]
8
8
  s.license = "MIT"
data/rubocop-rspec.yml CHANGED
@@ -228,11 +228,11 @@ RSpec/Dialect:
228
228
  Enabled: true
229
229
  PreferredMethods:
230
230
  background: :before
231
- scenario: :it
232
- xscenario: :xit
233
- given: :let
234
- given!: :let!
235
- feature: :describe
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,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "spec_helper"
4
-
5
3
  RSpec.describe RuboCop::Cop::Discourse::Services::GroupKeywords, :config do
6
4
  subject(:cop) { described_class.new(config) }
7
5
 
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "spec_helper"
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
- require "spec_helper"
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
- require "spec_helper"
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
- require "spec_helper"
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
- require "spec_helper"
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
- require "spec_helper"
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,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "spec_helper"
4
-
5
3
  RSpec.describe RuboCop::Cop::Discourse::Plugins::CallRequiresPlugin, :config do
6
4
  subject(:cop) { described_class.new(config) }
7
5
 
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "spec_helper"
4
-
5
3
  RSpec.describe RuboCop::Cop::Discourse::Plugins::NamespaceConstants, :config do
6
4
  subject(:cop) { described_class.new(config) }
7
5
 
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "spec_helper"
4
-
5
3
  RSpec.describe RuboCop::Cop::Discourse::Plugins::NamespaceMethods, :config do
6
4
  subject(:cop) { described_class.new(config) }
7
5
 
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "spec_helper"
4
-
5
3
  RSpec.describe RuboCop::Cop::Discourse::Plugins::NoMonkeyPatching, :config do
6
4
  subject(:cop) { described_class.new(config) }
7
5
 
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "spec_helper"
4
-
5
3
  RSpec.describe RuboCop::Cop::Discourse::Plugins::UsePluginInstanceOn, :config do
6
4
  subject(:cop) { described_class.new(config) }
7
5
 
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "spec_helper"
4
-
5
3
  RSpec.describe RuboCop::Cop::Discourse::Plugins::UseRequireRelative, :config do
6
4
  subject(:cop) { described_class.new(config) }
7
5
 
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "spec_helper"
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
- - 'db/schema.rb'
17
- - 'bundle/**/*'
18
- - 'vendor/**/*'
19
- - '**/node_modules/**/*'
20
- - 'public/**/*'
21
- - 'plugins/**/gems/**/*'
22
- - 'plugins/**/vendor/**/*'
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
- - 'spec/**/*_spec.rb'
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.1
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-04 00:00:00.000000000 Z
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.1.6
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: []