mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-22 14:05:42 +01:00
Use explicit config loading from bin/rubocop
(#33256)
This commit is contained in:
parent
ecdf4ea062
commit
c68eb82ffa
12 changed files with 13 additions and 30 deletions
2
.github/workflows/lint-ruby.yml
vendored
2
.github/workflows/lint-ruby.yml
vendored
|
@ -9,6 +9,7 @@ on:
|
||||||
- 'Gemfile*'
|
- 'Gemfile*'
|
||||||
- '.rubocop*.yml'
|
- '.rubocop*.yml'
|
||||||
- '.ruby-version'
|
- '.ruby-version'
|
||||||
|
- 'bin/rubocop'
|
||||||
- 'config/brakeman.ignore'
|
- 'config/brakeman.ignore'
|
||||||
- '**/*.rb'
|
- '**/*.rb'
|
||||||
- '**/*.rake'
|
- '**/*.rake'
|
||||||
|
@ -19,6 +20,7 @@ on:
|
||||||
- 'Gemfile*'
|
- 'Gemfile*'
|
||||||
- '.rubocop*.yml'
|
- '.rubocop*.yml'
|
||||||
- '.ruby-version'
|
- '.ruby-version'
|
||||||
|
- 'bin/rubocop'
|
||||||
- 'config/brakeman.ignore'
|
- 'config/brakeman.ignore'
|
||||||
- '**/*.rb'
|
- '**/*.rb'
|
||||||
- '**/*.rake'
|
- '**/*.rake'
|
||||||
|
|
|
@ -24,4 +24,7 @@ end
|
||||||
require "rubygems"
|
require "rubygems"
|
||||||
require "bundler/setup"
|
require "bundler/setup"
|
||||||
|
|
||||||
|
# explicit rubocop config increases performance slightly while avoiding config confusion.
|
||||||
|
ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__))
|
||||||
|
|
||||||
load Gem.bin_path("rubocop", "rubocop")
|
load Gem.bin_path("rubocop", "rubocop")
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
inherit_from: ../../.rubocop.yml
|
|
||||||
|
|
||||||
# Below are all enabled as workaround for https://docs.rubocop.org/rubocop/configuration.html#path-relativity
|
|
||||||
# TODO: Delete this file and move above config to base naming config
|
|
||||||
|
|
||||||
Rails/CreateTableWithTimestamps:
|
|
||||||
Include:
|
|
||||||
- '*.rb'
|
|
||||||
|
|
||||||
Rails/ThreeStateBooleanColumn:
|
|
||||||
Include:
|
|
||||||
- '*.rb'
|
|
||||||
|
|
||||||
Rails/ReversibleMigration:
|
|
||||||
Include:
|
|
||||||
- '*.rb'
|
|
|
@ -17,7 +17,7 @@ class MigrateSettings < ActiveRecord::Migration[4.2]
|
||||||
t.remove_index [:thing_type, :thing_id, :var]
|
t.remove_index [:thing_type, :thing_id, :var]
|
||||||
t.rename :thing_id, :target_id
|
t.rename :thing_id, :target_id
|
||||||
t.rename :thing_type, :target_type
|
t.rename :thing_type, :target_type
|
||||||
t.column :target_id, :integer, null: false
|
t.column :target_id, :integer, null: false # rubocop:disable Rails/NotNullColumn
|
||||||
t.column :target_type, :string, null: false, default: ''
|
t.column :target_type, :string, null: false, default: ''
|
||||||
t.index [:target_type, :target_id, :var], unique: true
|
t.index [:target_type, :target_id, :var], unique: true
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
inherit_from: ../../.rubocop.yml
|
|
||||||
|
|
||||||
# Anonymous controllers in specs cannot access `described_class`, explanation:
|
|
||||||
# https://github.com/rubocop/rubocop-rspec/blob/v2.26.1/lib/rubocop/cop/rspec/described_class.rb#L36-L56
|
|
||||||
RSpec/DescribedClass:
|
|
||||||
SkipBlocks: true
|
|
|
@ -4,7 +4,7 @@ require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe AccountControllerConcern do
|
RSpec.describe AccountControllerConcern do
|
||||||
controller(ApplicationController) do
|
controller(ApplicationController) do
|
||||||
include AccountControllerConcern
|
include AccountControllerConcern # rubocop:disable RSpec/DescribedClass
|
||||||
|
|
||||||
def success
|
def success
|
||||||
render plain: @account.username # rubocop:disable RSpec/InstanceVariable
|
render plain: @account.username # rubocop:disable RSpec/InstanceVariable
|
||||||
|
|
|
@ -4,7 +4,7 @@ require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe Api::RateLimitHeaders do
|
RSpec.describe Api::RateLimitHeaders do
|
||||||
controller(ApplicationController) do
|
controller(ApplicationController) do
|
||||||
include Api::RateLimitHeaders
|
include Api::RateLimitHeaders # rubocop:disable RSpec/DescribedClass
|
||||||
|
|
||||||
def show
|
def show
|
||||||
head 200
|
head 200
|
||||||
|
|
|
@ -4,7 +4,7 @@ require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe ChallengableConcern do
|
RSpec.describe ChallengableConcern do
|
||||||
controller(ApplicationController) do
|
controller(ApplicationController) do
|
||||||
include ChallengableConcern
|
include ChallengableConcern # rubocop:disable RSpec/DescribedClass
|
||||||
|
|
||||||
before_action :require_challenge!
|
before_action :require_challenge!
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe Localized do
|
RSpec.describe Localized do
|
||||||
controller(ApplicationController) do
|
controller(ApplicationController) do
|
||||||
include Localized
|
include Localized # rubocop:disable RSpec/DescribedClass
|
||||||
|
|
||||||
def success
|
def success
|
||||||
render plain: I18n.locale, status: 200
|
render plain: I18n.locale, status: 200
|
||||||
|
|
|
@ -4,7 +4,7 @@ require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe PreloadingConcern do
|
RSpec.describe PreloadingConcern do
|
||||||
controller(ApplicationController) do
|
controller(ApplicationController) do
|
||||||
include PreloadingConcern
|
include PreloadingConcern # rubocop:disable RSpec/DescribedClass
|
||||||
|
|
||||||
def empty_array
|
def empty_array
|
||||||
render plain: preload_collection([], Status).size
|
render plain: preload_collection([], Status).size
|
||||||
|
|
|
@ -4,7 +4,7 @@ require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe Settings::ExportControllerConcern do
|
RSpec.describe Settings::ExportControllerConcern do
|
||||||
controller(ApplicationController) do
|
controller(ApplicationController) do
|
||||||
include Settings::ExportControllerConcern
|
include Settings::ExportControllerConcern # rubocop:disable RSpec/DescribedClass
|
||||||
|
|
||||||
def index
|
def index
|
||||||
send_export_file
|
send_export_file
|
||||||
|
|
|
@ -4,7 +4,7 @@ require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe UserTrackingConcern do
|
RSpec.describe UserTrackingConcern do
|
||||||
controller(ApplicationController) do
|
controller(ApplicationController) do
|
||||||
include UserTrackingConcern
|
include UserTrackingConcern # rubocop:disable RSpec/DescribedClass
|
||||||
|
|
||||||
def show
|
def show
|
||||||
render plain: 'show'
|
render plain: 'show'
|
||||||
|
|
Loading…
Reference in a new issue