ezcater_rubocop 0.50.0 → 0.50.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -25
- data/CHANGELOG.md +13 -3
- data/README.md +25 -1
- data/conf/rubocop.yml +48 -0
- data/conf/rubocop_rails.yml +14 -0
- data/lib/ezcater_rubocop/version.rb +1 -1
- data/lib/rubocop/cop/ezcater/style_dig.rb +6 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c63e90ad7d1b2099f2aab6305c3d0123d1c6e3e
|
4
|
+
data.tar.gz: d25866a9801f2a127476ee40f918b236465310e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24ba565cd9d863890700d15fd65702fbc4cb7b27fcd1fa6ed1b71c78ba007b68cca518ecb9eb15a75e9d049d8d34849353631a46ba58db0422ac2d3d07a2446f
|
7
|
+
data.tar.gz: e54da354c72bf4a6a01927b0eb89dc3bae0dd38e8b469b9d771f4ce66e0ee620f0fcc116293e3e1835e5e06f3ff012ce7922a33610454a1ff8f474e9e398f4c3
|
data/.rubocop.yml
CHANGED
@@ -1,27 +1,6 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
inherit_from:
|
2
|
+
- conf/rubocop.yml
|
3
3
|
|
4
|
-
|
4
|
+
# Disable because aggregate_failures is configured globally
|
5
|
+
RSpec/MultipleExpectations:
|
5
6
|
Enabled: false
|
6
|
-
|
7
|
-
Metrics/BlockLength:
|
8
|
-
Exclude:
|
9
|
-
- "*.gemspec"
|
10
|
-
- "spec/**/*.rb"
|
11
|
-
|
12
|
-
Metrics/MethodLength:
|
13
|
-
Enabled: true
|
14
|
-
CountComments: false
|
15
|
-
Max: 25
|
16
|
-
|
17
|
-
Metrics/LineLength:
|
18
|
-
Max: 120
|
19
|
-
|
20
|
-
Style/FrozenStringLiteralComment:
|
21
|
-
Enabled: false
|
22
|
-
|
23
|
-
Style/Documentation:
|
24
|
-
Enabled: false
|
25
|
-
|
26
|
-
Style/StringLiterals:
|
27
|
-
EnforcedStyle: double_quotes
|
data/CHANGELOG.md
CHANGED
@@ -1,13 +1,23 @@
|
|
1
1
|
# ezcater_rubocop
|
2
2
|
|
3
|
-
|
3
|
+
## v0.50.1
|
4
|
+
- Add shared configuration.
|
5
|
+
- Do not apply `Ezcater/StyleDig` to access using a range.
|
6
|
+
|
7
|
+
## v0.50.0
|
4
8
|
- Update to rubocop v0.50.0 and rubocop-rspec v1.18.0.
|
5
9
|
- Do not apply `Ezcater/StyleDig` to assignments with nested access.
|
6
10
|
|
7
|
-
# v0.49.
|
11
|
+
# v0.49.3
|
12
|
+
- Do not apply `Ezcater/StyleDig` to access using a range.
|
13
|
+
|
14
|
+
# v0.49.2
|
15
|
+
- Do not apply `Ezcater/StyleDig` to assignments to with nested access.
|
16
|
+
|
17
|
+
## v0.49.1
|
8
18
|
- Add `Ezcater/RspecRequireBrowserMock` cop.
|
9
19
|
|
10
|
-
|
20
|
+
## v0.49.0
|
11
21
|
- Initial release.
|
12
22
|
- Add `Ezcater/RspecRequireFeatureFlagMock` cop.
|
13
23
|
- Add `Ezcater/RspecDotNotSelfDot` cop.
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# ezcater_rubocop
|
2
2
|
|
3
|
-
ezCater custom cops
|
3
|
+
ezCater custom cops and shared RuboCop configuration.
|
4
4
|
|
5
5
|
[RuboCop](https://github.com/bbatsov/rubocop) is a static code analyzer that
|
6
6
|
can enforce style conventions as well as identify common problems.
|
@@ -15,6 +15,12 @@ group :development do
|
|
15
15
|
end
|
16
16
|
```
|
17
17
|
|
18
|
+
Or to your gem's gemspec file:
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
spec.add_development_dependency "ezcater_rubocop"
|
22
|
+
```
|
23
|
+
|
18
24
|
And then execute:
|
19
25
|
|
20
26
|
$ bundle install
|
@@ -23,6 +29,24 @@ Or install it yourself as:
|
|
23
29
|
|
24
30
|
$ gem install ezcater_rubocop
|
25
31
|
|
32
|
+
## Configuration
|
33
|
+
|
34
|
+
To use one of the shared RuboCop configurations from this gem, you must define a
|
35
|
+
.rubocop.yml file in your project:
|
36
|
+
|
37
|
+
```yaml
|
38
|
+
inherit_gem:
|
39
|
+
ezcater_rubocop: conf/rubocop_rails.yml
|
40
|
+
```
|
41
|
+
|
42
|
+
Further customization of RuboCop for your local project may be added to this file.
|
43
|
+
|
44
|
+
### Available Configurations
|
45
|
+
|
46
|
+
- **rubocop**: Assumes RSpec is used and requires [rubocop-rspec](https://github.com/backus/rubocop-rspec).
|
47
|
+
This configuration should be used for gems.
|
48
|
+
- **rubocop_rails**: For Rails projects, this inherits from the **rubocop** configuration.
|
49
|
+
|
26
50
|
## Usage
|
27
51
|
|
28
52
|
Run `rubocop` for an entire project:
|
data/conf/rubocop.yml
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require: ezcater_rubocop
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
DisplayCopNames: true
|
5
|
+
|
6
|
+
Layout/DotPosition:
|
7
|
+
EnforcedStyle: trailing
|
8
|
+
|
9
|
+
Metrics/AbcSize:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
Metrics/BlockLength:
|
13
|
+
Exclude:
|
14
|
+
- "*.gemspec"
|
15
|
+
- "spec/**/*.rb"
|
16
|
+
|
17
|
+
Metrics/CyclomaticComplexity:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
Metrics/LineLength:
|
21
|
+
Max: 120
|
22
|
+
|
23
|
+
Metrics/MethodLength:
|
24
|
+
Enabled: true
|
25
|
+
CountComments: false
|
26
|
+
Max: 25
|
27
|
+
|
28
|
+
Metrics/PerceivedComplexity:
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
Rails:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
Style/FrozenStringLiteralComment:
|
35
|
+
Enabled: false
|
36
|
+
|
37
|
+
Style/Documentation:
|
38
|
+
Enabled: false
|
39
|
+
|
40
|
+
# This cop does not yet support a style to prevent underscores
|
41
|
+
Style/NumericLiterals:
|
42
|
+
Enabled: false
|
43
|
+
|
44
|
+
Style/SingleLineBlockParams:
|
45
|
+
Enabled: false
|
46
|
+
|
47
|
+
Style/StringLiterals:
|
48
|
+
EnforcedStyle: double_quotes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
inherit_from:
|
2
|
+
- ../conf/rubocop.yml
|
3
|
+
|
4
|
+
AllCops:
|
5
|
+
TargetRailsVersion: 5.1
|
6
|
+
|
7
|
+
Rails:
|
8
|
+
Enabled: true
|
9
|
+
|
10
|
+
Rails/RelativeDateConstant:
|
11
|
+
# Auto-correct is broken for this cops in some cases. It replaces the
|
12
|
+
# constant but does not update references to it.
|
13
|
+
AutoCorrect: false
|
14
|
+
|
@@ -22,7 +22,7 @@ module RuboCop
|
|
22
22
|
MSG = "Use `dig` for nested access.".freeze
|
23
23
|
|
24
24
|
def_node_matcher :nested_access_match, <<-PATTERN
|
25
|
-
(send (send (send _receiver !:[]) :[]
|
25
|
+
(send (send (send _receiver !:[]) :[] !{irange erange}) :[] !{irange erange})
|
26
26
|
PATTERN
|
27
27
|
|
28
28
|
def on_send(node)
|
@@ -57,7 +57,11 @@ module RuboCop
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def access_node?(node)
|
60
|
-
node&.send_type? && node.method_name == :[]
|
60
|
+
node&.send_type? && node.method_name == :[] && !range?(node.first_argument)
|
61
|
+
end
|
62
|
+
|
63
|
+
def range?(node)
|
64
|
+
node.irange_type? || node.erange_type?
|
61
65
|
end
|
62
66
|
end
|
63
67
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ezcater_rubocop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.50.
|
4
|
+
version: 0.50.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ezCater, Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -129,6 +129,8 @@ files:
|
|
129
129
|
- Rakefile
|
130
130
|
- bin/console
|
131
131
|
- bin/setup
|
132
|
+
- conf/rubocop.yml
|
133
|
+
- conf/rubocop_rails.yml
|
132
134
|
- config/default.yml
|
133
135
|
- ezcater_rubocop.gemspec
|
134
136
|
- lib/ezcater_rubocop.rb
|