rubocop_challenger 2.2.0 → 2.3.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: 9de614d27c025b681596e5f3e59cfdd0faf220647f6d5f74b5ba1d1b6e3c4714
4
- data.tar.gz: 7a7f66167b732e1db0c24dc764f568ebf65f8379cfa8f00ea77e16f3659fa075
3
+ metadata.gz: bde919f42750c43651a3ba58f00ef400b79f7cea3f0c2ff1b64881f6ee102a8d
4
+ data.tar.gz: ff457584a6703667d588d6f744762f1219f23a64eee85c0e09fdd471fef734ca
5
5
  SHA512:
6
- metadata.gz: 4b808e5e3d05bed8fc1793d812eded0b17168d392ae0219bdfe96ccb5a1be77cdc9bb96e3d33b40c91f8f1deb354cec555fdd563f5e2f1c5b4c3fd53b774e9ab
7
- data.tar.gz: 128d208942ccd3d8d198a4bdf506428e0efcfb766d898fc6e606b1cc6fe2f445be63269ac1742ed80e731c8c2a621b90f63af8afb03d33bc24eb28e3835d4225
6
+ metadata.gz: 82858f597d72c55790f1766d8bfb804afd74aac984579d83e05e4fc2c5db0c36a8b6259c614f4155b4e636963aeb19e0ce1c09ea7f709f594500838fec5615e2
7
+ data.tar.gz: d36e502a7cc7aace9ed87440cc19b8f1b025141c8c769787f85fda86285b903793458cbf96cbe32580af57098f35e361adb4e253d8c7770c3709a536e8b10e92
data/.circleci/config.yml CHANGED
@@ -5,7 +5,7 @@
5
5
  version: 2.1
6
6
 
7
7
  orbs:
8
- ruby-orbs: sue445/ruby-orbs@1.6.1
8
+ ruby-orbs: sue445/ruby-orbs@1.6.2
9
9
  code-climate: rvla/code-climate@0.0.2
10
10
 
