rubocop-discourse 3.1.0 → 3.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 41746c69c5012edbafa4e2f85d902a55a72235316897c0a5afdff69a7b7abbda
4
- data.tar.gz: b0128a77bf8387b94c7797c6e3df26a0eb1b0ffb68a87122b005e34aab13a448
3
+ metadata.gz: c437452f89089230f8ab04486bbe351745b094292c80f838671fdcd33d83bdab
4
+ data.tar.gz: d4438004c26aee64eff9e6a2f0d335767b412ab2563e5e9d3bdbc1833be1a678
5
5
  SHA512:
6
- metadata.gz: abf20aff53a75d624eeb703a3bb86036486ebb6b5dd67b5255312eb8eb7e2ffb04cd57f3cf6ae173bff02a8bee6042fe93acaf038851c2a06011a082e91fd382
7
- data.tar.gz: 53b2e0e2bed1e95f94531819aa4f0c5595e1627231f53f626e6f557c59ab42d854f58362211ae8ff23fa60b5ebea4454185de2d9c4ce0322c71f2ed4e89c91e9
6
+ metadata.gz: 3a19afd24871782b52660905e0f211287fa41779994c21160baeb5c5e3963ea63482d7ea980ac9398a86b0f40c37056fdf82f982afc851bd6632fc6458d803ed
7
+ data.tar.gz: 6b6ee9c891637c8c2355bc1cf451d96245960700ef3d8f859a0845ee3a258eae70cf7c85b19493a2d32f7277a69bd4adbc4a16527eaf4e4c1f96509f14fbb64d
@@ -16,7 +16,7 @@ jobs:
16
16
  - name: Setup ruby
17
17
  uses: ruby/setup-ruby@v1
18
18
  with:
19
- ruby-version: '2.6'
19
+ ruby-version: '3.2'
20
20
  bundler-cache: true
21
21
 
22
22
  - name: Rubocop
data/config/default.yml CHANGED
@@ -13,8 +13,8 @@ Discourse/NoURIEscapeEncode:
13
13
  Discourse/NoAddReferenceOrAliasesActiveRecordMigration:
14
14
  Enabled: true
15
15
  Include:
16
- - "**/db/migrate/*"
17
- - "**/db/post_migrate/*"
16
+ - '**/db/migrate/*'
17
+ - '**/db/post_migrate/*'
18
18
 
19
19
  Discourse/NoNokogiriHtmlFragment:
20
20
  Enabled: true
@@ -22,43 +22,43 @@ Discourse/NoNokogiriHtmlFragment:
22
22
  Discourse/NoResetColumnInformationInMigrations:
23
23
  Enabled: false
24
24
  Include:
25
- - "**/db/migrate/*"
26
- - "**/db/post_migrate/*"
25
+ - '**/db/migrate/*'
26
+ - '**/db/post_migrate/*'
27
27
 
28
28
  # Specs
29
29
 
30
30
  Discourse/NoDirectMultisiteManipulation:
31
31
  Enabled: true
32
32
  Patterns:
33
- - _spec.rb
34
- - "(?:^|/)spec/"
33
+ - _spec.rb
34
+ - '(?:^|/)spec/'
35
35
 
36
36
  Discourse/TimeEqMatcher:
37
37
  Enabled: true
38
38
  Patterns:
39
- - _spec.rb
40
- - "(?:^|/)spec/"
39
+ - _spec.rb
40
+ - '(?:^|/)spec/'
41
41
 
42
42
  Discourse/NoJsonParseResponse:
43
43
  Enabled: false
44
44
  Patterns:
45
- - _spec.rb
46
- - "(?:^|/)spec/"
45
+ - _spec.rb
46
+ - '(?:^|/)spec/'
47
47
 
48
48
  Discourse/NoMockingJobs:
49
49
  Enabled: true
50
50
  Patterns:
51
- - _spec.rb
52
- - "(?:^|/)spec/"
51
+ - _spec.rb
52
+ - '(?:^|/)spec/'
53
53
 
54
54
  Discourse/OnlyTopLevelMultisiteSpecs:
55
55
  Enabled: true
56
56
  Patterns:
57
- - _spec.rb
58
- - "(?:^|/)spec/"
57
+ - _spec.rb
58
+ - '(?:^|/)spec/'
59
59
 
60
60
  Discourse/NoMixingMultisiteAndStandardSpecs:
61
61
  Enabled: true
62
62
  Patterns:
63
- - _spec.rb
64
- - "(?:^|/)spec/"
63
+ - _spec.rb
64
+ - '(?:^|/)spec/'
@@ -70,12 +70,14 @@ module RuboCop
70
70
  MATCHER
71
71
 
72
72
  def on_send(node)
73
- return if [
74
- using_add_reference?(node),
75
- using_add_belongs_to?(node),
76
- using_t_references?(node),
77
- using_t_belongs_to?(node)
78
- ].none?
73
+ if [
74
+ using_add_reference?(node),
75
+ using_add_belongs_to?(node),
76
+ using_t_references?(node),
77
+ using_t_belongs_to?(node)
78
+ ].none?
79
+ return
80
+ end
79
81
  add_offense(node, message: MSG)
80
82
  end
81
83
  end
@@ -17,7 +17,8 @@ module RuboCop
17
17
  # do_something
18
18
  # end
19
19
  class NoDirectMultisiteManipulation < Cop
20
- MSG = "Use `type: :multisite` example setting instead of modifying `Rails.configuration.multisite`."
20
+ MSG =
21
+ "Use `type: :multisite` example setting instead of modifying `Rails.configuration.multisite`."
21
22
 
22
23
  def_node_matcher :multisite_setter?, <<-MATCHER
