rubocop-rake 0.5.1 → 0.6.0

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
  SHA256:
3
- metadata.gz: b71580a8ba42edbae65f9f46e4e5fd2af9e64b4bda2a8eff8a9e719e35ff4ca1
4
- data.tar.gz: 6083afa2054e8ccd3e4148335d663b6872f05cdeca02265601b3a7e4d5b1501a
3
+ metadata.gz: a878d5ccc2eec701b39d7d2ee54cbee2eeafc822d0fdd9ebb1bd24174f62eb6e
4
+ data.tar.gz: 137d23f7a93f25c027872cff22cca183e87b3c57a34b63a970a6687101a2ea69
5
5
  SHA512:
6
- metadata.gz: f71f3e174dae2a4a310483393c506bd3508576d93bfe6e8bd6c7cbf66fbe3104b35ac287f0b69568fb3b169e3ee20ceebb4c77219fbb8c8a9d258cb676ad79a3
7
- data.tar.gz: ecd03e5d7cafc964fe1c501c85d554d07a3bdce600d1ba046cf372fcfbab5c0cde93b7fedf5c9781fdf9274e6c0adfbdd626dd59ac93f9c39e9c9c2f8b3de0cc
6
+ metadata.gz: 67ef6e06e7704cac677af3256d2a14c15729b521a2873d971bf0339eed83bdb04019ea7302cc35b8a461469c52c77382da35d2fca1e7d022cd471a10a832bfa4
7
+ data.tar.gz: 111a3788568c30c1588e4aa4108cce2c5d8a4eae21d9f11d897f19fa44495486933edbd8ca0945d63b8daefcc1551e74e69197a02c7006c1f1bf0f57da79f9fa
data/.circleci/config.yml CHANGED
@@ -8,16 +8,6 @@ steps: &steps
8
8
 
9
9
  jobs:
10
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
11
  ruby-2.5:
22
12
  docker:
23
13
  - image: circleci/ruby:2.5
@@ -33,6 +23,11 @@ jobs:
33
23
  - image: circleci/ruby:2.7
34
24
  <<: *steps
35
25
 
26
+ ruby-3.0:
27
+ docker:
28
+ - image: circleci/ruby:3.0
29
+ <<: *steps
30
+
36
31
  ruby-head:
37
32
  docker:
38
33
  - image: rubocophq/circleci-ruby-snapshot:latest
@@ -42,9 +37,8 @@ workflows:
42
37
  version: 2
43
38
  build:
44
39
  jobs:
45
- - ruby-2.3
46
- - ruby-2.4
47
40
  - ruby-2.5
48
41
  - ruby-2.6
49
42
  - ruby-2.7
43
+ - ruby-3.0
50
44
  - ruby-head
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ .ruby-version
1
2
  /.bundle/
2
3
  /.yardoc
3
4
  /_yardoc/
data/.rubocop.yml CHANGED
@@ -1,11 +1,15 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
3
  require:
4
+ - rubocop/cop/internal_affairs
4
5
  - rubocop-rake
5
6
  - rubocop-rspec
6
7
 
7
8
  AllCops:
8
- TargetRubyVersion: 2.4
9
+ TargetRubyVersion: 2.5
10
+
11
+ InternalAffairs/NodeMatcherDirective:
12
+ Enabled: false
9
13
 
10
14
  Layout/LineLength:
11
15
  Enabled: false
@@ -45,3 +49,8 @@ RSpec/ExampleLength:
45
49
  Naming/FileName:
46
50
  Exclude:
47
51
  - 'lib/rubocop-rake.rb'
