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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 506db29e071d65b4cdb7f397b5b5d4a9251ec56f
4
- data.tar.gz: ae1917de476959e962b786408bf788bae33ad31d
3
+ metadata.gz: 4c63e90ad7d1b2099f2aab6305c3d0123d1c6e3e
4
+ data.tar.gz: d25866a9801f2a127476ee40f918b236465310e0
5
5
  SHA512:
6
- metadata.gz: 02aed155f78cda26fdf898a66aae1e798bb77dca7b6aa29ab975d855ff1dbab87baacf20509dd234bbe8be7e7e87a60c68ef31d559bfd14a88e5766b60e80917
7
- data.tar.gz: 1b5e49ff7b0cf8c3f66d597b02f26bc85dedbbe7a8e7e02bcf7f30c1dc746c2534f43f0c4beea6cf2bbcb361273afec8622a6044bdb833a71e459d26de34c0ed
6
+ metadata.gz: 24ba565cd9d863890700d15fd65702fbc4cb7b27fcd1fa6ed1b71c78ba007b68cca518ecb9eb15a75e9d049d8d34849353631a46ba58db0422ac2d3d07a2446f
7
+ data.tar.gz: e54da354c72bf4a6a01927b0eb89dc3bae0dd38e8b469b9d771f4ce66e0ee620f0fcc116293e3e1835e5e06f3ff012ce7922a33610454a1ff8f474e9e398f4c3
data/.rubocop.yml CHANGED
@@ -1,27 +1,6 @@
1
- AllCops:
2
- DisplayCopNames: true
1
+ inherit_from:
2
+ - conf/rubocop.yml
3
3
 
4
- Metrics/AbcSize:
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
- # v0.50.0
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.1
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
- # v0.49.0
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, and eventually shared rubocop configuration.
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
+
@@ -1,3 +1,3 @@
1
1
  module EzcaterRubocop
2
- VERSION = "0.50.0".freeze
2
+ VERSION = "0.50.1".freeze
3
3
  end
@@ -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.0
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-09 00:00:00.000000000 Z
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