rubocop_todo_corrector 0.14.1 → 0.15.0

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: 6de4f9dc6b91ba8fbf73c74704955b28807dc370aada671af16f689de690f4a4
4
- data.tar.gz: 4ec7f847e031075fc4ac31928a28036d14777773d8cb1352a851bb68f20c6951
3
+ metadata.gz: d47110b2a0a7d4d76187937d9f76ca9612c390470ad2d63cd5991cbad9dc4a3d
4
+ data.tar.gz: 513c4a0eeee07c9a593a4a2bc331c384da38ac729b8863bb557683416dc12f81
5
5
  SHA512:
6
- metadata.gz: 8a20c4c0b46c8806fa47e5f53ab9ffe1862a8544be737dbae29f3343f4d254e63f8ba43aa89e8ac8d8bcc50cde1f29c56bcf10f7153a6e49a76078f57f5c32ff
7
- data.tar.gz: 7a95a3f15eb5f3a368a9b9fc1bc5b5faa9c2837fa54e6631bf096eb767b92a71119aec305cd08465c4fa371598cfc0fc2410262bc993dc27e4957c623e4ddb16
6
+ metadata.gz: e17be284491817e9208372a9d509cfdaad1f18d02b7d47f86a94043d8e9da9b9097357739ab7090573e026a820c6f7feaac7c00a17dea9be71bf5c00187a8e2a
7
+ data.tar.gz: 0d27d64fef45604c3d6f6891c1b47c78ff77cc681216509746fca02cbc3cc584d321111a46a29066b75e7d053c0a21134e75d319bb688b02fc4c060ba775d522
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rubocop_todo_corrector (0.14.1)
4
+ rubocop_todo_corrector (0.15.0)
5
5
  asciidoctor
6
6
  bundler
7
7
  thor
@@ -10,7 +10,7 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- asciidoctor (2.0.17)
13
+ asciidoctor (2.0.18)
14
14
  ast (2.4.2)
15
15
  diff-lcs (1.5.0)
16
16
  parallel (1.22.1)
data/README.md CHANGED
@@ -3,7 +3,7 @@
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
+ Autocorrect offenses defined in `.rubocop_todo.yml`.
7
7
 
8
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.
9
9
 
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'asciidoctor'
4
3
  require 'yard'
5
4
 
6
5
  module RubocopTodoCorrector
@@ -38,14 +37,6 @@ module RubocopTodoCorrector
38
37
 
39
38
  # @return [String]
40
39
  def description
41
- ::Asciidoctor.convert(
42
- docstring,
43
- safe: :safe
44
- )
45
- end
46
-
47
- # @return [String]
48
- def docstring
49
40
  yard_class_object.docstring
50
41
  end
51
42
 
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'asciidoctor'
3
4
  require 'erb'
4
5
  require 'open3'
5
6
 
@@ -42,6 +43,25 @@ module RubocopTodoCorrector
42
43
 
43
44
  private
44
45
 
46
+ # Convert AsciiDoc to HTML.
47
+ # @param [String] string
48
+ # @return [String]
49
+ def asciidoc(string)
50
+ ::Asciidoctor.convert(
51
+ string,
52
+ safe: :safe
53
+ )
54
+ end
55
+
56
+ # Prepend quote marker to each line.
57
+ # @param [String] string
58
+ # @return [String]
59
+ def quote(string)
60
+ string.each_line.map do |line|
61
+ "> #{line}".strip
62
+ end.join("\n")
63
+ end
64
+
45
65
  # @return [String]
46
66
  def template_content
47
67
  ::File.read(TEMPLATE_PATH)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubocopTodoCorrector
4
- VERSION = '0.14.1'
4
+ VERSION = '0.15.0'
5
5
  end
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ['Ryo Nakamura']
9
9
  spec.email = ['r7kamura@gmail.com']
10
10
 
11
- spec.summary = 'Auto-correct offenses defined in .rubocop_todo.yml.'
11
+ spec.summary = 'Autocorrect offenses defined in .rubocop_todo.yml.'
12
12
  spec.homepage = 'https://github.com/r7kamura/rubocop_todo_corrector'
13
13
  spec.license = 'MIT'
14
14
  spec.required_ruby_version = '>= 3.1'
@@ -1,21 +1,19 @@
1
- Auto-correct <%= @cop_name %>
1
+ Autocorrect `<%= @cop_name %>`
2
2
 
3
3
  ## Summary
4
4
 
5
- Auto-corrected [<%= @cop_name %>](<%= @cop_url %>).
5
+ Autocorrected [<%= @cop_name %>](<%= @cop_url %>).
6
6
 
7
7
  ## Details
8
8
 
9
9
  ### <%= @cop_name %>
10
10
 
11
- <% @cop_document[:description].each_line do |line| -%>
12
- <%= "> #{line}".strip %>
13
- <% end -%>
11
+ <%= quote(asciidoc(@cop_document[:description])) %>
14
12
  <% if @cop_document[:safety] -%>
15
13
  >
16
14
  > #### Safety
17
15
  >
18
- > <%= @cop_document[:safety][:text].gsub("\n", " ").strip %>
16
+ <%= quote(asciidoc(@cop_document[:safety][:text])) %>
19
17
  <% end -%>
20
18
  <% unless @cop_document[:examples].empty? -%>
21
19
  >
@@ -27,9 +25,7 @@ Auto-corrected [<%= @cop_name %>](<%= @cop_url %>).
27
25
  <% end -%>
28
26
  >
29
27
  > ```ruby
30
- <% example[:text].each_line do |line| -%>
31
- <%= "> #{line}".strip %>
32
- <% end -%>
28
+ <%= quote(example[:text]) %>
33
29
  > ```
34
30
  <% end -%>
35
31
  <% end -%>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop_todo_corrector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.1
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-17 00:00:00.000000000 Z
11
+ date: 2022-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -66,7 +66,7 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- description:
69
+ description:
70
70
  email:
71
71
  - r7kamura@gmail.com
72
72
  executables:
@@ -115,7 +115,7 @@ metadata:
115
115
  source_code_uri: https://github.com/r7kamura/rubocop_todo_corrector
116
116
  changelog_uri: https://github.com/r7kamura/rubocop_todo_corrector/blob/main/CHANGELOG.md
117
117
  rubygems_mfa_required: 'true'
118
- post_install_message:
118
+ post_install_message:
119
119
  rdoc_options: []
120
120
  require_paths:
121
121
  - lib
@@ -130,8 +130,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  requirements: []
133
- rubygems_version: 3.3.7
134
- signing_key:
133
+ rubygems_version: 3.3.26
134
+ signing_key:
135
135
  specification_version: 4
136
- summary: Auto-correct offenses defined in .rubocop_todo.yml.
136
+ summary: Autocorrect offenses defined in .rubocop_todo.yml.
137
137
  test_files: []