rubocop_todo_corrector 0.14.1 → 0.14.2

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: dff04eb883e0fd8b45e35cf11bf14351a6e93f397e40117a87c2f8beefce2cdc
4
+ data.tar.gz: f75586ac0a17d1b025925b4faca387eca5d069b9ccf149a1d56f27da1493bede
5
5
  SHA512:
6
- metadata.gz: 8a20c4c0b46c8806fa47e5f53ab9ffe1862a8544be737dbae29f3343f4d254e63f8ba43aa89e8ac8d8bcc50cde1f29c56bcf10f7153a6e49a76078f57f5c32ff
7
- data.tar.gz: 7a95a3f15eb5f3a368a9b9fc1bc5b5faa9c2837fa54e6631bf096eb767b92a71119aec305cd08465c4fa371598cfc0fc2410262bc993dc27e4957c623e4ddb16
6
+ metadata.gz: 6c72738de0ffbf7845926c46950c97800bb991f24bfe032b0c6209d71a1f79ebf42967c56c907462f175cefbec631e27f16c092ce60afb4401e816a7283d50dc
7
+ data.tar.gz: 291c3db91da97dcda17875a33844643128c9bd1607957300f064d4ee3e3bb4da545d8efd0dd6e32549d1fac6d0a7094d62e1b721a40b209e1b183f7743e99851
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.14.2)
5
5
  asciidoctor
6
6
  bundler
7
7
  thor
@@ -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.14.2'
5
5
  end
@@ -8,14 +8,12 @@ Auto-corrected [<%= @cop_name %>](<%= @cop_url %>).
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.14.2
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-08-17 00:00:00.000000000 Z
11
+ date: 2022-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor