rubocop-discourse 3.1.0 → 3.9.3

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.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +2 -2
  3. data/.rspec +1 -0
  4. data/.rubocop.yml +7 -0
  5. data/config/default.yml +51 -24
  6. data/lib/rubocop/cop/discourse/fabricator_shorthand.rb +62 -0
  7. data/lib/rubocop/cop/discourse/no_add_reference_active_record_migrations.rb +9 -7
  8. data/lib/rubocop/cop/discourse/no_chdir.rb +1 -1
  9. data/lib/rubocop/cop/discourse/no_direct_multisite_manipulation.rb +3 -2
  10. data/lib/rubocop/cop/discourse/no_json_parse_response.rb +2 -4
  11. data/lib/rubocop/cop/discourse/no_mixing_multisite_and_standard_specs.rb +4 -7
  12. data/lib/rubocop/cop/discourse/no_mocking_jobs.rb +3 -2
  13. data/lib/rubocop/cop/discourse/no_nokogiri_html_fragment.rb +1 -1
  14. data/lib/rubocop/cop/discourse/no_reset_column_information_in_migrations.rb +6 -5
  15. data/lib/rubocop/cop/discourse/no_time_new_without_args.rb +2 -4
  16. data/lib/rubocop/cop/discourse/no_uri_escape_encode.rb +11 -8
  17. data/lib/rubocop/cop/discourse/only_top_level_multisite_specs.rb +2 -6
  18. data/lib/rubocop/cop/discourse/plugins/call_requires_plugin.rb +71 -0
  19. data/lib/rubocop/cop/discourse/plugins/namespace_constants.rb +35 -0
  20. data/lib/rubocop/cop/discourse/plugins/namespace_methods.rb +37 -0
  21. data/lib/rubocop/cop/discourse/plugins/no_monkey_patching.rb +92 -0
  22. data/lib/rubocop/cop/discourse/plugins/use_plugin_instance_on.rb +42 -0
  23. data/lib/rubocop/cop/discourse/plugins/use_require_relative.rb +32 -0
  24. data/lib/rubocop/cop/discourse/services/empty_lines_around_blocks.rb +114 -0
  25. data/lib/rubocop/cop/discourse/services/group_keywords.rb +92 -0
  26. data/lib/rubocop/cop/discourse/time_eq_matcher.rb +2 -4
  27. data/lib/rubocop/cop/discourse_cops.rb +1 -1
  28. data/lib/rubocop/discourse.rb +3 -3
  29. data/lib/rubocop-discourse.rb +4 -0
  30. data/rubocop-capybara.yml +5 -0
  31. data/rubocop-core.yml +81 -4
  32. data/rubocop-discourse.gemspec +15 -10
  33. data/rubocop-factory_bot.yml +11 -0
  34. data/rubocop-layout.yml +4 -0
  35. data/rubocop-rails.yml +14 -0
  36. data/rubocop-rspec.yml +29 -23
  37. data/spec/fixtures/controllers/bad_controller.rb +5 -0
  38. data/spec/fixtures/controllers/base_controller.rb +11 -0
  39. data/spec/fixtures/controllers/good_controller.rb +4 -0
  40. data/spec/fixtures/controllers/inherit_from_outside_controller.rb +5 -0
  41. data/spec/fixtures/controllers/namespaced_parent_controller.rb +5 -0
  42. data/spec/fixtures/controllers/no_requires_plugin_controller.rb +5 -0
  43. data/spec/fixtures/controllers/requires_plugin_controller.rb +6 -0
  44. data/spec/lib/rubocop/cop/discourse/services/empty_lines_around_blocks_spec.rb +309 -0
  45. data/spec/lib/rubocop/cop/discourse/services/group_keywords_spec.rb +137 -0
  46. data/spec/lib/rubocop/cop/fabricator_shorthand_spec.rb +47 -0
  47. data/spec/lib/rubocop/cop/no_add_reference_active_record_migrations_spec.rb +13 -16
  48. data/spec/lib/rubocop/cop/no_mixing_multisite_and_standard_specs_spec.rb +10 -14
  49. data/spec/lib/rubocop/cop/no_mocking_jobs_enqueue_spec.rb +8 -12
  50. data/spec/lib/rubocop/cop/no_reset_column_information_migrations_spec.rb +8 -10
  51. data/spec/lib/rubocop/cop/only_top_level_multisite_specs_spec.rb +14 -18
  52. data/spec/lib/rubocop/cop/plugins/call_requires_plugin_spec.rb +79 -0
  53. data/spec/lib/rubocop/cop/plugins/namespace_constants_spec.rb +40 -0
  54. data/spec/lib/rubocop/cop/plugins/namespace_methods_spec.rb +84 -0
  55. data/spec/lib/rubocop/cop/plugins/no_monkey_patching_spec.rb +91 -0
  56. data/spec/lib/rubocop/cop/plugins/use_plugin_instance_on_spec.rb +37 -0
  57. data/spec/lib/rubocop/cop/plugins/use_require_relative_spec.rb +24 -0
  58. data/spec/lib/rubocop/cop/time_eq_matcher_spec.rb +6 -10
  59. data/spec/spec_helper.rb +4 -4
  60. data/stree-compat.yml +10 -1
  61. metadata +110 -16
@@ -1,16 +1,14 @@
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
- let(:config) do
9
- RuboCop::Config.new
10
- end
6
+ let(:config) { RuboCop::Config.new }
7
+
8
+ before { config["Discourse/NoResetColumnInformationInMigrations"]["Enabled"] = true }
11
9
 
12
10
  it "raises an offense if reset_column_information is used" do
13
- inspect_source(<<~RUBY)
11
+ offenses = inspect_source(<<~RUBY)
14
12
  class SomeMigration < ActiveRecord::Migration[6.0]
15
13
  def up
16
14
  Post.reset_column_information
@@ -18,11 +16,11 @@ describe RuboCop::Cop::Discourse::NoResetColumnInformationInMigrations, :config
18
16
  end
19
17
  RUBY
20
18
 
21
- expect(cop.offenses.first.message).to eq(described_class::MSG)
19
+ expect(offenses.first.message).to match(described_class::MSG)
22
20
  end
23
21
 
24
22
  it "raise an offense if reset_column_information is used without AR model" do
25
- inspect_source(<<~RUBY)
23
+ offenses = inspect_source(<<~RUBY)
26
24
  class SomeMigration < ActiveRecord::Migration[6.0]
27
25
  def up
28
26
  "post".classify.constantize.reset_column_information
@@ -30,6 +28,6 @@ describe RuboCop::Cop::Discourse::NoResetColumnInformationInMigrations, :config
30
28
  end
31
29
  RUBY
32
30
 
33
- expect(cop.offenses.first.message).to eq(described_class::MSG)
31
+ expect(offenses.first.message).to match(described_class::MSG)
34
32
  end
35
33
  end
@@ -1,38 +1,34 @@
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
- let(:config) do
9
- RuboCop::Config.new
10
- end
6
+ let(:config) { RuboCop::Config.new }
11
7
 
12
8
  it "raises an offense if multisite config option is used in a sub-describe" do
13
- inspect_source(<<~RUBY)
9
+ offenses = inspect_source(<<~RUBY)
14
10
  describe "test" do
15
11
  describe "sub-test", type: :multisite do
16
12
  end
17
13
  end
18
14
  RUBY
19
15
 
20
- expect(cop.offenses.first.message).to eq(described_class::MSG)
16
+ expect(offenses.first.message).to match(described_class::MSG)
21
17
  end
22
18
 
23
19
  it "raises an offense if multisite config option is used in a sub-describe (RSpec const version)" do
24
- inspect_source(<<~RUBY)
20
+ offenses = inspect_source(<<~RUBY)
25
21
  RSpec.describe "test" do
26
22
  RSpec.describe "sub-test", type: :multisite do
27
23
  end
28
24
  end
29
25
  RUBY
30
26
 
31
- expect(cop.offenses.first.message).to eq(described_class::MSG)
27
+ expect(offenses.first.message).to match(described_class::MSG)
32
28
  end
33
29
 
34
30
  it "raises an offense if multisite config option is used in an example" do
35
- inspect_source(<<~RUBY)
31
+ offenses = inspect_source(<<~RUBY)
36
32
  describe "test" do
37
33
  it "acts as an example" do
38
34
  end
@@ -42,33 +38,33 @@ describe RuboCop::Cop::Discourse::OnlyTopLevelMultisiteSpecs, :config do
42
38
  end
43
39
  RUBY
44
40
 
45
- expect(cop.offenses.first.message).to eq(described_class::MSG)
41
+ expect(offenses.first.message).to match(described_class::MSG)
46
42
  end
47
43
 
48
44
  it "raises an offense if multisite config option is used in a context" do
49
- inspect_source(<<~RUBY)
45
+ offenses = inspect_source(<<~RUBY)
50
46
  describe "test" do
51
47
  context "special circumstances", type: :multisite do
52
48
  end
53
49
  end
54
50
  RUBY
55
51
 
56
- expect(cop.offenses.first.message).to eq(described_class::MSG)
52
+ expect(offenses.first.message).to match(described_class::MSG)
57
53
  end
58
54
 
59
55
  it "does not raise an offense if multisite config option is used on top-level describe" do
60
- inspect_source(<<~RUBY)
56
+ offenses = inspect_source(<<~RUBY)
61
57
  describe "test", type: :multisite do
62
58
  describe "sub-test" do
63
59
  end
64
60
  end
65
61
  RUBY
66
62
 
67
- expect(cop.offenses).to eq([])
63
+ expect(offenses).to eq([])
68
64
  end
69
65
 
70
66
  it "does not raise an offense if multisite config option is used on top-level describe (RSpec const version)" do
71
- inspect_source(<<~RUBY)
67
+ offenses = inspect_source(<<~RUBY)
72
68
  require "rails_helper"
73
69
 
74
70
  RSpec.describe "test", type: :multisite do
@@ -77,6 +73,6 @@ describe RuboCop::Cop::Discourse::OnlyTopLevelMultisiteSpecs, :config do
77
73
  end
78
74
  RUBY
79
75
 
80
- expect(cop.offenses).to eq([])
76
+ expect(offenses).to eq([])
81
77
  end
82
78
  end