11
11
  references:
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config --exclude-limit 30 --no-auto-gen-timestamp`
3
- # using RuboCop version 1.8.0.
3
+ # using RuboCop version 1.10.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Change log
2
2
 
3
+ ## v2.3.0 (Feb 23, 2021)
4
+
5
+ ### Feature
6
+
7
+ * [#465](https://github.com/ryz310/rubocop_challenger/pull/465) Add description whether the challenge is created by safe autocorrect or not ([@ryz310](https://github.com/ryz310))
8
+
9
+ ### Rubocop Challenge
10
+
11
+ * [#464](https://github.com/ryz310/rubocop_challenger/pull/464) Re-generate .rubocop_todo.yml with RuboCop v1.10.0 ([@ryz310](https://github.com/ryz310))
12
+
13
+ ### Dependabot
14
+
15
+ * [#453](https://github.com/ryz310/rubocop_challenger/pull/453) ryz310/dependabot/bundler/thor-1.1.0 ([@ryz310](https://github.com/ryz310))
16
+ * [#457](https://github.com/ryz310/rubocop_challenger/pull/457) ryz310/dependabot/bundler/rubocop-1.9.1 ([@ryz310](https://github.com/ryz310))
17
+ * [#461](https://github.com/ryz310/rubocop_challenger/pull/461) Update ruby-orbs orb to v1.6.2 ([@ryz310](https://github.com/ryz310))
18
+
3
19
  ## v2.2.0 (Jan 11, 2021)
4
20
 
5
21
  ### Feature
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rubocop_challenger (2.2.0)
4
+ rubocop_challenger (2.3.0)
5
5
  pr_comet (~> 0.5.1)
6
6
  rainbow
7
7
  rubocop (>= 0.87)
@@ -15,7 +15,7 @@ PATH
15
15
  GEM
16
16
  remote: https://rubygems.org/
17
17
  specs:
18
- activesupport (6.1.1)
18
+ activesupport (6.1.3)
19
19
  concurrent-ruby (~> 1.0, >= 1.0.2)
20
20
  i18n (>= 1.6, < 2)
21
21
  minitest (>= 5.1)
@@ -23,18 +23,18 @@ GEM
23
23
  zeitwerk (~> 2.3)
24
24
  addressable (2.7.0)
25
25
  public_suffix (>= 2.0.2, < 5.0)
26
- ast (2.4.1)
26
+ ast (2.4.2)
27
27
  byebug (11.1.3)
28
28
  coderay (1.1.3)
29
- concurrent-ruby (1.1.7)
29
+ concurrent-ruby (1.1.8)
30
30
  diff-lcs (1.4.4)
31
- docile (1.3.4)
31
+ docile (1.3.5)
32
32
  faraday (1.3.0)
33
33
  faraday-net_http (~> 1.0)
34
34
  multipart-post (>= 1.2, < 3)
35
35
  ruby2_keywords
36
- faraday-net_http (1.0.0)
37
- i18n (1.8.7)
36
+ faraday-net_http (1.0.1)
37
+ i18n (1.8.9)
38
38
  concurrent-ruby (~> 1.0)
39
39
  method_source (1.0.0)
40
40
  minitest (5.14.3)
@@ -58,7 +58,7 @@ GEM
58
58
  rack (2.2.3)
59
59
  rainbow (3.0.0)
60
60
  rake (13.0.3)
61
- regexp_parser (2.0.3)
61
+ regexp_parser (2.1.0)
62
62
  rexml (3.2.4)
63
63
  rspec (3.10.0)
64
64
  rspec-core (~> 3.10.0)
@@ -69,13 +69,13 @@ GEM
69
69
  rspec-expectations (3.10.1)
70
70
  diff-lcs (>= 1.2.0, < 2.0)
71
71
  rspec-support (~> 3.10.0)
72
- rspec-mocks (3.10.1)
72
+ rspec-mocks (3.10.2)
73
73
  diff-lcs (>= 1.2.0, < 2.0)
74
74
  rspec-support (~> 3.10.0)
75
- rspec-support (3.10.1)
75
+ rspec-support (3.10.2)
76
76
  rspec_junit_formatter (0.4.1)
77
77
  rspec-core (>= 2, < 4, != 2.12.0)
78
- rubocop (1.8.1)
78
+ rubocop (1.10.0)
79
79
  parallel (~> 1.10)
80
80
  parser (>= 3.0.0.0)
81
81
  rainbow (>= 2.2.2, < 4.0)
@@ -84,7 +84,7 @@ GEM
84
84
  rubocop-ast (>= 1.2.0, < 2.0)
85
85
  ruby-progressbar (~> 1.7)
86
86
  unicode-display_width (>= 1.4.0, < 3.0)
87
- rubocop-ast (1.4.0)
87
+ rubocop-ast (1.4.1)
88
88
  parser (>= 2.7.1.5)
89
89
  rubocop-performance (1.9.2)
90
90
  rubocop (>= 0.90.0, < 2.0)
@@ -95,11 +95,11 @@ GEM
95
95
  rubocop (>= 0.90.0, < 2.0)
96
96
  rubocop-rake (0.5.1)
97
97
  rubocop
98
- rubocop-rspec (2.1.0)
98
+ rubocop-rspec (2.2.0)
99
99
  rubocop (~> 1.0)
100
100
  rubocop-ast (>= 1.1.0)
101
101
  ruby-progressbar (1.11.0)
102
- ruby2_keywords (0.0.2)
102
+ ruby2_keywords (0.0.4)
103
103
  sawyer (0.8.2)
104
104
  addressable (>= 2.3.5)
105
105
  faraday (> 0.8, < 2.0)
@@ -109,7 +109,7 @@ GEM
109
109
  simplecov_json_formatter (~> 0.1)
110
110
  simplecov-html (0.12.3)
111
111
  simplecov_json_formatter (0.1.2)
112
- thor (1.0.1)
112
+ thor (1.1.0)
113
113
  tzinfo (2.0.4)
114
114
  concurrent-ruby (~> 1.0)
115
115
  unicode-display_width (2.0.0)
@@ -53,6 +53,10 @@ module RubocopChallenger
53
53
  yardoc.examples
54
54
  end
55
55
 
56
+ def safe_autocorrect?
57
+ yardoc.safe_autocorrect?
58
+ end
59
+
56
60
  def yardoc
57
61
  @yardoc ||= Rubocop::Yardoc.new(title)
58
62
  end
@@ -4,12 +4,10 @@ module RubocopChallenger
4
4
  module Rubocop
5
5
  # To read YARD style documentation from rubocop gem source code
6
6
  class Yardoc
7
- def initialize(title)
7
+ def initialize(cop)
8
8
  load_rspec_gems!
9
- @cop_class = find_cop_class(title)
10
- YARD.parse(source_file_path)
11
- @yardoc = YARD::Registry.all(:class).first
12
- YARD::Registry.clear
9
+ @cop_class = find_cop_class(cop)
10
+ load_yardoc!
13
11
  end
14
12
 
15
13
  def description
@@ -20,6 +18,15 @@ module RubocopChallenger
20
18
  yardoc.tags('example').map { |tag| [tag.name, tag.text] }
21
19
  end
22
20
 
21
+ # Indicates whether the auto-correct a cop does is safe (equivalent) by design.
22
+ # If a cop is unsafe its auto-correct automatically becomes unsafe as well.
23
+ #
24
+ # @return [Boolean]
25
+ def safe_autocorrect?
26
+ config = RuboCop::ConfigLoader.default_configuration
27
+ cop_class.new(config).safe_autocorrect?
28
+ end
29
+
23
30
  private
24
31
 
25
32
  attr_reader :cop_class, :yardoc
@@ -36,12 +43,19 @@ module RubocopChallenger
36
43
  # Find a RuboCop class by cop name. It find from rubocop/rspec if cannot
37
44
  # find any class from rubocop gem.
38
45
  #
39
- # @param cop_name [String] The target cop name
40
- # @return [Class] Found RuboCop class
41
- def find_cop_class(cop_name)
42
- Object.const_get("RuboCop::Cop::#{cop_name.sub('/', '::')}")
46
+ # @param cop [String] The target cop name (e.g. "Performance/Size")
47
+ # @return [RuboCop::Cop] Found a RuboCop::Cop class
48
+ def find_cop_class(cop)
49
+ Object.const_get("RuboCop::Cop::#{cop.sub('/', '::')}")
43
50
  rescue NameError
44
- Object.const_get("RuboCop::Cop::RSpec::#{cop_name.sub('/', '::')}")
51
+ Object.const_get("RuboCop::Cop::RSpec::#{cop.sub('/', '::')}")
52
+ end
53
+
54
+ # Loads yardoc from the RuboCop::Cop class file
55
+ def load_yardoc!
56
+ YARD.parse(source_file_path)
57
+ @yardoc = YARD::Registry.all(:class).first
58
+ YARD::Registry.clear
45
59
  end
46
60
 
47
61
  def instance_methods
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubocopChallenger
4
- VERSION = '2.2.0'
4
+ VERSION = '2.3.0'
5
5
  end
@@ -2,6 +2,14 @@
2
2
 
3
3
  [<%= title %>](<%= rubydoc_url %>)
4
4
 
5
+ <% if safe_autocorrect? -%>
6
+ **Safe autocorrect: true**
7
+ :white_check_mark: The auto-correct a cop does is safe (equivalent) by design.
8
+ <% else -%>
9
+ **Safe autocorrect: false**
10
+ :warning: The auto-correct a cop can yield false positives by design.
11
+ <% end -%>
12
+
5
13
  ## Description
6
14
 
7
15
  > ### Overview
@@ -2,6 +2,14 @@
2
2
 
3
3
  [<%= title %>](<%= rubydoc_url %>)
4
4
 
5
+ <% if safe_autocorrect? -%>
6
+ **Safe autocorrect: true**
7
+ :white_check_mark: The auto-correct a cop does is safe (equivalent) by design.
8
+ <% else -%>
9
+ **Safe autocorrect: false**
10
+ :warning: The auto-correct a cop can yield false positives by design.
11
+ <% end -%>
12
+
5
13
  ## Description
6
14
 
7
15
  > ### Overview
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## Description
6
6
 
7
- Sorry! Something went wrong! :bow:
7
+ Failed to create the cop description.
8
8
  Please report bugs [here](https://github.com/ryz310/rubocop_challenger/issues/new?assignees=ryz310&labels=bug&template=bug_report.md) with following error information.
9
9
 
10
10
  ```
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop_challenger
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ryosuke_sato
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-11 00:00:00.000000000 Z
11
+ date: 2021-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pr_comet