rubocop-airbnb 7.0.0 → 8.0.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 +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +5 -3
- data/config/default.yml +3 -1
- data/config/rubocop-capybara.yml +6 -0
- data/config/rubocop-factory_bot.yml +10 -0
- data/config/rubocop-performance.yml +1 -2
- data/config/rubocop-rails.yml +1 -1
- data/config/rubocop-rspec.yml +16 -24
- data/lib/rubocop/airbnb/plugin.rb +31 -0
- data/lib/rubocop/airbnb/version.rb +1 -1
- data/lib/rubocop-airbnb.rb +3 -5
- data/rubocop-airbnb.gemspec +9 -4
- metadata +57 -12
- data/lib/rubocop/airbnb/inject.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 659a6878548873c1b6736354126949f0825dc76a717263eb83cd6ee32ac02561
|
4
|
+
data.tar.gz: f6680699553af27121ae53305d27976d61de7e75ab61f9e2b70e0da13384a78e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07315be1396edcd8ef9cb29a882fc9c7bf7f31b658704862698ba9664862c9bbad80690977474919dc1e5390bf2145148e9f347fb8ed84e1858d208572c0f527
|
7
|
+
data.tar.gz: 41c7d5db9b3bc0574a969ef1fb6453c3f2a604e78b8c03c7b7e29168b3b212220dab03af7d09774f1f5f13972800b2d728750e6b97bd12fb3529456ce5c8f9f1
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
# 8.0.0
|
2
|
+
* [#72](https://github.com/airbnb/ruby/pull/212) Adopt Rubocop's plugin system (thanks @koic!)
|
3
|
+
* Bump minimum gem versions:
|
4
|
+
* `rubocop` from `'~> 1.61'` to `'~> 1.72'`
|
5
|
+
* `rubocop-performance` from `'~> 1.20'` to `'~> 1.24'`
|
6
|
+
* `rubocop-rails` from `'~> 2.24'` to `'~> 2.30'`
|
7
|
+
* `rubocop-rspec` from `'~> 2.26'` to `'~> 3.5'`
|
8
|
+
* Add explicit `rubocop-*` gem dependencies which have been extracted
|
9
|
+
* `rubocop-capybara` with min version `'~> 2.22'`
|
10
|
+
* `rubocop-factory_bot` with min version `'~> 2.27'`
|
11
|
+
|
1
12
|
# 7.0.0
|
2
13
|
* Add support for Ruby 3.3
|
3
14
|
* Drop support for Ruby 2.6
|
data/README.md
CHANGED
@@ -29,7 +29,7 @@ ways to do this:
|
|
29
29
|
First Create a new file `.rubocop_airbnb.yml` in the same directory as your `.rubocop.yml`
|
30
30
|
this file should contain
|
31
31
|
```
|
32
|
-
|
32
|
+
plugins:
|
33
33
|
- rubocop-airbnb
|
34
34
|
```
|
35
35
|
|
@@ -50,10 +50,13 @@ you could potentially experience a bunch of warnings from `.rubocop_todo.yml` fo
|
|
50
50
|
Now you can run `rubocop` and it will automatically load the RuboCop Airbnb
|
51
51
|
cops together with the standard cops.
|
52
52
|
|
53
|
+
> [!NOTE]
|
54
|
+
> The plugin system is supported in RuboCop 1.72+. In earlier versions, use `require` instead of `plugins`.
|
55
|
+
|
53
56
|
### Command line
|
54
57
|
|
55
58
|
```bash
|
56
|
-
rubocop --
|
59
|
+
rubocop --plugin rubocop-airbnb
|
57
60
|
```
|
58
61
|
|
59
62
|
## The Cops
|
@@ -70,4 +73,3 @@ Airbnb/PhraseBundleKeys:
|
|
70
73
|
Exclude:
|
71
74
|
- spec/my_poorly_named_spec_file.rb
|
72
75
|
```
|
73
|
-
|
data/config/default.yml
CHANGED
@@ -29,7 +29,7 @@ RSpec:
|
|
29
29
|
Include:
|
30
30
|
- _spec.rb
|
31
31
|
- "(?:^|/)spec/"
|
32
|
-
|
32
|
+
FactoryBot:
|
33
33
|
Include:
|
34
34
|
- spec/factories/**/*.rb
|
35
35
|
- features/support/factories/**/*.rb
|
@@ -37,6 +37,8 @@ RSpec/FactoryBot:
|
|
37
37
|
inherit_from:
|
38
38
|
- './rubocop-airbnb.yml'
|
39
39
|
- './rubocop-bundler.yml'
|
40
|
+
- './rubocop-capybara.yml'
|
41
|
+
- './rubocop-factory_bot.yml'
|
40
42
|
- './rubocop-gemspec.yml'
|
41
43
|
- './rubocop-layout.yml'
|
42
44
|
- './rubocop-lint.yml'
|
data/config/rubocop-rails.yml
CHANGED
data/config/rubocop-rspec.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
plugins:
|
2
2
|
- rubocop-rspec
|
3
3
|
|
4
4
|
RSpec/AlignLeftLetBrace:
|
@@ -53,6 +53,10 @@ RSpec/DescribedClass:
|
|
53
53
|
Description: 'Use `described_class` for tested class / module'
|
54
54
|
Enabled: false
|
55
55
|
|
56
|
+
RSpec/Dialect:
|
57
|
+
Description: Enforces custom RSpec dialects.
|
58
|
+
Enabled: false
|
59
|
+
|
56
60
|
RSpec/EmptyExampleGroup:
|
57
61
|
Description: Checks if an example group does not include any tests.
|
58
62
|
Enabled: true
|
@@ -110,13 +114,6 @@ RSpec/ExpectOutput:
|
|
110
114
|
Description: Checks for opportunities to use `expect { ... }.to output`.
|
111
115
|
Enabled: false
|
112
116
|
|
113
|
-
RSpec/FilePath:
|
114
|
-
Description: 'Checks the file and folder naming of the spec file.'
|
115
|
-
Enabled: false
|
116
|
-
CustomTransform:
|
117
|
-
RuboCop: rubocop
|
118
|
-
RSpec: rspec
|
119
|
-
|
120
117
|
RSpec/Focus:
|
121
118
|
Description: Checks if examples are focused.
|
122
119
|
Enabled: false
|
@@ -293,6 +290,17 @@ RSpec/SingleArgumentMessageChain:
|
|
293
290
|
Description: Checks that chains of messages contain more than one element.
|
294
291
|
Enabled: true
|
295
292
|
|
293
|
+
RSpec/SpecFilePathFormat:
|
294
|
+
Description: Checks that spec file paths are consistent and well-formed.
|
295
|
+
Enabled: false
|
296
|
+
CustomTransform:
|
297
|
+
RuboCop: rubocop
|
298
|
+
RSpec: rspec
|
299
|
+
|
300
|
+
RSpec/SpecFilePathSuffix:
|
301
|
+
Description: Checks that spec file paths suffix are consistent and well-formed.
|
302
|
+
Enabled: false
|
303
|
+
|
296
304
|
RSpec/SubjectStub:
|
297
305
|
Description: Checks for stubbed test subjects.
|
298
306
|
Enabled: false
|
@@ -308,19 +316,3 @@ RSpec/VerifiedDoubles:
|
|
308
316
|
RSpec/VoidExpect:
|
309
317
|
Description: This cop checks void `expect()`.
|
310
318
|
Enabled: false
|
311
|
-
|
312
|
-
RSpec/Capybara/CurrentPathExpectation:
|
313
|
-
Description: Checks that no expectations are set on Capybara's `current_path`.
|
314
|
-
Enabled: false
|
315
|
-
|
316
|
-
RSpec/Capybara/FeatureMethods:
|
317
|
-
Description: Checks for consistent method usage in feature specs.
|
318
|
-
Enabled: false
|
319
|
-
|
320
|
-
RSpec/FactoryBot/AttributeDefinedStatically:
|
321
|
-
Description: Always declare attribute values as blocks.
|
322
|
-
Enabled: false
|
323
|
-
|
324
|
-
RSpec/FactoryBot/CreateList:
|
325
|
-
Description: Checks for create_list usage.
|
326
|
-
Enabled: true
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'lint_roller'
|
4
|
+
|
5
|
+
module RuboCop
|
6
|
+
module Airbnb
|
7
|
+
# A plugin that integrates RuboCop Airbnb with RuboCop's plugin system.
|
8
|
+
class Plugin < LintRoller::Plugin
|
9
|
+
def about
|
10
|
+
LintRoller::About.new(
|
11
|
+
name: 'rubocop-airbnb',
|
12
|
+
version: VERSION,
|
13
|
+
homepage: 'https://github.com/airbnb/ruby',
|
14
|
+
description: 'A plugin for RuboCop code style enforcing & linting tool.'
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
def supported?(context)
|
19
|
+
context.engine == :rubocop
|
20
|
+
end
|
21
|
+
|
22
|
+
def rules(_context)
|
23
|
+
LintRoller::Rules.new(
|
24
|
+
type: :path,
|
25
|
+
config_format: :rubocop,
|
26
|
+
value: Pathname.new(__dir__).join('../../../config/default.yml'),
|
27
|
+
)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/rubocop-airbnb.rb
CHANGED
@@ -7,8 +7,6 @@ require 'rubocop'
|
|
7
7
|
require 'rubocop-performance'
|
8
8
|
require 'rubocop-rails'
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
RuboCop::Airbnb::Inject.defaults!
|
10
|
+
require_relative 'rubocop/airbnb'
|
11
|
+
require_relative 'rubocop/airbnb/plugin'
|
12
|
+
require_relative 'rubocop/airbnb/version'
|
data/rubocop-airbnb.gemspec
CHANGED
@@ -25,9 +25,14 @@ Gem::Specification.new do |spec|
|
|
25
25
|
'Gemfile',
|
26
26
|
]
|
27
27
|
|
28
|
-
spec.
|
29
|
-
|
30
|
-
spec.add_dependency('
|
31
|
-
spec.add_dependency('rubocop
|
28
|
+
spec.metadata['default_lint_roller_plugin'] = 'RuboCop::Airbnb::Plugin'
|
29
|
+
|
30
|
+
spec.add_dependency('lint_roller', '~> 1.1')
|
31
|
+
spec.add_dependency('rubocop', '~> 1.72')
|
32
|
+
spec.add_dependency('rubocop-capybara', '~> 2.22')
|
33
|
+
spec.add_dependency('rubocop-factory_bot', '~> 2.27')
|
34
|
+
spec.add_dependency('rubocop-performance', '~> 1.24')
|
35
|
+
spec.add_dependency('rubocop-rails', '~> 2.30')
|
36
|
+
spec.add_dependency('rubocop-rspec', '~> 3.5')
|
32
37
|
spec.add_development_dependency('rspec', '~> 3.5')
|
33
38
|
end
|
metadata
CHANGED
@@ -1,71 +1,113 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-airbnb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 8.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Airbnb Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: lint_roller
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.1'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rubocop
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
31
|
- - "~>"
|
18
32
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
33
|
+
version: '1.72'
|
20
34
|
type: :runtime
|
21
35
|
prerelease: false
|
22
36
|
version_requirements: !ruby/object:Gem::Requirement
|
23
37
|
requirements:
|
24
38
|
- - "~>"
|
25
39
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
40
|
+
version: '1.72'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubocop-capybara
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.22'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.22'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop-factory_bot
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.27'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.27'
|
27
69
|
- !ruby/object:Gem::Dependency
|
28
70
|
name: rubocop-performance
|
29
71
|
requirement: !ruby/object:Gem::Requirement
|
30
72
|
requirements:
|
31
73
|
- - "~>"
|
32
74
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
75
|
+
version: '1.24'
|
34
76
|
type: :runtime
|
35
77
|
prerelease: false
|
36
78
|
version_requirements: !ruby/object:Gem::Requirement
|
37
79
|
requirements:
|
38
80
|
- - "~>"
|
39
81
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
82
|
+
version: '1.24'
|
41
83
|
- !ruby/object:Gem::Dependency
|
42
84
|
name: rubocop-rails
|
43
85
|
requirement: !ruby/object:Gem::Requirement
|
44
86
|
requirements:
|
45
87
|
- - "~>"
|
46
88
|
- !ruby/object:Gem::Version
|
47
|
-
version: '2.
|
89
|
+
version: '2.30'
|
48
90
|
type: :runtime
|
49
91
|
prerelease: false
|
50
92
|
version_requirements: !ruby/object:Gem::Requirement
|
51
93
|
requirements:
|
52
94
|
- - "~>"
|
53
95
|
- !ruby/object:Gem::Version
|
54
|
-
version: '2.
|
96
|
+
version: '2.30'
|
55
97
|
- !ruby/object:Gem::Dependency
|
56
98
|
name: rubocop-rspec
|
57
99
|
requirement: !ruby/object:Gem::Requirement
|
58
100
|
requirements:
|
59
101
|
- - "~>"
|
60
102
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
103
|
+
version: '3.5'
|
62
104
|
type: :runtime
|
63
105
|
prerelease: false
|
64
106
|
version_requirements: !ruby/object:Gem::Requirement
|
65
107
|
requirements:
|
66
108
|
- - "~>"
|
67
109
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
110
|
+
version: '3.5'
|
69
111
|
- !ruby/object:Gem::Dependency
|
70
112
|
name: rspec
|
71
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -97,6 +139,8 @@ files:
|
|
97
139
|
- config/default.yml
|
98
140
|
- config/rubocop-airbnb.yml
|
99
141
|
- config/rubocop-bundler.yml
|
142
|
+
- config/rubocop-capybara.yml
|
143
|
+
- config/rubocop-factory_bot.yml
|
100
144
|
- config/rubocop-gemspec.yml
|
101
145
|
- config/rubocop-layout.yml
|
102
146
|
- config/rubocop-lint.yml
|
@@ -110,7 +154,7 @@ files:
|
|
110
154
|
- lib/rubocop-airbnb.rb
|
111
155
|
- lib/rubocop/airbnb.rb
|
112
156
|
- lib/rubocop/airbnb/inflections.rb
|
113
|
-
- lib/rubocop/airbnb/
|
157
|
+
- lib/rubocop/airbnb/plugin.rb
|
114
158
|
- lib/rubocop/airbnb/rails_autoloading.rb
|
115
159
|
- lib/rubocop/airbnb/version.rb
|
116
160
|
- lib/rubocop/cop/airbnb/class_or_module_declared_in_wrong_file.rb
|
@@ -154,7 +198,8 @@ files:
|
|
154
198
|
homepage: https://github.com/airbnb/ruby
|
155
199
|
licenses:
|
156
200
|
- MIT
|
157
|
-
metadata:
|
201
|
+
metadata:
|
202
|
+
default_lint_roller_plugin: RuboCop::Airbnb::Plugin
|
158
203
|
post_install_message:
|
159
204
|
rdoc_options: []
|
160
205
|
require_paths:
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# Straight up ripped from the custom Rspec rubocop
|
2
|
-
# https://github.com/nevir/rubocop-rspec/blob/master/lib/rubocop/rspec/inject.rb
|
3
|
-
require 'yaml'
|
4
|
-
|
5
|
-
module RuboCop
|
6
|
-
module Airbnb
|
7
|
-
# Because RuboCop doesn't yet support plugins, we have to monkey patch in a
|
8
|
-
# bit of our configuration.
|
9
|
-
module Inject
|
10
|
-
def self.defaults!
|
11
|
-
path = CONFIG_DEFAULT.to_s
|
12
|
-
hash = ConfigLoader.load_file(path).to_hash
|
13
|
-
config = Config.new(hash, path)
|
14
|
-
puts "configuration from #{path}" if ConfigLoader.debug?
|
15
|
-
config = ConfigLoader.merge_with_default(config, path)
|
16
|
-
ConfigLoader.instance_variable_set(:@default_configuration, config)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|