23
24
  (send
@@ -12,7 +12,8 @@ module RuboCop
12
12
  # # good
13
13
  # expect(response.parsed_body).to eq({})
14
14
  class NoJsonParseResponse < Cop
15
- MSG = "Use `response.parsed_body` instead of `JSON.parse(response.body)` in specs."
15
+ MSG =
16
+ "Use `response.parsed_body` instead of `JSON.parse(response.body)` in specs."
16
17
 
17
18
  def_node_matcher :json_parse_body?, <<-MATCHER
18
19
  (send
@@ -24,7 +24,8 @@ module RuboCop
24
24
  # describe "x", type: :multisite do
25
25
  # end
26
26
  class NoMixingMultisiteAndStandardSpecs < Cop
27
- MSG = "Do not mix multisite and standard specs. Consider moving multisite describes to a separate file."
27
+ MSG =
28
+ "Do not mix multisite and standard specs. Consider moving multisite describes to a separate file."
28
29
 
29
30
  def initialize(config = nil, options = nil)
30
31
  super
@@ -64,11 +65,7 @@ module RuboCop
64
65
  MATCHER
65
66
 
66
67
  def top_level?(node)
67
- if node.parent&.begin_type?
68
- node.parent.root?
69
- else
70
- node.root?
71
- end
68
+ node.parent&.begin_type? ? node.parent.root? : node.root?
72
69
  end
73
70
  end
74
71
  end
@@ -4,7 +4,8 @@ module RuboCop
4
4
  module Cop
5
5
  module Discourse
6
6
  class NoMockingJobs < Cop
7
- MSG = "Use the test helpers provided by Sidekiq instead of mocking `Jobs.expects(:enqueue)`."
7
+ MSG =
8
+ "Use the test helpers provided by Sidekiq instead of mocking `Jobs.expects(:enqueue)`."
8
9
 
9
10
  def_node_matcher :mocking_jobs_enqueue?, <<~MATCHER
10
11
  (send (const nil? :Jobs) :expects (:sym :enqueue))
@@ -8,10 +8,11 @@ module RuboCop
8
8
  # concurrently for multisites. Also, we don't encourage the use of
9
9
  # ActiveRecord methods in migrations and prefer to write SQL directly.
10
10
  class NoResetColumnInformationInMigrations < Cop
11
- MSG = "ActiveRecord::ModelSchema.reset_column_information is not thread-safe " \
12
- "and we run migrations concurrently on multisite clusters. Using this " \
13
- "method also means ActiveRecord methods are being used in migration "\
14
- "which is discouraged at Discourse. Instead, you should write SQL in your migrations instead."
11
+ MSG =
12
+ "ActiveRecord::ModelSchema.reset_column_information is not thread-safe " \
13
+ "and we run migrations concurrently on multisite clusters. Using this " \
14
+ "method also means ActiveRecord methods are being used in migration " \
15
+ "which is discouraged at Discourse. Instead, you should write SQL in your migrations instead."
15
16
 
16
17
  def on_send(node)
17
18
  return if node.method_name != :reset_column_information
@@ -16,7 +16,8 @@ module RuboCop
16
16
  # UrlHelper.encode("https://a%20a.com?a='a%22")
17
17
  # Addressable::URI.encode("https://a%20a.com?a='a%22")
18
18
  class NoURIEscapeEncode < Cop
19
- MSG = "URI.escape, URI.encode, URI.unescape, URI.decode are deprecated and should not be used."
19
+ MSG =
20
+ "URI.escape, URI.encode, URI.unescape, URI.decode are deprecated and should not be used."
20
21
 
21
22
  def_node_matcher :using_uri_escape?, <<-MATCHER
22
23
  (send (const nil? :URI) :escape ...)
@@ -35,12 +36,14 @@ module RuboCop
35
36
  MATCHER
36
37
 
37
38
  def on_send(node)
38
- return if [
39
- using_uri_escape?(node),
40
- using_uri_encode?(node),
41
- using_uri_unescape?(node),
42
- using_uri_decode?(node)
43
- ].none?
39
+ if [
40
+ using_uri_escape?(node),
41
+ using_uri_encode?(node),
42
+ using_uri_unescape?(node),
43
+ using_uri_decode?(node)
44
+ ].none?
45
+ return
46
+ end
44
47
  add_offense(node, message: MSG)
45
48
  end
46
49
  end
@@ -47,11 +47,7 @@ module RuboCop
47
47
  MATCHER
48
48
 
49
49
  def top_level?(node)
50
- if node.parent&.begin_type?
51
- node.parent.root?
52
- else
53
- node.root?
54
- end
50
+ node.parent&.begin_type? ? node.parent.root? : node.root?
55
51
  end
56
52
  end
57
53
  end
@@ -3,9 +3,9 @@
3
3
  module RuboCop
4
4
  # RuboCop Discourse project namespace
5
5
  module Discourse
6
- PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze
7
- CONFIG_DEFAULT = PROJECT_ROOT.join('config', 'default.yml').freeze
8
- CONFIG = YAML.safe_load(CONFIG_DEFAULT.read).freeze
6
+ PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze
7
+ CONFIG_DEFAULT = PROJECT_ROOT.join("config", "default.yml").freeze
8
+ CONFIG = YAML.safe_load(CONFIG_DEFAULT.read).freeze
9
9
 
10
10
  private_constant(:CONFIG_DEFAULT, :PROJECT_ROOT)
11
11
  end
data/rubocop-core.yml CHANGED
@@ -4,6 +4,9 @@ Security:
4
4
  Security/IoMethods:
5
5
  Enabled: true
6
6
 
7
+ Security/CompoundHash:
8
+ Enabled: true
9
+
7
10
  # Prefer &&/|| over and/or.
8
11
  Style/AndOr:
9
12
  Enabled: true
@@ -14,6 +17,7 @@ Style/FrozenStringLiteralComment:
14
17
  # Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
15
18
  Style/HashSyntax:
16
19
  Enabled: true
20
+ EnforcedShorthandSyntax: either
17
21
 
18
22
  # Defining a method with parameters needs parentheses.
19
23
  Style/MethodDefParentheses:
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Gem::Specification.new do |s|
4
- s.name = "rubocop-discourse"
5
- s.version = "3.1.0"
6
- s.summary = "Custom rubocop cops used by Discourse"
7
- s.authors = ["Discourse Team"]
8
- s.license = "MIT"
9
- s.homepage = "https://github.com/discourse/rubocop-discourse"
4
+ s.name = "rubocop-discourse"
5
+ s.version = "3.3.0"
6
+ s.summary = "Custom rubocop cops used by Discourse"
7
+ s.authors = ["Discourse Team"]
8
+ s.license = "MIT"
9
+ s.homepage = "https://github.com/discourse/rubocop-discourse"
10
10
 
11
11
  s.files = `git ls-files`.split($/)
12
12
  s.require_paths = ["lib"]
data/rubocop-rspec.yml CHANGED
@@ -31,17 +31,17 @@ RSpec/ContextWording:
31
31
  RSpec/DescribeClass:
32
32
  Enabled: true
33
33
  Exclude:
34
- - "**/spec/features/**/*"
35
- - "**/spec/requests/**/*"
36
- - "**/spec/routing/**/*"
37
- - "**/spec/system/**/*"
38
- - "**/spec/views/**/*"
39
- - "**/spec/initializers/**/*"
40
- - "**/spec/integration/**/*"
41
- - "**/spec/integrity/**/*"
42
- - "**/spec/tasks/**/*"
43
- - "**/spec/lib/freedom_patches/**/*"
44
- - "**/spec/multisite/**/*"
34
+ - '**/spec/features/**/*'
35
+ - '**/spec/requests/**/*'
36
+ - '**/spec/routing/**/*'
37
+ - '**/spec/system/**/*'
38
+ - '**/spec/views/**/*'
39
+ - '**/spec/initializers/**/*'
40
+ - '**/spec/integration/**/*'
41
+ - '**/spec/integrity/**/*'
42
+ - '**/spec/tasks/**/*'
43
+ - '**/spec/lib/freedom_patches/**/*'
44
+ - '**/spec/multisite/**/*'
45
45
 
46
46
  RSpec/DescribeMethod:
47
47
  Enabled: true
@@ -73,7 +73,7 @@ RSpec/EmptyLineAfterHook:
73
73
  Enabled: false # TODO
74
74
 
75
75
  RSpec/EmptyLineAfterSubject:
76
- Enabled: false # TODO
76
+ Enabled: true
77
77
 
78
78
  RSpec/ExampleLength:
79
79
  Enabled: false # To be decided
@@ -130,7 +130,7 @@ RSpec/IteratedExpectation:
130
130
  Enabled: false # To be decided
131
131
 
132
132
  RSpec/LeadingSubject:
133
- Enabled: false # TODO
133
+ Enabled: true
134
134
 
135
135
  RSpec/LeakyConstantDeclaration:
136
136
  Enabled: false # To be decided
@@ -157,7 +157,7 @@ RSpec/MultipleSubjects:
157
157
  Enabled: true
158
158
 
159
159
  RSpec/NamedSubject:
160
- Enabled: false # To be decided
160
+ Enabled: true
161
161
 
162
162
  RSpec/NestedGroups:
163
163
  Enabled: false # To be decided
@@ -213,7 +213,7 @@ RSpec/VoidExpect:
213
213
  RSpec/Yield:
214
214
  Enabled: true
215
215
 
216
- RSpec/Capybara/CurrentPathExpectation:
216
+ Capybara/CurrentPathExpectation:
217
217
  Enabled: true
218
218
 
219
219
  RSpec/Capybara/FeatureMethods:
@@ -1,25 +1,25 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
3
+ require "spec_helper"
4
4
 
5
- describe RuboCop::Cop::Discourse::NoAddReferenceOrAliasesActiveRecordMigration, :config do
5
+ describe RuboCop::Cop::Discourse::NoAddReferenceOrAliasesActiveRecordMigration,
6
+ :config do
6
7
  subject(:cop) { described_class.new(config) }
7
- let(:config) do
8
- RuboCop::Config.new
9
- end
8
+
9
+ let(:config) { RuboCop::Config.new }
10
10
 
11
11
  it "raises an offense if add_reference is used, with or without arguments" do
12
12
  inspect_source(<<~RUBY)
13
13
  add_reference :posts, :users, foreign_key: true, null: false
14
14
  RUBY
15
- expect(cop.offenses.first.message).to eq(described_class::MSG)
15
+ expect(cop.offenses.first.message).to match(described_class::MSG)
16
16
  end
17
17
 
18
18
  it "raises an offense if add_belongs_to is used, with or without arguments" do
19
19
  inspect_source(<<~RUBY)
20
20
  add_belongs_to :posts, :users, foreign_key: true, null: false
21
21
  RUBY
22
- expect(cop.offenses.first.message).to eq(described_class::MSG)
22
+ expect(cop.offenses.first.message).to match(described_class::MSG)
23
23
  end
24
24
 
25
25
  it "raises an offense if t.references, or any variable.references is used, with or without arguments" do
@@ -32,7 +32,7 @@ describe RuboCop::Cop::Discourse::NoAddReferenceOrAliasesActiveRecordMigration,
32
32
  end
33
33
  RUBY
34
34
  expect(cop.offenses.count).to eq(2)
35
- expect(cop.offenses.first.message).to eq(described_class::MSG)
35
+ expect(cop.offenses.first.message).to match(described_class::MSG)
36
36
  end
37
37
 
38
38
  it "raises an offense if t.belongs_to, or any variable.belongs_to is used, with or without arguments" do
@@ -45,6 +45,6 @@ describe RuboCop::Cop::Discourse::NoAddReferenceOrAliasesActiveRecordMigration,
45
45
  end
46
46
  RUBY
47
47
  expect(cop.offenses.count).to eq(2)
48
- expect(cop.offenses.first.message).to eq(described_class::MSG)
48
+ expect(cop.offenses.first.message).to match(described_class::MSG)
49
49
  end
50
50
  end
@@ -1,13 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
3
+ require "spec_helper"
4
4
 
5
5
  describe RuboCop::Cop::Discourse::NoMixingMultisiteAndStandardSpecs, :config do
6
6
  subject(:cop) { described_class.new(config) }
7
7
 
8
- let(:config) do
9
- RuboCop::Config.new
10
- end
8
+ let(:config) { RuboCop::Config.new }
11
9
 
12
10
  it "raises an offense if there are multisite and standard top-level describes" do
13
11
  inspect_source(<<~RUBY)
@@ -18,7 +16,7 @@ describe RuboCop::Cop::Discourse::NoMixingMultisiteAndStandardSpecs, :config do
18
16
  end
19
17
  RUBY
20
18
 
21
- expect(cop.offenses.first.message).to eq(described_class::MSG)
19
+ expect(cop.offenses.first.message).to match(described_class::MSG)
22
20
  end
23
21
 
24
22
  it "raises an offense if there are multiple multisite and standard top-level describes" do
@@ -33,7 +31,7 @@ describe RuboCop::Cop::Discourse::NoMixingMultisiteAndStandardSpecs, :config do
33
31
  end
34
32
  RUBY
35
33
 
36
- expect(cop.offenses.first.message).to eq(described_class::MSG)
34
+ expect(cop.offenses.first.message).to match(described_class::MSG)
37
35
  end
38
36
 
39
37
  it "does not raise an offense if there are only multisite describes" do
@@ -1,20 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
3
+ require "spec_helper"
4
4
 
5
5
  describe RuboCop::Cop::Discourse::NoMockingJobs, :config do
6
6
  subject(:cop) { described_class.new(config) }
7
7
 
8
- let(:config) do
9
- RuboCop::Config.new
10
- end
8
+ let(:config) { RuboCop::Config.new }
11
9
 
12
10
  it "raises an offense if Jobs is mocked with :enqueue" do
13
11
  inspect_source(<<~RUBY)
14
12
  Jobs.expects(:enqueue)
15
13
  RUBY
16
14
 
17
- expect(cop.offenses.first.message).to eq(described_class::MSG)
15
+ expect(cop.offenses.first.message).to end_with(described_class::MSG)
18
16
  end
19
17
 
20
18
  it "raises an offense if Jobs is mocked with :enqueue_in" do
@@ -22,7 +20,7 @@ describe RuboCop::Cop::Discourse::NoMockingJobs, :config do
22
20
  Jobs.expects(:enqueue_in)
23
21
  RUBY
24
22
 
25
- expect(cop.offenses.first.message).to eq(described_class::MSG)
23
+ expect(cop.offenses.first.message).to end_with(described_class::MSG)
26
24
  end
27
25
 
28
26
  it "does not raise an offense if Jobs is not mocked with :enqueue or :enqueue_in" do
@@ -1,13 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
3
+ require "spec_helper"
4
4
 
5
- describe RuboCop::Cop::Discourse::NoResetColumnInformationInMigrations, :config do
5
+ describe RuboCop::Cop::Discourse::NoResetColumnInformationInMigrations,
6
+ :config do
6
7
  subject(:cop) { described_class.new(config) }
7
8
 
8
- let(:config) do
9
- RuboCop::Config.new
10
- end
9
+ let(:config) { RuboCop::Config.new }
10
+
11
+ before { config["Discourse/NoResetColumnInformationInMigrations"]["Enabled"] = true }
11
12
 
12
13
  it "raises an offense if reset_column_information is used" do
13
14
  inspect_source(<<~RUBY)
@@ -18,7 +19,7 @@ describe RuboCop::Cop::Discourse::NoResetColumnInformationInMigrations, :config
18
19
  end
19
20
  RUBY
20
21
 
21
- expect(cop.offenses.first.message).to eq(described_class::MSG)
22
+ expect(cop.offenses.first.message).to match(described_class::MSG)
22
23
  end
23
24
 
24
25
  it "raise an offense if reset_column_information is used without AR model" do
@@ -30,6 +31,6 @@ describe RuboCop::Cop::Discourse::NoResetColumnInformationInMigrations, :config
30
31
  end
31
32
  RUBY
32
33
 
33
- expect(cop.offenses.first.message).to eq(described_class::MSG)
34
+ expect(cop.offenses.first.message).to match(described_class::MSG)
34
35
  end
35
36
  end
@@ -1,13 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
3
+ require "spec_helper"
4
4
 
5
5
  describe RuboCop::Cop::Discourse::OnlyTopLevelMultisiteSpecs, :config do
6
6
  subject(:cop) { described_class.new(config) }
7
7
 
8
- let(:config) do
9
- RuboCop::Config.new
10
- end
8
+ let(:config) { RuboCop::Config.new }
11
9
 
12
10
  it "raises an offense if multisite config option is used in a sub-describe" do
13
11
  inspect_source(<<~RUBY)
@@ -17,7 +15,7 @@ describe RuboCop::Cop::Discourse::OnlyTopLevelMultisiteSpecs, :config do
17
15
  end
18
16
  RUBY
19
17
 
20
- expect(cop.offenses.first.message).to eq(described_class::MSG)
18
+ expect(cop.offenses.first.message).to match(described_class::MSG)
21
19
  end
22
20
 
23
21
  it "raises an offense if multisite config option is used in a sub-describe (RSpec const version)" do
@@ -28,7 +26,7 @@ describe RuboCop::Cop::Discourse::OnlyTopLevelMultisiteSpecs, :config do
28
26
  end
29
27
  RUBY
30
28
 
31
- expect(cop.offenses.first.message).to eq(described_class::MSG)
29
+ expect(cop.offenses.first.message).to match(described_class::MSG)
32
30
  end
33
31
 
34
32
  it "raises an offense if multisite config option is used in an example" do
@@ -42,7 +40,7 @@ describe RuboCop::Cop::Discourse::OnlyTopLevelMultisiteSpecs, :config do
42
40
  end
43
41
  RUBY
44
42
 
45
- expect(cop.offenses.first.message).to eq(described_class::MSG)
43
+ expect(cop.offenses.first.message).to match(described_class::MSG)
46
44
  end
47
45
 
48
46
  it "raises an offense if multisite config option is used in a context" do
@@ -53,7 +51,7 @@ describe RuboCop::Cop::Discourse::OnlyTopLevelMultisiteSpecs, :config do
53
51
  end
54
52
  RUBY
55
53
 
56
- expect(cop.offenses.first.message).to eq(described_class::MSG)
54
+ expect(cop.offenses.first.message).to match(described_class::MSG)
57
55
  end
58
56
 
59
57
  it "does not raise an offense if multisite config option is used on top-level describe" do
@@ -1,20 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spec_helper'
3
+ require "spec_helper"
4
4
 
5
5
  describe RuboCop::Cop::Discourse::TimeEqMatcher, :config do
6
6
  subject(:cop) { described_class.new(config) }
7
7
 
8
- let(:config) do
9
- RuboCop::Config.new
10
- end
8
+ let(:config) { RuboCop::Config.new }
11
9
 
12
10
  it "raises an offense if a timestamp is compared using `eq`" do
13
11
  inspect_source(<<~RUBY)
14
12
  expect(user.created_at).to eq(Time.zone.now)
15
13
  RUBY
16
14
 
17
- expect(cop.offenses.first.message).to eq(described_class::MSG)
15
+ expect(cop.offenses.first.message).to match(described_class::MSG)
18
16
  end
19
17
 
20
18
  it "passes if a timestamp is compared using `eq_time`" do
data/spec/spec_helper.rb CHANGED
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bundler/setup'
3
+ require "bundler/setup"
4
4
  Bundler.setup
5
5
 
6
6
  # Require supporting files exposed for testing.
7
- require 'rubocop'
8
- require 'rubocop/rspec/support'
7
+ require "rubocop"
8
+ require "rubocop/rspec/support"
9
9
 
10
- require 'rubocop-discourse' # and any other gems you need
10
+ require "rubocop-discourse" # and any other gems you need
11
11
 
12
12
  RSpec.configure do |config|
13
13
  config.include RuboCop::RSpec::ExpectOffense
data/stree-compat.yml CHANGED
@@ -6,16 +6,16 @@ inherit_from:
6
6
  - ./rubocop-rspec.yml
7
7
 
8
8
  AllCops:
9
- TargetRubyVersion: 2.6
9
+ TargetRubyVersion: 3.2
10
10
  DisabledByDefault: true
11
11
  Exclude:
12
- - "db/schema.rb"
13
- - "bundle/**/*"
14
- - "vendor/**/*"
15
- - "**/node_modules/**/*"
16
- - "public/**/*"
17
- - "plugins/**/gems/**/*"
18
- - "plugins/**/vendor/**/*"
12
+ - 'db/schema.rb'
13
+ - 'bundle/**/*'
14
+ - 'vendor/**/*'
15
+ - '**/node_modules/**/*'
16
+ - 'public/**/*'
17
+ - 'plugins/**/gems/**/*'
18
+ - 'plugins/**/vendor/**/*'
19
19
 
20
20
  Discourse:
21
21
  Enabled: true
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-discourse
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Discourse Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-16 00:00:00.000000000 Z
11
+ date: 2023-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop