rubocop_todo_corrector 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +12 -0
- data/lib/rubocop_todo_corrector/cli.rb +7 -0
- data/lib/rubocop_todo_corrector/commands/correct.rb +31 -0
- data/lib/rubocop_todo_corrector/commands/describe.rb +0 -2
- data/lib/rubocop_todo_corrector/commands.rb +1 -0
- data/lib/rubocop_todo_corrector/cop_document_parser.rb +2 -0
- data/lib/rubocop_todo_corrector/version.rb +1 -1
- data/templates/description.md.erb +2 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c417bdeb50548dfac237a4360a258e4e49d20fbb5b0eedc3912e4fae7bcf9197
|
4
|
+
data.tar.gz: 73549fca6bd871bd64a908c63a31776c5d7cef57cce9173e25981139634f406c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4844bfb173d37e49fe941924155c854ebc760ed2fbfa6708eb674acd9a819683b67a44e46d5f9f1a3fab23e50813eea6f6139109aaa0f5ebd133b130b58ea50a
|
7
|
+
data.tar.gz: 936d187e8abfa84ae37062473a05c4acc74868e97c6982b1572f866701f1efd0c60f36ef5c50f1cfb0b93e49e8354d00952e043bff49d5032936c2853f36c572
|
data/CHANGELOG.md
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
|
@@ -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'
|
@@ -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.
|
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
|