rubocop_todo_corrector 0.1.1 → 0.2.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: 1b3400e2c32ebba2820631095ea0a4468f81145edd4328472b13901f40fa1909
4
- data.tar.gz: b6922a0b1da93adec490cabd5a59870d0412f2ef7bbd412173ca093b42e8f363
3
+ metadata.gz: c417bdeb50548dfac237a4360a258e4e49d20fbb5b0eedc3912e4fae7bcf9197
4
+ data.tar.gz: 73549fca6bd871bd64a908c63a31776c5d7cef57cce9173e25981139634f406c
5
5
  SHA512:
6
- metadata.gz: 4fe20782d6f29b60c55f6f0478345029fa73df46515e9d117aa640969c2683a684977943a2c63bbcf08b57be3e05531e468bd08837683e3139328f95f9db2643
7
- data.tar.gz: de6bd6fd3f51f3004ad8f1e83c470ca630a71d0bf8489a6469bd49471fdfac649f898b477a058e78fed84a2a445af8be190a9396d7a7091eca19c9c2a834cbc1
6
+ metadata.gz: 4844bfb173d37e49fe941924155c854ebc760ed2fbfa6708eb674acd9a819683b67a44e46d5f9f1a3fab23e50813eea6f6139109aaa0f5ebd133b130b58ea50a
7
+ data.tar.gz: 936d187e8abfa84ae37062473a05c4acc74868e97c6982b1572f866701f1efd0c60f36ef5c50f1cfb0b93e49e8354d00952e043bff49d5032936c2853f36c572
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.2.0 - 2022-05-15
6
+
7
+ ### Added
8
+
9
+ - Add `correct` command.
10
+
11
+ ### Changed
12
+
13
+ - Improve description on no named example.
14
+
5
15
  ## 0.1.1 - 2022-05-15
6
16
 
7
17
  ### Changed
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # RubocopTodoCorrector
2
2
 
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
+ [![Gem Version](https://badge.fury.io/rb/rubocop_todo_corrector.svg)](https://rubygems.org/gems/rubocop_todo_corrector)
4
5
 
5
6
  Auto-correct offenses defined in .rubocop_todo.yml.
6
7
 
@@ -24,6 +25,7 @@ gem install rubocop_todo_corrector
24
25
  $ rubocop_todo_corrector
25
26
  Commands:
26
27
  rubocop_todo_corrector bundle # Run `bundle install` to install RuboCop related gems.
28
+ rubocop_todo_corrector correct # Run `rubocop --auto-correct-all`.
27
29
  rubocop_todo_corrector describe --cop-name=COP_NAME # Output Markdown description for specified cop.
28
30
  rubocop_todo_corrector generate # Run `rubocop --auto-gen-config` to generate .rubocop_todo.yml.
29
31
  rubocop_todo_corrector help [COMMAND] # Describe available commands or one specific command
@@ -41,6 +43,16 @@ Usage:
41
43
  Run `bundle install` to install RuboCop related gems.
42
44
  ```
43
45
 
46
+ ### correct
47
+
48
+ ```console
49
+ $ rubocop_todo_corrector help correct
50
+ Usage:
51
+ rubocop_todo_corrector correct
52
+
53
+ Run `rubocop --auto-correct-all`.
54
+ ```
55
+
44
56
  ### describe
45
57
 
46
58
  ```console
@@ -14,6 +14,13 @@ module RubocopTodoCorrector
14
14
  )
15
15
  end
16
16
 
17
+ desc 'correct', 'Run `rubocop --auto-correct-all`.'
18
+ def correct
19
+ Commands::Correct.call(
20
+ temporary_gemfile_path: 'tmp/Gemfile_rubocop_todo_corrector.rb'
21
+ )
22
+ end
23
+
17
24
  desc 'describe', 'Output Markdown description for specified cop.'
18
25
  option(
19
26
  :cop_name,
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubocopTodoCorrector
4
+ module Commands
5
+ class Correct
6
+ class << self
7
+ # @param [String] temporary_gemfile_path
8
+ def call(
9
+ temporary_gemfile_path:
10
+ )
11
+ new(
12
+ temporary_gemfile_path: temporary_gemfile_path
13
+ ).call
14
+ end
15
+ end
16
+
17
+ def initialize(
18
+ temporary_gemfile_path:
19
+ )
20
+ @temporary_gemfile_path = temporary_gemfile_path
21
+ end
22
+
23
+ def call
24
+ ::Kernel.system(
25
+ { 'BUNDLE_GEMFILE' => @temporary_gemfile_path },
26
+ 'bundle exec rubocop --auto-correct-all'
27
+ )
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'yard'
4
-
5
3
  module RubocopTodoCorrector
6
4
  module Commands
7
5
  class Describe
@@ -3,6 +3,7 @@
3
3
  module RubocopTodoCorrector
4
4
  module Commands
5
5
  autoload :Bundle, 'rubocop_todo_corrector/commands/bundle'
6
+ autoload :Correct, 'rubocop_todo_corrector/commands/correct'
6
7
  autoload :Describe, 'rubocop_todo_corrector/commands/describe'
7
8
  autoload :Generate, 'rubocop_todo_corrector/commands/generate'
8
9
  autoload :Pick, 'rubocop_todo_corrector/commands/pick'
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'yard'
4
+
3
5
  module RubocopTodoCorrector
4
6
  class CopDocumentParser
5
7
  class << self
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubocopTodoCorrector
4
- VERSION = '0.1.1'
4
+ VERSION = '0.2.0'
5
5
  end
@@ -13,8 +13,10 @@ Auto-corrected [<%= @cop_name %>](<%= cop_url %>).
13
13
  >
14
14
  > #### Examples
15
15
  <% @cop_document[:examples].each do |example| -%>
16
+ <% unless example[:name].empty? -%>
16
17
  >
17
18
  > <%= example[:name].strip %>
19
+ <% end -%>
18
20
  >
19
21
  > ```ruby
20
22
  <% example[:text].each_line do |line| -%>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop_todo_corrector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
@@ -75,6 +75,7 @@ files:
75
75
  - lib/rubocop_todo_corrector/cli.rb
76
76
  - lib/rubocop_todo_corrector/commands.rb
77
77
  - lib/rubocop_todo_corrector/commands/bundle.rb
78
+ - lib/rubocop_todo_corrector/commands/correct.rb
78
79
  - lib/rubocop_todo_corrector/commands/describe.rb
79
80
  - lib/rubocop_todo_corrector/commands/generate.rb
80
81
  - lib/rubocop_todo_corrector/commands/pick.rb