52
+
53
+ # This disabling is a workaround for https://github.com/rubocop-hq/rubocop-rspec/issues/1068.
54
+ # The cop has been disabled because FactoryBot is not used in this repository.
55
+ RSpec/FactoryBot/CreateList:
56
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -2,45 +2,54 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ## 0.6.0 (2021-06-29)
6
+
7
+ ### Changes
8
+
9
+ * [#33](https://github.com/rubocop/rubocop-rake/pull/33): Drop support for Ruby 2.3. ([@koic][])
10
+ * [#34](https://github.com/rubocop/rubocop-rake/pull/34): Require RuboCop 1.0 or higher. ([@koic][])
11
+ * [#38](https://github.com/rubocop/rubocop-rake/pull/37): Drop support for Ruby 2.4. ([@tejasbubane])
12
+ * [#36](https://github.com/rubocop/rubocop-rake/issues/36): Fix `Rake/Desc` to not generate offense for prerequisite declarations. ([@tejasbubane][])
13
+
5
14
  ## 0.5.1 (2020-02-14)
6
15
 
7
16
  ### Bug fixes
8
17
 
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][])
18
+ * [#28](https://github.com/rubocop/rubocop-rake/issues/28): Fix `Rake/Desc` to avoid an error when `task` is not a task definition. ([@pocke][])
10
19
 
11
20
  ## 0.5.0 (2019-10-31)
12
21
 
13
22
  ### New features
14
23
 
15
- * [#14](https://github.com/rubocop-hq/rubocop-rake/issues/14): Add Rake/DuplicateNamespace cop. ([@jaruuuu][])
24
+ * [#14](https://github.com/rubocop/rubocop-rake/issues/14): Add Rake/DuplicateNamespace cop. ([@jaruuuu][])
16
25
 
17
26
  ## 0.4.0 (2019-10-13)
18
27
 
19
28
  ### New features
20
29
 
21
- * [#13](https://github.com/rubocop-hq/rubocop-rake/issues/13): Add Rake/DuplicateTask cop. ([@pocke][])
30
+ * [#13](https://github.com/rubocop/rubocop-rake/issues/13): Add Rake/DuplicateTask cop. ([@pocke][])
22
31
 
23
32
  ## 0.3.1 (2019-10-06)
24
33
 
25
34
  ### Bug fixes
26
35
 
27
- * [#17](https://github.com/rubocop-hq/rubocop-rake/pull/17): Filter target files for Rake/ClassDefinitionInTask cop. ([@pocke][])
36
+ * [#17](https://github.com/rubocop/rubocop-rake/pull/17): Filter target files for Rake/ClassDefinitionInTask cop. ([@pocke][])
28
37
 
29
38
  ## 0.3.0 (2019-09-25)
30
39
 
31
40
  ### New features
32
41
 
33
- * [#6](https://github.com/rubocop-hq/rubocop-rake/issues/6): Add `Rake/ClassDefinitionInTask` cop. ([@pocke][])
42
+ * [#6](https://github.com/rubocop/rubocop-rake/issues/6): Add `Rake/ClassDefinitionInTask` cop. ([@pocke][])
34
43
 
35
44
  ### Bug fixes
36
45
 
37
- * [#8](https://github.com/rubocop-hq/rubocop-rake/issues/8): Make Rake/Desc to not require description for the default task. ([@pocke][])
46
+ * [#8](https://github.com/rubocop/rubocop-rake/issues/8): Make Rake/Desc to not require description for the default task. ([@pocke][])
38
47
 
39
48
  ## 0.2.0 (2019-09-17)
40
49
 
41
50
  ### New features
42
51
 
43
- * [#5](https://github.com/rubocop-hq/rubocop-rake/pull/5): Add `Rake/MethodDefinitionInTask`. ([@pocke][])
52
+ * [#5](https://github.com/rubocop/rubocop-rake/pull/5): Add `Rake/MethodDefinitionInTask`. ([@pocke][])
44
53
 
45
54
  ## 0.1.0 (2019-09-04)
46
55
 
@@ -51,3 +60,5 @@
51
60
 
52
61
  [@pocke]: https://github.com/pocke
53
62
  [@jaruuuu]: https://github.com/jaruuuu
63
+ [@koic]: https://github.com/koic
64
+ [@tejasbubane]: https://github.com/tejasbubane
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
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)
2
+ [![CircleCI](https://circleci.com/gh/rubocop/rubocop-rake.svg?style=svg)](https://circleci.com/gh/rubocop/rubocop-rake)
3
3
 
4
4
  # RuboCop Rake
5
5
 
6
- A [RuboCop](https://github.com/rubocop-hq/rubocop) plugin for Rake.
6
+ A [RuboCop](https://github.com/rubocop/rubocop) plugin for Rake.
7
7
 
8
8
  ## Installation
9
9
 
@@ -37,5 +37,5 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
37
37
 
38
38
  ## Contributing
39
39
 
40
- Bug reports and pull requests are welcome on GitHub at https://github.com/rubocop-hq/rubocop-rake.
40
+ Bug reports and pull requests are welcome on GitHub at https://github.com/rubocop/rubocop-rake.
41
41
 
@@ -28,18 +28,14 @@ module RuboCop
28
28
  # task :foo do
29
29
  # end
30
30
  #
31
- class ClassDefinitionInTask < Cop
31
+ class ClassDefinitionInTask < Base
32
32
  MSG = 'Do not define a %<type>s in rake task, because it will be defined to the top level.'
33
33
 
34
34
  def on_class(node)
35
35
  return if Helper::ClassDefinition.in_class_definition?(node)
36
36
  return unless Helper::TaskDefinition.in_task_or_namespace?(node)
37
37
 
38
- add_offense(node)
39
- end
40
-
41
- def message(node)
42
- format(MSG, type: node.type)
38
+ add_offense(node, message: format(MSG, type: node.type))
43
39
  end
44
40
 
45
41
  alias on_module on_class
@@ -27,15 +27,23 @@ module RuboCop
27
27
  # task :do_something do
28
28
  # end
29
29
  #
30
- class Desc < Cop
30
+ class Desc < Base
31
31
  include Helper::OnTask
32
+ extend AutoCorrector
32
33
 
33
34
  MSG = 'Describe the task with `desc` method.'
34
35
 
36
+ def_node_matcher :prerequisites, <<~PATTERN
37
+ (send nil? :task (hash (pair _ $_)))
38
+ PATTERN
39
+
35
40
  def on_task(node)
36
41
  return if task_with_desc?(node)
37
42
  return if Helper::TaskName.task_name(node) == :default
38
43
 
44
+ requirements = prerequisites(node)
45
+ return if requirements&.array_type?
46
+
39
47
  add_offense(node)
40
48
  end
41
49
 
@@ -48,7 +56,7 @@ module RuboCop
48
56
  desc_candidate = parent.children[idx]
49
57
  return false unless desc_candidate
50
58
 
51
- desc_candidate.send_type? && desc_candidate.method_name == :desc
59
+ desc_candidate.send_type? && desc_candidate.method?(:desc)
52
60
  end
53
61
 
54
62
  private def parent_and_task(task_node)
@@ -27,7 +27,7 @@ module RuboCop
27
27
  # end
28
28
  # end
29
29
  #
30
- class DuplicateNamespace < Cop
30
+ class DuplicateNamespace < Base
31
31
  include Helper::OnNamespace
32
32
 
33
33
  MSG = 'Namespace `%<namespace>s` is defined at both %<previous>s and %<current>s.'
@@ -55,7 +55,7 @@ module RuboCop
55
55
 
56
56
  node.each_ancestor(:block) do |block_node|
57
57
  send_node = block_node.send_node
58
- next unless send_node.method_name == :namespace
58
+ next unless send_node.method?(:namespace)
59
59
 
60
60
  name = Helper::TaskName.task_name(send_node)
61
61
  ns << name
@@ -23,7 +23,7 @@ module RuboCop
23
23
  # p 'foo 2'
24
24
  # end
25
25
  #
26
- class DuplicateTask < Cop
26
+ class DuplicateTask < Base
27
27
  include Helper::OnTask
28
28
 
29
29
  MSG = 'Task `%<task>s` is defined at both %<previous>s and %<current>s.'
@@ -54,7 +54,7 @@ module RuboCop
54
54
 
55
55
  node.each_ancestor(:block) do |block_node|
56
56
  send_node = block_node.send_node
57
- next unless send_node.method_name == :namespace
57
+ next unless send_node.method?(:namespace)
58
58
 
59
59
  name = Helper::TaskName.task_name(send_node)
60
60
  ns << name
@@ -30,7 +30,7 @@ module RuboCop
30
30
  # task :foo do
31
31
  # end
32
32
  #
33
- class MethodDefinitionInTask < Cop
33
+ class MethodDefinitionInTask < Base
34
34
  MSG = 'Do not define a method in rake task, because it will be defined to the top level.'
35
35
 
36
36
  def on_def(node)
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # The original code is from https://github.com/rubocop-hq/rubocop-rspec/blob/master/lib/rubocop/rspec/inject.rb
4
- # See https://github.com/rubocop-hq/rubocop-rspec/blob/master/MIT-LICENSE.md
3
+ # The original code is from https://github.com/rubocop/rubocop-rspec/blob/master/lib/rubocop/rspec/inject.rb
4
+ # See https://github.com/rubocop/rubocop-rspec/blob/master/MIT-LICENSE.md
5
5
  module RuboCop
6
6
  module Rake
7
7
  # Because RuboCop doesn't yet support plugins, we have to monkey patch in a
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Rake
5
- VERSION = "0.5.1"
5
+ VERSION = "0.6.0"
6
6
  end
7
7
  end
data/rubocop-rake.gemspec CHANGED
@@ -10,15 +10,15 @@ Gem::Specification.new do |spec|
10
10
 
11
11
  spec.summary = %q{A RuboCop plugin for Rake}
12
12
  spec.description = %q{A RuboCop plugin for Rake}
13
- spec.homepage = "https://github.com/rubocop-hq/rubocop-rake"
14
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
13
+ spec.homepage = "https://github.com/rubocop/rubocop-rake"
14
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
15
15
  spec.licenses = ['MIT']
16
16
 
17
17
  spec.metadata["allowed_push_host"] = "https://rubygems.org"
18
18
 
19
19
  spec.metadata["homepage_uri"] = spec.homepage
20
20
  spec.metadata["source_code_uri"] = spec.homepage
21
- spec.metadata["changelog_uri"] = "https://github.com/rubocop-hq/rubocop-rake/blob/master/CHANGELOG.md"
21
+ spec.metadata["changelog_uri"] = "https://github.com/rubocop/rubocop-rake/blob/master/CHANGELOG.md"
22
22
 
23
23
  # Specify which files should be added to the gem when it is released.
24
24
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -29,5 +29,5 @@ Gem::Specification.new do |spec|
29
29
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
30
  spec.require_paths = ["lib"]
31
31
 
32
- spec.add_runtime_dependency 'rubocop'
32
+ spec.add_runtime_dependency 'rubocop', '~> 1.0'
33
33
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-rake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masataka Pocke Kuwabara
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-14 00:00:00.000000000 Z
11
+ date: 2021-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '1.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '1.0'
27
27
  description: A RuboCop plugin for Rake
28
28
  email:
29
29
  - kuwabara@pocke.me
@@ -60,15 +60,15 @@ files:
60
60
  - lib/rubocop/rake/inject.rb
61
61
  - lib/rubocop/rake/version.rb
62
62
  - rubocop-rake.gemspec
63
- homepage: https://github.com/rubocop-hq/rubocop-rake
63
+ homepage: https://github.com/rubocop/rubocop-rake
64
64
  licenses:
65
65
  - MIT
66
66
  metadata:
67
67
  allowed_push_host: https://rubygems.org
68
- homepage_uri: https://github.com/rubocop-hq/rubocop-rake
69
- source_code_uri: https://github.com/rubocop-hq/rubocop-rake
70
- changelog_uri: https://github.com/rubocop-hq/rubocop-rake/blob/master/CHANGELOG.md
71
- post_install_message:
68
+ homepage_uri: https://github.com/rubocop/rubocop-rake
69
+ source_code_uri: https://github.com/rubocop/rubocop-rake
70
+ changelog_uri: https://github.com/rubocop/rubocop-rake/blob/master/CHANGELOG.md
71
+ post_install_message:
72
72
  rdoc_options: []
73
73
  require_paths:
74
74
  - lib
@@ -76,15 +76,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
76
76
  requirements:
77
77
  - - ">="
78
78
  - !ruby/object:Gem::Version
79
- version: 2.3.0
79
+ version: 2.5.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.2.0.pre1
87
- signing_key:
86
+ rubygems_version: 3.2.13
87
+ signing_key:
88
88
  specification_version: 4
89
89
  summary: A RuboCop plugin for Rake
90
90
  test_files: []