diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml index 8ef3d81..02ca1d2 100644 --- a/.github/workflows/rspec.yml +++ b/.github/workflows/rspec.yml @@ -6,24 +6,14 @@ jobs: rspec: runs-on: ubuntu-latest environment: test - container: - image: ruby:3.0.6 steps: - uses: actions/checkout@v1 - - name: Gem cache - id: cache-bundle - uses: actions/cache@v1 + - uses: ruby/setup-ruby@v1 with: - path: vendor/bundle - key: bundle-${{ hashFiles('**/Gemfile.lock') }} - - - name: Bundle install - env: - RAILS_ENV: test - run: | - bundle install + ruby-version: '3.1' # Not needed with a .ruby-version, .tool-versions or mise.toml + bundler-cache: true # runs 'bundle install' and caches installed gems automatically - name: Run tests env: @@ -34,24 +24,14 @@ jobs: rubocop: runs-on: ubuntu-latest environment: test - container: - image: ruby:3.0.6 steps: - uses: actions/checkout@v1 - - name: Gem cache - id: cache-bundle - uses: actions/cache@v1 + - uses: ruby/setup-ruby@v1 with: - path: vendor/bundle - key: bundle-${{ hashFiles('**/Gemfile.lock') }} - - - name: Bundle install - env: - RAILS_ENV: test - run: | - bundle install + ruby-version: '3.1' # Not needed with a .ruby-version, .tool-versions or mise.toml + bundler-cache: true # runs 'bundle install' and caches installed gems automatically - name: Run Rubocop run: bundle exec rubocop diff --git a/Gemfile.lock b/Gemfile.lock index 0a97f47..f649744 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,17 +6,20 @@ PATH GEM remote: https://rubygems.org/ specs: - ast (2.4.2) + ast (2.4.3) diff-lcs (1.5.0) - parallel (1.24.0) - parser (3.3.0.5) + json (2.15.2) + language_server-protocol (3.17.0.5) + lint_roller (1.1.0) + parallel (1.27.0) + parser (3.3.10.0) ast (~> 2.4.1) racc - racc (1.7.3) + prism (1.6.0) + racc (1.8.1) rainbow (3.1.1) rake (12.3.3) - regexp_parser (2.9.0) - rexml (3.3.9) + regexp_parser (2.11.3) rspec (3.12.0) rspec-core (~> 3.12.0) rspec-expectations (~> 3.12.0) @@ -30,19 +33,24 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-support (3.12.1) - rubocop (1.31.0) + rubocop (1.81.0) + json (~> 2.3) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) parallel (~> 1.10) - parser (>= 3.1.0.0) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.18.0, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.47.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.30.0) - parser (>= 3.2.1.0) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.47.1) + parser (>= 3.3.7.2) + prism (~> 1.4) ruby-progressbar (1.13.0) - unicode-display_width (2.5.0) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) + unicode-emoji (4.1.0) PLATFORMS ruby @@ -51,7 +59,7 @@ DEPENDENCIES mavenlint! rake (= 12.3.3) rspec (= 3.12) - rubocop (= 1.31) + rubocop (= 1.81) BUNDLED WITH - 2.2.33 + 2.6.9 diff --git a/Rakefile b/Rakefile index c881505..f745157 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,5 @@ # frozen_string_literal: true -begin - require 'rspec/core/rake_task' - RSpec::Core::RakeTask.new(:spec) - task default: :spec -end +require 'rspec/core/rake_task' +RSpec::Core::RakeTask.new(:spec) +task default: :spec diff --git a/lib/rubocop/cop/mavenlint/belongs_to_dependent_option.rb b/lib/rubocop/cop/mavenlint/belongs_to_dependent_option.rb index 025e844..ba030e9 100644 --- a/lib/rubocop/cop/mavenlint/belongs_to_dependent_option.rb +++ b/lib/rubocop/cop/mavenlint/belongs_to_dependent_option.rb @@ -14,7 +14,7 @@ module Mavenlint # end # # It is advised to put the dependent option on the other side of the association - class BelongsToDependentOption < RuboCop::Cop::Cop + class BelongsToDependentOption < RuboCop::Cop::Base MSG = 'Do not use the dependent option with belongs_to associations. The option should go on the other side of the association. See https://guides.rubyonrails.org/association_basics.html#options-for-belongs-to-dependent' def_node_matcher :bad_belongs_to?, <<~PATTERN diff --git a/lib/rubocop/cop/mavenlint/bigint_for_migration_keys.rb b/lib/rubocop/cop/mavenlint/bigint_for_migration_keys.rb index 6a6f896..98e21fc 100644 --- a/lib/rubocop/cop/mavenlint/bigint_for_migration_keys.rb +++ b/lib/rubocop/cop/mavenlint/bigint_for_migration_keys.rb @@ -6,7 +6,7 @@ module RuboCop module Cop module Mavenlint # Enforces that foreign key columns are bigint type - class BigIntForMigrationKeys < RuboCop::Cop::Cop + class BigIntForMigrationKeys < RuboCop::Cop::Base FK_VIOLATION_MSG = 'Foreign keys must be of type BIGINT' PK_VIOLATION_MSG = 'Primary keys must be of type BIGINT' diff --git a/lib/rubocop/cop/mavenlint/direct_factory_bot_invocation.rb b/lib/rubocop/cop/mavenlint/direct_factory_bot_invocation.rb index b25902f..c9c778e 100644 --- a/lib/rubocop/cop/mavenlint/direct_factory_bot_invocation.rb +++ b/lib/rubocop/cop/mavenlint/direct_factory_bot_invocation.rb @@ -7,7 +7,7 @@ module Cop module Mavenlint # Prevents invocation of factory bot directly and instead # suggests user use the `create.a(:model)` pattern - class DirectFactoryBotInvocation < RuboCop::Cop::Cop + class DirectFactoryBotInvocation < RuboCop::Cop::Base MSG = 'Direct calls to FactoryBot should be replaced with Mavenlink::ModelFactories calls' FACTORY_BOT_METHODS = %i[create build].freeze diff --git a/lib/rubocop/cop/mavenlint/no_dependent_destroy_account.rb b/lib/rubocop/cop/mavenlint/no_dependent_destroy_account.rb index cff81e5..d512e14 100644 --- a/lib/rubocop/cop/mavenlint/no_dependent_destroy_account.rb +++ b/lib/rubocop/cop/mavenlint/no_dependent_destroy_account.rb @@ -15,7 +15,7 @@ module Mavenlint # # Allowing deletion of account through active record associations can cause cascading data deletions. Account # is a root object and shouldn't be deleted via active record associations - class NoDependentDestroyAccount < RuboCop::Cop::Cop + class NoDependentDestroyAccount < RuboCop::Cop::Base MSG = 'Do not add an association to account with dependent destroy. The destroy should go on the other side of the association. See https://guides.rubyonrails.org/association_basics.html#options-for-belongs-to-dependent' ASSOCIATIONS = %i[belongs_to has_many has_one has_and_belongs_to_many].freeze diff --git a/lib/rubocop/cop/mavenlint/require_slow_helpers.rb b/lib/rubocop/cop/mavenlint/require_slow_helpers.rb index c0cc953..096a064 100644 --- a/lib/rubocop/cop/mavenlint/require_slow_helpers.rb +++ b/lib/rubocop/cop/mavenlint/require_slow_helpers.rb @@ -6,7 +6,7 @@ module RuboCop module Cop module Mavenlint # Prevents use of slow capybara matchers - class RequireSlowHelpers < RuboCop::Cop::Cop + class RequireSlowHelpers < RuboCop::Cop::Base MSG = 'Specs in the unit directory should not require rails_helper or spec_helper' SLOW_HELPERS = %w[spec_helper rails_helper].freeze diff --git a/lib/rubocop/cop/mavenlint/unsafe_mass_assignment.rb b/lib/rubocop/cop/mavenlint/unsafe_mass_assignment.rb index 837c51a..49b018d 100644 --- a/lib/rubocop/cop/mavenlint/unsafe_mass_assignment.rb +++ b/lib/rubocop/cop/mavenlint/unsafe_mass_assignment.rb @@ -16,7 +16,7 @@ module Mavenlint # Allowing mass assignment of a foreign key column is dangerous for models that are created # or updated through a publicly accessible endpoint, because the associated model isn't # necessarily loaded and ran through security checks. - class UnsafeMassAssignment < RuboCop::Cop::Cop + class UnsafeMassAssignment < RuboCop::Cop::Base MSG = 'Do not allow mass-assignment of foreign key columns. See https://github.com/mavenlink/welcome/wiki/Lint-Errors#unsafemassassignment' def on_send(node) diff --git a/lib/rubocop/cop/mavenlint/use_api_controller.rb b/lib/rubocop/cop/mavenlint/use_api_controller.rb index 57502a7..ba4a217 100644 --- a/lib/rubocop/cop/mavenlint/use_api_controller.rb +++ b/lib/rubocop/cop/mavenlint/use_api_controller.rb @@ -17,7 +17,7 @@ module Mavenlint # class SomeApiController < ApiController # end # - class UseApiController < RuboCop::Cop::Cop + class UseApiController < RuboCop::Cop::Base MSG = 'Api Controllers should subclass `ApiController`.' SUPERCLASS = 'ApiController' BASE_PATTERN = '(const nil? :ApplicationController)' diff --git a/lib/rubocop/cop/mavenlint/use_application_controller.rb b/lib/rubocop/cop/mavenlint/use_application_controller.rb index 03919f8..1aa68c6 100644 --- a/lib/rubocop/cop/mavenlint/use_application_controller.rb +++ b/lib/rubocop/cop/mavenlint/use_application_controller.rb @@ -17,7 +17,7 @@ module Mavenlint # class SomeController < ApplicationController # end # - class UseApplicationController < RuboCop::Cop::Cop + class UseApplicationController < RuboCop::Cop::Base MSG = 'Controllers should subclass `ApplicationController`.' SUPERCLASS = 'ApplicationController' BASE_PATTERN = '(const (const nil? :ActionController) :Base)' diff --git a/lib/rubocop/cop/mavenlint/use_application_record.rb b/lib/rubocop/cop/mavenlint/use_application_record.rb index 521624a..6b544e4 100644 --- a/lib/rubocop/cop/mavenlint/use_application_record.rb +++ b/lib/rubocop/cop/mavenlint/use_application_record.rb @@ -22,7 +22,7 @@ module Mavenlint # remove this custom cop and enable the built-in one. # @see https://github.com/bbatsov/rubocop/blob/10a7041d23bcd579821b378dd351aeead7c3f082/lib/rubocop/cop/rails/application_record.rb # - class UseApplicationRecord < RuboCop::Cop::Cop + class UseApplicationRecord < RuboCop::Cop::Base MSG = 'Models should subclass `ApplicationRecord`.' SUPERCLASS = 'ApplicationRecord' BASE_PATTERN = '(const (const nil? :ActiveRecord) :Base)' diff --git a/lib/rubocop/cop/mavenlint/use_fast_capybara_matchers.rb b/lib/rubocop/cop/mavenlint/use_fast_capybara_matchers.rb index 83e0957..fb5eefe 100644 --- a/lib/rubocop/cop/mavenlint/use_fast_capybara_matchers.rb +++ b/lib/rubocop/cop/mavenlint/use_fast_capybara_matchers.rb @@ -20,7 +20,7 @@ module Mavenlint # expect(page).to have_no_text('Hi') # # Which will pass as soon as the text is not detected without any timeout. - class UseFastCapybaraMatchers < RuboCop::Cop::Cop + class UseFastCapybaraMatchers < RuboCop::Cop::Base MSG = 'Use a `to have_no_*` selector. See https://github.com/mavenlink/welcome/wiki/Lint-Errors#usefastcapybaramatchers' CAPYBARA_MATCHERS = %i[have_button have_checked_field have_content have_css have_field have_link have_select have_selector have_table have_text have_unchecked_field have_xpath].freeze diff --git a/mavenlint.gemspec b/mavenlint.gemspec index 85375d2..dc320b6 100644 --- a/mavenlint.gemspec +++ b/mavenlint.gemspec @@ -12,7 +12,7 @@ Gem::Specification.new do |s| s.add_development_dependency 'rake', '12.3.3' s.add_development_dependency 'rspec', '3.12' - s.add_development_dependency 'rubocop', '1.31' + s.add_development_dependency 'rubocop', '1.81' s.required_ruby_version = '~> 3.0' end diff --git a/spec/rubocop/cop/mavenlint/belongs_to_dependent_option_spec.rb b/spec/rubocop/cop/mavenlint/belongs_to_dependent_option_spec.rb index a67b1b7..56cad71 100644 --- a/spec/rubocop/cop/mavenlint/belongs_to_dependent_option_spec.rb +++ b/spec/rubocop/cop/mavenlint/belongs_to_dependent_option_spec.rb @@ -10,7 +10,7 @@ it 'registers an offense when belongs_to is invoked with the dependent option' do expect_offense(<<~RUBY) belongs_to :workspace, inverse_of: :foo, dependent: :destroy_all, autosave: true - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not use the dependent option with belongs_to associations. The option should go on the other side of the association. See https://guides.rubyonrails.org/association_basics.html#options-for-belongs-to-dependent + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Mavenlint/BelongsToDependentOption: Do not use the dependent option with belongs_to associations. The option should go on the other side of the association. See https://guides.rubyonrails.org/association_basics.html#options-for-belongs-to-dependent RUBY end diff --git a/spec/rubocop/cop/mavenlint/bigint_for_migration_keys_spec.rb b/spec/rubocop/cop/mavenlint/bigint_for_migration_keys_spec.rb index 314bbe7..72ad082 100644 --- a/spec/rubocop/cop/mavenlint/bigint_for_migration_keys_spec.rb +++ b/spec/rubocop/cop/mavenlint/bigint_for_migration_keys_spec.rb @@ -13,7 +13,7 @@ expect_offense(<<~RUBY) def up change_column :preferences, :subject_id, :integer - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Foreign keys must be of type BIGINT + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Mavenlint/BigIntForMigrationKeys: Foreign keys must be of type BIGINT end RUBY end @@ -32,7 +32,7 @@ def up expect_offense(<<~RUBY) def up change_column :preferences, :id, :integer - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Primary keys must be of type BIGINT + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Mavenlint/BigIntForMigrationKeys: Primary keys must be of type BIGINT end RUBY end @@ -53,7 +53,7 @@ def up expect_offense(<<~RUBY) def up add_column :preferences, :subject_id, :integer - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Foreign keys must be of type BIGINT + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Mavenlint/BigIntForMigrationKeys: Foreign keys must be of type BIGINT end RUBY end @@ -72,7 +72,7 @@ def up expect_offense(<<~RUBY) def up add_column :preferences, :id, :integer - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Primary keys must be of type BIGINT + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Mavenlint/BigIntForMigrationKeys: Primary keys must be of type BIGINT end RUBY end @@ -92,7 +92,7 @@ def up it 'registers an offense when table is created with integer pk' do expect_offense(<<~RUBY) create_table "access_control_analytics_reports_claims", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci", force: :cascade do |t| - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Primary keys must be of type BIGINT + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Mavenlint/BigIntForMigrationKeys: Primary keys must be of type BIGINT t.string "report_name", null: false end RUBY @@ -105,7 +105,7 @@ def up def change create_table :new_account_invitations do |t| t.integer :inviter_id, null: false - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Foreign keys must be of type BIGINT + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Mavenlint/BigIntForMigrationKeys: Foreign keys must be of type BIGINT t.string :email_address, null: false t.string :token, null: false, :limit => 36 t.timestamps diff --git a/spec/rubocop/cop/mavenlint/direct_factory_bot_invocation_spec.rb b/spec/rubocop/cop/mavenlint/direct_factory_bot_invocation_spec.rb index cf428d1..ead687b 100644 --- a/spec/rubocop/cop/mavenlint/direct_factory_bot_invocation_spec.rb +++ b/spec/rubocop/cop/mavenlint/direct_factory_bot_invocation_spec.rb @@ -10,14 +10,14 @@ it 'registers an offense when FactoryBot.create is used' do expect_offense(<<~RUBY) FactoryBot.create(:maven_participation, foo: 'bar') - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Direct calls to FactoryBot should be replaced with Mavenlink::ModelFactories calls + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Mavenlint/DirectFactoryBotInvocation: Direct calls to FactoryBot should be replaced with Mavenlink::ModelFactories calls RUBY end it 'registers an offense when FactoryBot.build is used' do expect_offense(<<~RUBY) FactoryBot.build(:maven_participation, foo: 'bar') - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Direct calls to FactoryBot should be replaced with Mavenlink::ModelFactories calls + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Mavenlint/DirectFactoryBotInvocation: Direct calls to FactoryBot should be replaced with Mavenlink::ModelFactories calls RUBY end end diff --git a/spec/rubocop/cop/mavenlint/no_dependent_destroy_account_spec.rb b/spec/rubocop/cop/mavenlint/no_dependent_destroy_account_spec.rb index d573f15..f2c7221 100644 --- a/spec/rubocop/cop/mavenlint/no_dependent_destroy_account_spec.rb +++ b/spec/rubocop/cop/mavenlint/no_dependent_destroy_account_spec.rb @@ -12,7 +12,7 @@ dependent_destructives.each do |destructive| %i[account accounts].each do |model| it "registers an offense when #{association} :account has dependent: :#{destructive} option" do - message = ' Do not add an association to account with dependent destroy. The destroy should go on the other side of the association. See https://guides.rubyonrails.org/association_basics.html#options-for-belongs-to-dependent' + message = ' Mavenlint/NoDependentDestroyAccount: Do not add an association to account with dependent destroy. The destroy should go on the other side of the association. See https://guides.rubyonrails.org/association_basics.html#options-for-belongs-to-dependent' ruby_code = "#{association} :#{model}, inverse_of: :foo, dependent: :#{destructive}, autosave: true" message = message.rjust(ruby_code.length + message.length, '^') @@ -34,19 +34,19 @@ it 'protects class name Account from dependent: :destroy' do expect_offense(<<~RUBY) belongs_to :invitee_account, dependent: :destroy, class_name: "Account" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not add an association to account with dependent destroy. The destroy should go on the other side of the association. See https://guides.rubyonrails.org/association_basics.html#options-for-belongs-to-dependent + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Mavenlint/NoDependentDestroyAccount: Do not add an association to account with dependent destroy. The destroy should go on the other side of the association. See https://guides.rubyonrails.org/association_basics.html#options-for-belongs-to-dependent RUBY expect_offense(<<~RUBY) belongs_to :invitee_account, dependent: :destroy, class_name: "::Account" - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not add an association to account with dependent destroy. The destroy should go on the other side of the association. See https://guides.rubyonrails.org/association_basics.html#options-for-belongs-to-dependent + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Mavenlint/NoDependentDestroyAccount: Do not add an association to account with dependent destroy. The destroy should go on the other side of the association. See https://guides.rubyonrails.org/association_basics.html#options-for-belongs-to-dependent RUBY end it 'handles various args' do expect_offense(<<~RUBY) belongs_to :account, dependent: :destroy - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not add an association to account with dependent destroy. The destroy should go on the other side of the association. See https://guides.rubyonrails.org/association_basics.html#options-for-belongs-to-dependent + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Mavenlint/NoDependentDestroyAccount: Do not add an association to account with dependent destroy. The destroy should go on the other side of the association. See https://guides.rubyonrails.org/association_basics.html#options-for-belongs-to-dependent RUBY end end diff --git a/spec/rubocop/cop/mavenlint/require_slow_helpers_spec.rb b/spec/rubocop/cop/mavenlint/require_slow_helpers_spec.rb index 01b555d..61afbdd 100644 --- a/spec/rubocop/cop/mavenlint/require_slow_helpers_spec.rb +++ b/spec/rubocop/cop/mavenlint/require_slow_helpers_spec.rb @@ -10,14 +10,14 @@ it 'registers an offense when require "spec_helper" is used' do expect_offense(<<~RUBY) require "spec_helper" - ^^^^^^^^^^^^^^^^^^^^^ Specs in the unit directory should not require rails_helper or spec_helper + ^^^^^^^^^^^^^^^^^^^^^ Mavenlint/RequireSlowHelpers: Specs in the unit directory should not require rails_helper or spec_helper RUBY end it 'registers an offense when require "rails_helper" is used' do expect_offense(<<~RUBY) require "rails_helper" - ^^^^^^^^^^^^^^^^^^^^^^ Specs in the unit directory should not require rails_helper or spec_helper + ^^^^^^^^^^^^^^^^^^^^^^ Mavenlint/RequireSlowHelpers: Specs in the unit directory should not require rails_helper or spec_helper RUBY end end diff --git a/spec/rubocop/cop/mavenlint/unsafe_mass_assignment_spec.rb b/spec/rubocop/cop/mavenlint/unsafe_mass_assignment_spec.rb index bb0555e..f83cc99 100644 --- a/spec/rubocop/cop/mavenlint/unsafe_mass_assignment_spec.rb +++ b/spec/rubocop/cop/mavenlint/unsafe_mass_assignment_spec.rb @@ -10,7 +10,7 @@ it 'registers an offense when mass assignment of foreign keys is allowed' do expect_offense(<<~RUBY) attr_accessible :story, :name, :account_id, :level - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not allow mass-assignment of foreign key columns. See https://github.com/mavenlink/welcome/wiki/Lint-Errors#unsafemassassignment + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Mavenlint/UnsafeMassAssignment: Do not allow mass-assignment of foreign key columns. See https://github.com/mavenlink/welcome/wiki/Lint-Errors#unsafemassassignment RUBY end diff --git a/spec/rubocop/cop/mavenlint/use_api_controller_spec.rb b/spec/rubocop/cop/mavenlint/use_api_controller_spec.rb index 4fed823..a1cc586 100644 --- a/spec/rubocop/cop/mavenlint/use_api_controller_spec.rb +++ b/spec/rubocop/cop/mavenlint/use_api_controller_spec.rb @@ -10,7 +10,7 @@ it 'registers an offense when an api controller directly inherits from ApplicationController' do expect_offense(<<~RUBY) class MyController < ApplicationController; end - ^^^^^^^^^^^^^^^^^^^^^ Api Controllers should subclass `ApiController`. + ^^^^^^^^^^^^^^^^^^^^^ Mavenlint/UseApiController: Api Controllers should subclass `ApiController`. RUBY end diff --git a/spec/rubocop/cop/mavenlint/use_application_controller_spec.rb b/spec/rubocop/cop/mavenlint/use_application_controller_spec.rb index b82e397..4904920 100644 --- a/spec/rubocop/cop/mavenlint/use_application_controller_spec.rb +++ b/spec/rubocop/cop/mavenlint/use_application_controller_spec.rb @@ -10,7 +10,7 @@ it 'registers an offense when a controller directly inherits from ActionController::Base' do expect_offense(<<~RUBY) class MyController < ActionController::Base; end - ^^^^^^^^^^^^^^^^^^^^^^ Controllers should subclass `ApplicationController`. + ^^^^^^^^^^^^^^^^^^^^^^ Mavenlint/UseApplicationController: Controllers should subclass `ApplicationController`. RUBY end diff --git a/spec/rubocop/cop/mavenlint/use_application_record_spec.rb b/spec/rubocop/cop/mavenlint/use_application_record_spec.rb index 20ad2e9..17b9f9f 100644 --- a/spec/rubocop/cop/mavenlint/use_application_record_spec.rb +++ b/spec/rubocop/cop/mavenlint/use_application_record_spec.rb @@ -10,7 +10,7 @@ it 'registers an offense a model directly inherits from ActiveRecord::Base' do expect_offense(<<~RUBY) class User < ActiveRecord::Base; end - ^^^^^^^^^^^^^^^^^^ Models should subclass `ApplicationRecord`. + ^^^^^^^^^^^^^^^^^^ Mavenlint/UseApplicationRecord: Models should subclass `ApplicationRecord`. RUBY end diff --git a/spec/rubocop/cop/mavenlint/use_fast_capybara_matchers_spec.rb b/spec/rubocop/cop/mavenlint/use_fast_capybara_matchers_spec.rb index b127fd2..503df0a 100644 --- a/spec/rubocop/cop/mavenlint/use_fast_capybara_matchers_spec.rb +++ b/spec/rubocop/cop/mavenlint/use_fast_capybara_matchers_spec.rb @@ -10,21 +10,21 @@ it 'registers an offense when "to_not have_*" is used' do expect_offense(<<~RUBY) expect(page).to_not have_text('Hello') - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use a `to have_no_*` selector. See https://github.com/mavenlink/welcome/wiki/Lint-Errors#usefastcapybaramatchers + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Mavenlint/UseFastCapybaraMatchers: Use a `to have_no_*` selector. See https://github.com/mavenlink/welcome/wiki/Lint-Errors#usefastcapybaramatchers RUBY end it 'registers an offense when "to_not have_*" is used' do expect_offense(<<~RUBY) expect(page.find('.greeting')).to_not have_text('Hello') - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use a `to have_no_*` selector. See https://github.com/mavenlink/welcome/wiki/Lint-Errors#usefastcapybaramatchers + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Mavenlint/UseFastCapybaraMatchers: Use a `to have_no_*` selector. See https://github.com/mavenlink/welcome/wiki/Lint-Errors#usefastcapybaramatchers RUBY end it 'registers an offense when "to_not have_*" is used' do expect_offense(<<~RUBY) expect(page).to_not have_css('.wat') - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use a `to have_no_*` selector. See https://github.com/mavenlink/welcome/wiki/Lint-Errors#usefastcapybaramatchers + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Mavenlint/UseFastCapybaraMatchers: Use a `to have_no_*` selector. See https://github.com/mavenlink/welcome/wiki/Lint-Errors#usefastcapybaramatchers RUBY end