@@ -0,0 +1,79 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe RuboCop::Cop::Discourse::Plugins::CallRequiresPlugin, :config do
4
+ subject(:cop) { described_class.new(config) }
5
+
6
+ let(:config) { RuboCop::Config.new }
7
+
8
+ context "when `requires_plugin` is missing" do
9
+ it "registers an offense" do
10
+ expect_offense(<<~RUBY)
11
+ class MyController < ApplicationController
12
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Discourse/Plugins/CallRequiresPlugin: Use `requires_plugin` in controllers to prevent routes from being accessible when plugin is disabled.
13
+ requires_login
14
+ end
15
+ RUBY
16
+ end
17
+ end
18
+
19
+ context "when `requires_plugin` is not missing" do
20
+ it "does not register an offense" do
21
+ expect_no_offenses(<<~RUBY)
22
+ class MyController
23
+ requires_plugin MyPlugin::PLUGIN_NAME
24
+ requires_login
25
+ end
26
+ RUBY
27
+ end
28
+ end
29
+
30
+ context "when inheriting" do
31
+ let(:controllers_path) do
32
+ Pathname.new("#{__dir__}/../../../../fixtures/controllers").cleanpath
33
+ end
34
+
35
+ before do
36
+ # As we’re providing real files, we need to get rid of the default config
37
+ # restricting the cop to `app/controllers/*`
38
+ configuration.for_cop(cop).delete("Include")
39
+ end
40
+
41
+ context "when `requires_plugin` is called in a parent controller" do
42
+ let(:good_controller) { controllers_path.join("good_controller.rb") }
43
+
44
+ it "does not register an offense" do
45
+ expect_no_offenses(good_controller.read, good_controller.to_s)
46
+ end
47
+ end
48
+
49
+ context "when `requires_plugin` is not called in a parent controller" do
50
+ let(:bad_controller) { controllers_path.join("bad_controller.rb") }
51
+
52
+ it "registers an offense" do
53
+ expect_offense(bad_controller.read, bad_controller.to_s)
54
+ end
55
+ end
56
+
57
+ context "when parent controller can’t be located" do
58
+ context "when parent controller is namespaced" do
59
+ let(:controller) do
60
+ controllers_path.join("namespaced_parent_controller.rb")
61
+ end
62
+
63
+ it "registers an offense" do
64
+ expect_offense(controller.read, controller.to_s)
65
+ end
66
+ end
67
+
68
+ context "when parent controller is not namespaced" do
69
+ let(:controller) do
70
+ controllers_path.join("inherit_from_outside_controller.rb")
71
+ end
72
+
73
+ it "registers an offense" do
74
+ expect_offense(controller.read, controller.to_s)
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe RuboCop::Cop::Discourse::Plugins::NamespaceConstants, :config do
4
+ subject(:cop) { described_class.new(config) }
5
+
6
+ let(:config) { RuboCop::Config.new }
7
+
8
+ context "when defining a constant outside any namespace" do
9
+ it "registers an offense" do
10
+ expect_offense(<<~RUBY)
11
+ MY_CONSTANT = "my_value"
12
+ ^^^^^^^^^^^^^^^^^^^^^^^^ Discourse/Plugins/NamespaceConstants: Don’t define constants outside a class or a module.
13
+
14
+ class MyClass
15
+ MY_CONSTANT = "my_value"
16
+ end
17
+ RUBY
18
+ end
19
+ end
20
+
21
+ context "when defining a constant inside a class" do
22
+ it "does not register an offense" do
23
+ expect_no_offenses(<<~RUBY)
24
+ class MyClass
25
+ MY_CONSTANT = "my_value"
26
+ end
27
+ RUBY
28
+ end
29
+ end
30
+
31
+ context "when defining a constant inside a module" do
32
+ it "does not register an offense" do
33
+ expect_no_offenses(<<~RUBY)
34
+ module MyModule
35
+ MY_CONSTANT = "my_value"
36
+ end
37
+ RUBY
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe RuboCop::Cop::Discourse::Plugins::NamespaceMethods, :config do
4
+ subject(:cop) { described_class.new(config) }
5
+
6
+ let(:config) { RuboCop::Config.new }
7
+
8
+ context "when defining a method outside any namespace" do
9
+ it "registers an offense" do
10
+ expect_offense(<<~RUBY)
11
+ def my_method
12
+ ^^^^^^^^^^^^^ Discourse/Plugins/NamespaceMethods: Don’t define methods outside a class or a module.
13
+ "my_value"
14
+ end
15
+
16
+ class MyClass
17
+ def my_method
18
+ "my_method"
19
+ end
20
+ end
21
+ RUBY
22
+ end
23
+ end
24
+
25
+ context "when defining a method inside a class" do
26
+ context "when defining an instance method" do
27
+ it "does not register an offense" do
28
+ expect_no_offenses(<<~RUBY)
29
+ class MyClass
30
+ def my_method
31
+ "my_value"
32
+ end
33
+ end
34
+ RUBY
35
+ end
36
+ end
37
+
38
+ context "when defining a class method" do
39
+ it "does not register an offense" do
40
+ expect_no_offenses(<<~RUBY)
41
+ class MyClass
42
+ class << self
43
+ def my_method
44
+ "my_value"
45
+ end
46
+
47
+ def another_method
48
+ "plop"
49
+ end
50
+ end
51
+ end
52
+ RUBY
53
+ end
54
+ end
55
+ end
56
+
57
+ context "when defining a method inside a module" do
58
+ context "when defining an instance method" do
59
+ it "does not register an offense" do
60
+ expect_no_offenses(<<~RUBY)
61
+ module MyModule
62
+ def my_method
63
+ "my_value"
64
+ end
65
+ end
66
+ RUBY
67
+ end
68
+ end
69
+
70
+ context "when defining a class method" do
71
+ it "does not register an offense" do
72
+ expect_no_offenses(<<~RUBY)
73
+ module MyModule
74
+ class << self
75
+ def my_method
76
+ "my_value"
77
+ end
78
+ end
79
+ end
80
+ RUBY
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,91 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe RuboCop::Cop::Discourse::Plugins::NoMonkeyPatching, :config do
4
+ subject(:cop) { described_class.new(config) }
5
+
6
+ let(:config) { RuboCop::Config.new }
7
+
8
+ context "when outside `plugin.rb`" do
9
+ it "does not register an offense" do
10
+ expect_no_offenses(<<~RUBY, "my_class.rb")
11
+ class ::MyClass
12
+ def my_method
13
+ "my_value"
14
+ end
15
+ end
16
+
17
+ class AnotherClass
18
+ def my_method
19
+ "my_value"
20
+ end
21
+ end
22
+ RUBY
23
+ end
24
+ end
25
+
26
+ context "when inside `plugin.rb`" do
27
+ context "when opening an existing class" do
28
+ it "registers an offense" do
29
+ expect_offense(<<~RUBY, "plugin.rb")
30
+ after_initialize do
31
+ module MyPlugin
32
+ class Engine < Rails::Engine
33
+ isolate_namespace MyPlugin
34
+ end
35
+ end
36
+
37
+ class ::Topic
38
+ ^^^^^^^^^^^^^ Discourse/Plugins/NoMonkeyPatching: Don’t reopen existing classes. [...]
39
+ def self.new_method
40
+ :new_value
41
+ end
42
+
43
+ def my_new_method
44
+ "my_new_value"
45
+ end
46
+ end
47
+ end
48
+ RUBY
49
+ end
50
+ end
51
+
52
+ context "when opening an existing serializer" do
53
+ it "registers an offense" do
54
+ expect_offense(<<~RUBY, "plugin.rb")
55
+ class ::TopicSerializer
56
+ ^^^^^^^^^^^^^^^^^^^^^^^ Discourse/Plugins/NoMonkeyPatching: Don’t reopen serializers. [...]
57
+ def new_attribute
58
+ "my_attribute"
59
+ end
60
+ end
61
+ RUBY
62
+ end
63
+ end
64
+
65
+ context "when calling `.class_eval` on a class" do
66
+ it "registers an offense" do
67
+ expect_offense(<<~RUBY)
68
+ User.class_eval do
69
+ ^^^^^^^^^^^^^^^ Discourse/Plugins/NoMonkeyPatching: Don’t call `class_eval`. [...]
70
+ def a_new_method
71
+ :new_value
72
+ end
73
+ end
74
+ RUBY
75
+ end
76
+ end
77
+
78
+ context "when calling `.class_eval` on a serializer" do
79
+ it "registers an offense" do
80
+ expect_offense(<<~RUBY)
81
+ UserSerializer.class_eval do
82
+ ^^^^^^^^^^^^^^^^^^^^^^^^^ Discourse/Plugins/NoMonkeyPatching: Don’t call `class_eval` on a serializer. [...]
83
+ def a_new_method
84
+ :new_value
85
+ end
86
+ end
87
+ RUBY
88
+ end
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe RuboCop::Cop::Discourse::Plugins::UsePluginInstanceOn, :config do
4
+ subject(:cop) { described_class.new(config) }
5
+
6
+ let(:config) { RuboCop::Config.new }
7
+
8
+ context "when outside `plugin.rb`" do
9
+ context "when `DiscourseEvent.on` is called" do
10
+ it "registers an offense" do
11
+ expect_offense(<<~RUBY, "another_file.rb")
12
+ DiscourseEvent.on(:topic_status_updated) { do_something }
13
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Discourse/Plugins/UsePluginInstanceOn: Don’t call `DiscourseEvent.on` outside `plugin.rb`.
14
+ RUBY
15
+ end
16
+ end
17
+ end
18
+
19
+ context "when inside `plugin.rb`" do
20
+ context "when `DiscourseEvent.on` is called" do
21
+ it "registers an offense" do
22
+ expect_offense(<<~RUBY, "plugin.rb")
23
+ DiscourseEvent.on(:topic_status_updated) { do_something }
24
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Discourse/Plugins/UsePluginInstanceOn: Use `on` instead of `DiscourseEvent.on` [...]
25
+ RUBY
26
+ end
27
+ end
28
+
29
+ context "when `on` is called" do
30
+ it "does not register an offense" do
31
+ expect_no_offenses(<<~RUBY, "plugin.rb")
32
+ on(:topic_status_updated) { do_something }
33
+ RUBY
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe RuboCop::Cop::Discourse::Plugins::UseRequireRelative, :config do
4
+ subject(:cop) { described_class.new(config) }
5
+
6
+ let(:config) { RuboCop::Config.new }
7
+
8
+ context "when using `load`" do
9
+ it "registers an offense" do
10
+ expect_offense(<<~RUBY)
11
+ load File.expand_path("../app/jobs/onceoff/voting_ensure_consistency.rb", __FILE__)
12
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Discourse/Plugins/UseRequireRelative: Use `require_relative` instead of `load`.
13
+ RUBY
14
+ end
15
+ end
16
+
17
+ context "when using `require_relative`" do
18
+ it "does not register an offense" do
19
+ expect_no_offenses(<<~RUBY)
20
+ require_relative "app/controllers/encrypt_controller.rb"
21
+ RUBY
22
+ end
23
+ end
24
+ end
@@ -1,27 +1,23 @@
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
- let(:config) do
9
- RuboCop::Config.new
10
- end
6
+ let(:config) { RuboCop::Config.new }
11
7
 
