rubocop_todo_corrector 0.11.0 → 0.13.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: 1a5761497cb2e78d59de2fed8ce2abc7edd84bc318f6d70483ea1f4f9363a4a4
4
- data.tar.gz: 1f310cfb7f1479f454914e3cbe1e40b065851c4e6978b484f2d617cd69df7d6c
3
+ metadata.gz: 3e370ea5e7275cba3675a1e5ebae1aababaddb87917bb7ac5507efb6b3e5fb79
4
+ data.tar.gz: 5a235861dbdf945bf4fd1a3c271cedb2f08e76397706d2f48e16adec0e94e8a4
5
5
  SHA512:
6
- metadata.gz: 227d12206f9b090ba98cae89ac3e960c1f6e1d61a8bcffe501c093ccffca1dd68b7121659977bc7835f1270994c3f63914f0e14bcd5cd040b66d699926339620
7
- data.tar.gz: d88f4a1733519d7e0f5659ae62474bd0c37c2b06d0284b64fdd94d3a210ac99655a666ce3ab8bdb67cce6118c7f57edcaba7f83cb5de13e52a30523c4b9957b7
6
+ metadata.gz: 55cd6960281b726f3cd5ab258d112c2fbbe8d589fd57045ce1186b06af17502883a591709fcc40f7ac773b785f05a01784a35f6a641d21de01f6334d0cef829a
7
+ data.tar.gz: a05b1ca686adb83f7eae952c0357109b0f18973f0e85965468518264b89b1a531a071d387a7209226837f66abef89680c2b43fac90daa1aa181f2cd63fae6da1
data/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.12.0 - 2022-08-08
6
+
7
+ ### Added
8
+
9
+ - Add Safety section if `@safety` YARD tag is written in Cop class.
10
+
11
+ ## 0.11.1 - 2022-08-03
12
+
13
+ ### Fixed
14
+
15
+ - Fix `describe` command on more than three nested cop class.
16
+
5
17
  ## 0.11.0 - 2022-07-29
6
18
 
7
19
  ### Changed
data/Gemfile.lock CHANGED
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rubocop_todo_corrector (0.11.0)
4
+ rubocop_todo_corrector (0.13.0)
5
+ asciidoctor
5
6
  bundler
6
7
  thor
7
8
  yard
@@ -9,6 +10,7 @@ PATH
9
10
  GEM
10
11
  remote: https://rubygems.org/
11
12
  specs:
13
+ asciidoctor (2.0.17)
12
14
  ast (2.4.2)
13
15
  diff-lcs (1.5.0)
14
16
  parallel (1.22.1)
data/README.md CHANGED
@@ -3,7 +3,9 @@
3
3
  [![test](https://github.com/r7kamura/rubocop_todo_corrector/actions/workflows/test.yml/badge.svg)](https://github.com/r7kamura/rubocop_todo_corrector/actions/workflows/test.yml)
4
4
  [![Gem Version](https://badge.fury.io/rb/rubocop_todo_corrector.svg)](https://rubygems.org/gems/rubocop_todo_corrector)
5
5
 
6
- Auto-correct offenses defined in .rubocop_todo.yml.
6
+ Auto-correct offenses defined in `.rubocop_todo.yml`.
7
+
8
+ This is an internal implementation of [rubocop-todo-corrector](https://github.com/r7kamura/rubocop-todo-corrector) action. See its README for more information about this action.
7
9
 
8
10
  ## Installation
9
11
 
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'asciidoctor'
3
4
  require 'yard'
4
5
 
5
6
  module RubocopTodoCorrector
@@ -27,18 +28,48 @@ module RubocopTodoCorrector
27
28
  return unless yard_class_object
28
29
 
29
30
  {
30
- description: yard_class_object.docstring,
31
- examples: yard_class_object.tags('example').map do |tag|
32
- {
33
- name: tag.name,
34
- text: tag.text
35
- }
36
- end
31
+ description:,
32
+ examples:,
33
+ safety:
37
34
  }
38
35
  end
39
36
 
40
37
  private
41
38
 
39
+ # @return [String]
40
+ def description
41
+ ::Asciidoctor.convert(
42
+ docstring,
43
+ safe: :safe
44
+ )
45
+ end
46
+
47
+ # @return [String]
48
+ def docstring
49
+ yard_class_object.docstring
50
+ end
51
+
52
+ # @return [Array<Hash>]
53
+ def examples
54
+ yard_class_object.tags('example').map do |tag|
55
+ {
56
+ name: tag.name,
57
+ text: tag.text
58
+ }
59
+ end
60
+ end
61
+
62
+ # @return [Hash, nil]
63
+ def safety
64
+ tag = yard_class_object.tag('safety')
65
+ return unless tag
66
+
67
+ {
68
+ name: tag.name,
69
+ text: tag.text
70
+ }
71
+ end
72
+
42
73
  # @return [YARD::CodeObjects::ClassObject]
43
74
  def yard_class_object
44
75
  @yard_class_object ||= begin
@@ -45,7 +45,7 @@ module RubocopTodoCorrector
45
45
 
46
46
  # @return [String]
47
47
  def cop_class_name
48
- "RuboCop::Cop::#{@cop_name.sub('/', '::')}"
48
+ "RuboCop::Cop::#{@cop_name.gsub('/', '::')}"
49
49
  end
50
50
  end
51
51
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubocopTodoCorrector
4
- VERSION = '0.11.0'
4
+ VERSION = '0.13.0'
5
5
  end
@@ -29,6 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
30
  spec.require_paths = ['lib']
31
31
 
32
+ spec.add_dependency 'asciidoctor'
32
33
  spec.add_dependency 'bundler'
33
34
  spec.add_dependency 'thor'
34
35
  spec.add_dependency 'yard'
@@ -11,6 +11,12 @@ Auto-corrected [<%= @cop_name %>](<%= cop_url %>).
11
11
  <% @cop_document[:description].each_line do |line| -%>
12
12
  <%= "> #{line}".strip %>
13
13
  <% end -%>
14
+ <% if @cop_document[:safety] -%>
15
+ >
16
+ > #### Safety
17
+ >
18
+ > <%= @cop_document[:safety][:text].gsub("\n", " ").strip %>
19
+ <% end -%>
14
20
  <% unless @cop_document[:examples].empty? -%>
15
21
  >
16
22
  > #### Examples
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop_todo_corrector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-29 00:00:00.000000000 Z
11
+ date: 2022-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: asciidoctor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement