rubocop-expert 0.1.1 → 0.1.2
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/.travis.yml +14 -1
- data/Gemfile +4 -0
- data/Gemfile.lock +10 -1
- data/README.md +30 -9
- data/lib/rubocop/cop/expert/redundant_parentheses_for_method_call.rb +13 -9
- data/lib/rubocop/expert/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60b8509883369fbd154a5f436959f405ef456a2c4408cd94532a00b8bad6de16
|
4
|
+
data.tar.gz: c5fa3408ecec3d4f86dfbf84e08a417e8f88b939fec6f0a099da7d81a2efac7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71b246160ac1a8819f52d10d88d9fe74fdb631bfe7750be9d852529b1f17cd152e4a34bdc9effc6d45715d041672e195e1a77ecfc7d19ed5f9fb89537bb695b2
|
7
|
+
data.tar.gz: '0846c330f4336ea4e4a2aeb4729ed88eab59baa96ba5cab83458f9504cff33bb897b902da778bbe357d6cbd82545e424b0b7af35d7f9d3c1025054cc8fbe80e1'
|
data/.travis.yml
CHANGED
@@ -3,5 +3,18 @@ sudo: false
|
|
3
3
|
language: ruby
|
4
4
|
cache: bundler
|
5
5
|
rvm:
|
6
|
-
- 2.
|
6
|
+
- 2.3
|
7
|
+
- 2.5
|
8
|
+
env:
|
9
|
+
global:
|
10
|
+
- CC_TEST_REPORTER_ID: 68143d415b78ff031776504907a575624db07d44ab31095af2ea7a80885cf898
|
7
11
|
before_install: gem install bundler -v 1.16.4
|
12
|
+
before_script:
|
13
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
14
|
+
- chmod +x ./cc-test-reporter
|
15
|
+
- ./cc-test-reporter before-build
|
16
|
+
script:
|
17
|
+
- bundle exec rubocop
|
18
|
+
- bundle exec rspec
|
19
|
+
after_script:
|
20
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rubocop-expert (0.1.
|
4
|
+
rubocop-expert (0.1.1)
|
5
5
|
rubocop (~> 0.58.2)
|
6
6
|
rubocop-rspec (~> 1.29.0)
|
7
7
|
|
@@ -12,7 +12,10 @@ GEM
|
|
12
12
|
byebug (10.0.2)
|
13
13
|
coderay (1.1.2)
|
14
14
|
diff-lcs (1.3)
|
15
|
+
docile (1.3.1)
|
16
|
+
jaro_winkler (1.5.1)
|
15
17
|
jaro_winkler (1.5.1-x86_64-darwin-17)
|
18
|
+
json (2.1.0)
|
16
19
|
method_source (0.9.0)
|
17
20
|
parallel (1.12.1)
|
18
21
|
parser (2.5.1.2)
|
@@ -50,6 +53,11 @@ GEM
|
|
50
53
|
rubocop-rspec (1.29.0)
|
51
54
|
rubocop (>= 0.58.0)
|
52
55
|
ruby-progressbar (1.10.0)
|
56
|
+
simplecov (0.16.1)
|
57
|
+
docile (~> 1.1)
|
58
|
+
json (>= 1.8, < 3)
|
59
|
+
simplecov-html (~> 0.10.0)
|
60
|
+
simplecov-html (0.10.2)
|
53
61
|
unicode-display_width (1.4.0)
|
54
62
|
|
55
63
|
PLATFORMS
|
@@ -61,6 +69,7 @@ DEPENDENCIES
|
|
61
69
|
rake (~> 10.0)
|
62
70
|
rspec (~> 3.0)
|
63
71
|
rubocop-expert!
|
72
|
+
simplecov
|
64
73
|
|
65
74
|
BUNDLED WITH
|
66
75
|
1.16.4
|
data/README.md
CHANGED
@@ -1,11 +1,33 @@
|
|
1
|
-
#
|
1
|
+
# RuboCop::Expert [](https://rubygems.org/gems/rubocop-expert)
|
2
2
|
|
3
|
-
[](LICENSE.txt)
|
4
|
+

|
5
|
+
[](https://travis-ci.org/akouryy/rubocop-expert)
|
6
|
+
[](https://codeclimate.com/github/akouryy/rubocop-expert/maintainability)
|
7
|
+
[](https://codeclimate.com/github/akouryy/rubocop-expert/test_coverage)
|
5
8
|
|
6
9
|
[RuboCop](https://github.com/rubocop-hq/rubocop/) custom cops for elegance.
|
7
10
|
|
8
|
-
|
11
|
+
* [Cops](#cops)
|
12
|
+
* [RedundantParenthesesForMethodCall](#redundantparenthesesformethodcall)
|
13
|
+
* [Installation and Usage](#installation-and-usage)
|
14
|
+
* [License](#license)
|
15
|
+
|
16
|
+
## Cops
|
17
|
+
|
18
|
+
### RedundantParenthesesForMethodCall
|
19
|
+
|
20
|
+
This cop checks for any *redundant* parentheses for method calls even with arguments.
|
21
|
+
```ruby
|
22
|
+
# bad
|
23
|
+
foo(/a/, *b)
|
24
|
+
# good
|
25
|
+
foo /a/, *b
|
26
|
+
```
|
27
|
+
|
28
|
+
For more information and examples, refer to the documentation comment in [redundant_parentheses_for_method_call.rb](lib/rubocop/cop/expert/redundant_parentheses_for_method_call.rb).
|
29
|
+
|
30
|
+
## Installation and Usage
|
9
31
|
|
10
32
|
Add this line to Gemfile:
|
11
33
|
|
@@ -13,8 +35,6 @@ Add this line to Gemfile:
|
|
13
35
|
gem 'rubocop-akouryy'
|
14
36
|
```
|
15
37
|
|
16
|
-
## Usage
|
17
|
-
|
18
38
|
Require this gem in .rubocop.yml:
|
19
39
|
|
20
40
|
```yaml
|
@@ -22,10 +42,11 @@ require:
|
|
22
42
|
- rubocop-expert
|
23
43
|
```
|
24
44
|
|
25
|
-
|
45
|
+
Now you can check your code with:
|
26
46
|
|
27
|
-
|
28
|
-
|
47
|
+
```sh
|
48
|
+
$ rubocop
|
49
|
+
```
|
29
50
|
|
30
51
|
## Development
|
31
52
|
|
@@ -150,6 +150,7 @@ module RuboCop
|
|
150
150
|
return if allowed_by_multiline_config? node
|
151
151
|
add_offense node, location: :begin
|
152
152
|
end
|
153
|
+
alias on_csend on_send
|
153
154
|
|
154
155
|
PARENS_ALLOW_CHECKERS = %i[
|
155
156
|
among_multiple_args?
|
@@ -186,7 +187,7 @@ module RuboCop
|
|
186
187
|
|
187
188
|
private def_node_matcher :among_multiple_args?, <<~PAT
|
188
189
|
^[
|
189
|
-
(send
|
190
|
+
({send csend}
|
190
191
|
!equal?(%0)
|
191
192
|
_
|
192
193
|
_ _ ...) #{'>=2 args; %0 is here' * 0}
|
@@ -199,7 +200,7 @@ module RuboCop
|
|
199
200
|
_ _ ...) #{'>=1 values' * 0}
|
200
201
|
PAT
|
201
202
|
|
202
|
-
private def_node_matcher :arg_s?, '(send _ _ _ ...)' # >=1 args
|
203
|
+
private def_node_matcher :arg_s?, '({send csend} _ _ _ ...)' # >=1 args
|
203
204
|
|
204
205
|
private def_node_matcher :array_element?, '^(array ...)'
|
205
206
|
|
@@ -237,13 +238,15 @@ module RuboCop
|
|
237
238
|
PAT
|
238
239
|
|
239
240
|
private def_node_matcher :dot_receiver?, <<~PAT
|
240
|
-
|
241
|
-
|
241
|
+
{
|
242
|
+
^[
|
243
|
+
(send
|
244
|
+
equal?(%0)
|
245
|
+
...)
|
246
|
+
dot?]
|
247
|
+
^(csend
|
242
248
|
equal?(%0)
|
243
|
-
|
244
|
-
...)
|
245
|
-
dot?
|
246
|
-
]
|
249
|
+
...)}
|
247
250
|
PAT
|
248
251
|
|
249
252
|
private def explicit_receiver? node
|
@@ -253,6 +256,7 @@ module RuboCop
|
|
253
256
|
private def_node_matcher :fn_style?, <<~PAT
|
254
257
|
{
|
255
258
|
(send nil? ...)
|
259
|
+
(csend ...)
|
256
260
|
[
|
257
261
|
(send ...)
|
258
262
|
dot?]}
|
@@ -353,7 +357,7 @@ module RuboCop
|
|
353
357
|
|
354
358
|
private def_node_matcher :with_arg_s_and_brace_block?, <<~PAT
|
355
359
|
[
|
356
|
-
(send _ _ _ ...) #{'>=1 args' * 0}
|
360
|
+
({send csend} _ _ _ ...) #{'>=1 args' * 0}
|
357
361
|
^[
|
358
362
|
(block ...)
|
359
363
|
braces?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-expert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- akouryy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|