12
8
  it "raises an offense if a timestamp is compared using `eq`" do
13
- inspect_source(<<~RUBY)
9
+ offenses = inspect_source(<<~RUBY)
14
10
  expect(user.created_at).to eq(Time.zone.now)
15
11
  RUBY
16
12
 
17
- expect(cop.offenses.first.message).to eq(described_class::MSG)
13
+ expect(offenses.first.message).to match(described_class::MSG)
18
14
  end
19
15
 
20
16
  it "passes if a timestamp is compared using `eq_time`" do
21
- inspect_source(<<~RUBY)
17
+ offenses = inspect_source(<<~RUBY)
22
18
  expect(user.created_at).to eq_time(Time.zone.now)
23
19
  RUBY
24
20
 
25
- expect(cop.offenses).to be_empty
21
+ expect(offenses).to be_empty
26
22
  end
27
23
  end
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
@@ -3,10 +3,14 @@ require:
3
3
 
4
4
  inherit_from:
5
5
  - ./rubocop-core.yml
6
+ - ./rubocop-capybara.yml
7
+ - ./rubocop-factory_bot.yml
6
8
  - ./rubocop-rspec.yml
9
+ - ./rubocop-rails.yml
7
10
 
8
11
  AllCops:
9
- TargetRubyVersion: 2.6
12
+ TargetRubyVersion: 3.2
13
+ SuggestExtensions: false
10
14
  DisabledByDefault: true
11
15
  Exclude:
12
16
  - "db/schema.rb"
@@ -19,3 +23,8 @@ AllCops:
19
23
 
20
24
  Discourse:
21
25
  Enabled: true
26
+
27
+ Discourse/FabricatorShorthand:
28
+ Enabled: true
29
+ Include:
30
+ - "**/spec/**/*"