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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe20794a04bdfc3cbc23a95d0ca85fbd3ef6f767049647a132f8ed47cf26c033
4
- data.tar.gz: cf4f4e5aaecbc5ca138d7a0ca6fdf2df7db1b804b201c3a12f6efe0082e9a28d
3
+ metadata.gz: 60b8509883369fbd154a5f436959f405ef456a2c4408cd94532a00b8bad6de16
4
+ data.tar.gz: c5fa3408ecec3d4f86dfbf84e08a417e8f88b939fec6f0a099da7d81a2efac7d
5
5
  SHA512:
6
- metadata.gz: 5963fdad27ed7ed602f0b92b825f28943097b4323e41b38821a84c8eac5eab34176f439a72f938bbc0b69354c885ae207819a445b84b4c34b3fb7ff2b1ce06c8
7
- data.tar.gz: bf452bcc544e79fd1d4b5e2993454919188a7eac3153b4393f288251ccc811fef2f0637a25b153554138ddfb20ac03494edb59678ce7651026de99769c454d44
6
+ metadata.gz: 71b246160ac1a8819f52d10d88d9fe74fdb631bfe7750be9d852529b1f17cd152e4a34bdc9effc6d45715d041672e195e1a77ecfc7d19ed5f9fb89537bb695b2
7
+ data.tar.gz: '0846c330f4336ea4e4a2aeb4729ed88eab59baa96ba5cab83458f9504cff33bb897b902da778bbe357d6cbd82545e424b0b7af35d7f9d3c1025054cc8fbe80e1'
@@ -3,5 +3,18 @@ sudo: false
3
3
  language: ruby
4
4
  cache: bundler
5
5
  rvm:
6
- - 2.5.1
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
@@ -6,3 +6,7 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
6
6
 
7
7
  # Specify your gem's dependencies in rubocop-expert.gemspec
8
8
  gemspec
9
+
10
+ group :test do
11
+ gem 'simplecov', require: false
12
+ end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rubocop-expert (0.1.0)
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
- # Rubocop::Expert
1
+ # RuboCop::Expert [![Gem](https://img.shields.io/gem/v/rubocop-expert.svg?logo=ruby&logoColor=ff1111&colorA=404040)](https://rubygems.org/gems/rubocop-expert)
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/rubocop-expert.svg)](https://badge.fury.io/rb/rubocop-expert)
4
- [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.txt)
3
+ [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?logo=github&logoColor=ffffff&colorA=404040)](LICENSE.txt)
4
+ ![Ruby Versions](https://img.shields.io/badge/Ruby-2.3_--_2.5-red.svg?logo=ruby&colorA=404040)
5
+ [![Travis CI](https://img.shields.io/travis/akouryy/rubocop-expert.svg?logo=travis&colorA=404040)](https://travis-ci.org/akouryy/rubocop-expert)
6
+ [![Maintainability](https://img.shields.io/codeclimate/maintainability-percentage/akouryy/rubocop-expert.svg?colorA=404040&logoColor=ffffff)](https://codeclimate.com/github/akouryy/rubocop-expert/maintainability)
7
+ [![Test Coverage](https://img.shields.io/codeclimate/coverage/akouryy/rubocop-expert.svg?colorA=404040&logoColor=ffffff)](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
- ## Installation
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
- ### Cops
45
+ Now you can check your code with:
26
46
 
27
- The list and documentation of cops are available at
28
- [/lib/rubocop/cop/expert](https://github.com/akouryy/rubocop-expert/tree/master/lib/rubocop/cop/expert).
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
- (send
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?
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Expert
5
- VERSION = '0.1.1'
5
+ VERSION = '0.1.2'
6
6
  end
7
7
  end
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.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-08-31 00:00:00.000000000 Z
11
+ date: 2018-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop