rubocop-rake 0.5.0 → 0.5.1

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: 2b6574fbdd64dbe9c5df47c71132c17feb7b0399491902c8e01480e333a361ec
4
- data.tar.gz: d24998e7452dbd98f07f29b63db9fc7a10392f6d91244b8eec333afdb3484ef8
3
+ metadata.gz: b71580a8ba42edbae65f9f46e4e5fd2af9e64b4bda2a8eff8a9e719e35ff4ca1
4
+ data.tar.gz: 6083afa2054e8ccd3e4148335d663b6872f05cdeca02265601b3a7e4d5b1501a
5
5
  SHA512:
6
- metadata.gz: 0d56524f419e37ee6d62469f3cc7a1b940d62793673bfd51fa8b86f991adf6adfeed20dcb7d0f17297defe1eb334bbe2fa6654dfcfeba0828740caf19755aafc
7
- data.tar.gz: b331328c525c4c441277e96f2eec388360c2648469da9cbe86ce1b1adb6ab814f20425002288c5c378906d1d15a37b7db3b37eabedd861177da55ed12826c3e8
6
+ metadata.gz: f71f3e174dae2a4a310483393c506bd3508576d93bfe6e8bd6c7cbf66fbe3104b35ac287f0b69568fb3b169e3ee20ceebb4c77219fbb8c8a9d258cb676ad79a3
7
+ data.tar.gz: ecd03e5d7cafc964fe1c501c85d554d07a3bdce600d1ba046cf372fcfbab5c0cde93b7fedf5c9781fdf9274e6c0adfbdd626dd59ac93f9c39e9c9c2f8b3de0cc
@@ -0,0 +1,50 @@
1
+ version: 2
2
+
3
+ steps: &steps
4
+ steps:
5
+ - checkout
6
+ - run: bundle install
7
+ - run: bundle exec rake
8
+
9
+ jobs:
10
+
11
+ ruby-2.3:
12
+ docker:
13
+ - image: circleci/ruby:2.3
14
+ <<: *steps
15
+
16
+ ruby-2.4:
17
+ docker:
18
+ - image: circleci/ruby:2.4
19
+ <<: *steps
20
+
21
+ ruby-2.5:
22
+ docker:
23
+ - image: circleci/ruby:2.5
24
+ <<: *steps
25
+
26
+ ruby-2.6:
27
+ docker:
28
+ - image: circleci/ruby:2.6
29
+ <<: *steps
30
+
31
+ ruby-2.7:
32
+ docker:
33
+ - image: circleci/ruby:2.7
34
+ <<: *steps
35
+
36
+ ruby-head:
37
+ docker:
38
+ - image: rubocophq/circleci-ruby-snapshot:latest
39
+ <<: *steps
40
+
41
+ workflows:
42
+ version: 2
43
+ build:
44
+ jobs:
45
+ - ruby-2.3
46
+ - ruby-2.4
47
+ - ruby-2.5
48
+ - ruby-2.6
49
+ - ruby-2.7
50
+ - ruby-head
@@ -7,6 +7,9 @@ require:
7
7
  AllCops:
8
8
  TargetRubyVersion: 2.4
9
9
 
10
+ Layout/LineLength:
11
+ Enabled: false
12
+
10
13
  Metrics:
11
14
  Enabled: false
12
15
 
@@ -2,15 +2,11 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
- <!--
6
-
7
- ### New features
5
+ ## 0.5.1 (2020-02-14)
8
6
 
9
7
  ### Bug fixes
10
8
 
11
- ### Changes
12
-
13
- -->
9
+ * [#28](https://github.com/rubocop-hq/rubocop-rake/issues/28): Fix `Rake/Desc` to avoid an error when `task` is not a task definition. ([@pocke][])
14
10
 
15
11
  ## 0.5.0 (2019-10-31)
16
12
 
data/README.md CHANGED
@@ -1,3 +1,6 @@
1
+ [![Gem Version](https://badge.fury.io/rb/rubocop-rake.svg)](https://rubygems.org/gems/rubocop-rake)
2
+ [![CircleCI](https://circleci.com/gh/rubocop-hq/rubocop-rake.svg?style=svg)](https://circleci.com/gh/rubocop-hq/rubocop-rake)
3
+
1
4
  # RuboCop Rake
2
5
 
3
6
  A [RuboCop](https://github.com/rubocop-hq/rubocop) plugin for Rake.
@@ -7,7 +10,7 @@ A [RuboCop](https://github.com/rubocop-hq/rubocop) plugin for Rake.
7
10
  Add this line to your application's Gemfile:
8
11
 
9
12
  ```ruby
10
- gem 'rubocop-rake'
13
+ gem 'rubocop-rake', require: false
11
14
  ```
12
15
 
13
16
  And then execute:
@@ -42,6 +42,7 @@ module RuboCop
42
42
  private def task_with_desc?(node)
43
43
  parent, task = parent_and_task(node)
44
44
  return false unless parent
45
+ return true unless can_insert_desc_to?(parent)
45
46
 
46
47
  idx = parent.children.find_index(task) - 1
47
48
  desc_candidate = parent.children[idx]
@@ -55,15 +56,17 @@ module RuboCop
55
56
  return nil, task_node unless parent
56
57
  return parent, task_node unless parent.block_type?
57
58
 
58
- # rubocop:disable Style/GuardClause
59
59
  if parent.children.find_index(task_node) == 0
60
60
  # when task {}
61
- return parent.parent, parent
61
+ [parent.parent, parent]
62
62
  else
63
63
  # when something { task }
64
- return parent, task_node
64
+ [parent, task_node]
65
65
  end
66
- # rubocop:enable Style/GuardClause
66
+ end
67
+
68
+ private def can_insert_desc_to?(parent)
69
+ parent.begin_type? || parent.block_type? || parent.kwbegin_type?
67
70
  end
68
71
  end
69
72
  end
@@ -11,7 +11,7 @@ module RuboCop
11
11
  first_arg = node.arguments[0]
12
12
  case first_arg&.type
13
13
  when :sym, :str
14
- return first_arg.value.to_sym
14
+ first_arg.value.to_sym
15
15
  when :hash
16
16
  return nil if first_arg.children.size != 1
17
17
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Rake
5
- VERSION = "0.5.0"
5
+ VERSION = "0.5.1"
6
6
  end
7
7
  end
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.summary = %q{A RuboCop plugin for Rake}
12
12
  spec.description = %q{A RuboCop plugin for Rake}
13
13
  spec.homepage = "https://github.com/rubocop-hq/rubocop-rake"
14
- spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
14
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
15
15
  spec.licenses = ['MIT']
16
16
 
17
17
  spec.metadata["allowed_push_host"] = "https://rubygems.org"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-rake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masataka Pocke Kuwabara
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-31 00:00:00.000000000 Z
11
+ date: 2020-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -31,11 +31,11 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
+ - ".circleci/config.yml"
34
35
  - ".gitignore"
35
36
  - ".rspec"
36
37
  - ".rubocop.yml"
37
38
  - ".rubocop_todo.yml"
38
- - ".travis.yml"
39
39
  - CHANGELOG.md
40
40
  - Gemfile
41
41
  - LICENSE
@@ -76,14 +76,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
76
76
  requirements:
77
77
  - - ">="
78
78
  - !ruby/object:Gem::Version
79
- version: 2.4.0
79
+ version: 2.3.0
80
80
  required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  requirements:
82
82
  - - ">="
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  requirements: []
86
- rubygems_version: 3.0.3
86
+ rubygems_version: 3.2.0.pre1
87
87
  signing_key:
88
88
  specification_version: 4
89
89
  summary: A RuboCop plugin for Rake
@@ -1,22 +0,0 @@
1
- language: ruby
2
-
3
- rvm:
4
- - 2.4.7
5
- - 2.5.6
6
- - 2.6.4
7
- - ruby-head
8
-
9
- cache: bundler
10
- bundler_args: --jobs=4 --retry=3
11
- sudo: false
12
-
13
-
14
- before_install: 'gem update --system'
15
-
16
- script:
17
- - bundle exec rake
18
-
19
- matrix:
20
- allow_failures:
21
- - rvm: ruby-head
22
- fast_finish: true