rubocop-safe_todo_searcher 0.1.2 → 0.1.3
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 +4 -4
- data/CHANGELOG.md +9 -0
- data/exe/safe-search +1 -1
- data/lib/rubocop/safe_todo_searcher/version.rb +1 -1
- data/lib/rubocop/safe_todo_searcher.rb +54 -15
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6c84f35549d9f062edd505f84347f69b504393459c0ad1ade859f197e99c0fa
|
4
|
+
data.tar.gz: b8f299a87ea3a37d7bc7a18d13b0235f1e287066aef0e6ff915ce12e3a3359f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e342c999d821c07e57f0c6e7eded6e2e403e784a2208954e11d67f6eb07df492f3175da0284f2bfca9b5af72a27740f0d98fbcd65643dfbe4990317fe40f19c
|
7
|
+
data.tar.gz: 958547a8d73b7bd79d9fc83a540d39639b9f9b1a3e8cf05f02c4ad0481df69b8509d7d83c78ea82eecef1f3e0960f6096c472da2bc735374f50231a28586f14a
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.1.3] - 2022-02-19
|
4
|
+
|
5
|
+
### New features:
|
6
|
+
- [#21](https://github.com/ydah/rubocop-safe_todo_searcher/pull/21) : Output logs to stdout to show that program is running when it is running.
|
7
|
+
|
8
|
+
### Bug fixes
|
9
|
+
- [#18](https://github.com/ydah/rubocop-safe_todo_searcher/pull/18) : Fixes to detect cops that were not supported.
|
10
|
+
- [#19](https://github.com/ydah/rubocop-safe_todo_searcher/pull/19) : Fixes NoMethodError if none of keys are found in rubocop_todo.yml.
|
11
|
+
|
3
12
|
## [0.1.2] - 2022-01-07
|
4
13
|
|
5
14
|
### New features:
|
data/exe/safe-search
CHANGED
@@ -1,31 +1,70 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "rubocop"
|
4
|
+
require "rubocop-minitest"
|
5
|
+
require "rubocop-performance"
|
4
6
|
require "rubocop-rails"
|
7
|
+
require "rubocop-rake"
|
8
|
+
require "rubocop-rspec"
|
9
|
+
require "rubocop-sequel"
|
10
|
+
require "date"
|
11
|
+
require "highline"
|
5
12
|
require "yaml"
|
6
13
|
require_relative "safe_todo_searcher/version"
|
7
14
|
|
8
15
|
module Rubocop
|
9
16
|
module SafeTodoSearcher
|
10
|
-
|
17
|
+
RUBOCOP_TODO_YML = ".rubocop_todo.yml"
|
11
18
|
|
12
|
-
|
13
|
-
|
14
|
-
|
19
|
+
class << self
|
20
|
+
def search
|
21
|
+
puts generate_header
|
22
|
+
puts horizontal_line
|
23
|
+
puts generate_results
|
24
|
+
puts horizontal_line
|
25
|
+
end
|
15
26
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
27
|
+
private
|
28
|
+
|
29
|
+
def generate_results
|
30
|
+
File.exist?(RUBOCOP_TODO_YML) ? parse : "#{RUBOCOP_TODO_YML} does not exist"
|
31
|
+
end
|
32
|
+
|
33
|
+
def parse
|
34
|
+
res = +""
|
35
|
+
File.open(RUBOCOP_TODO_YML, "r") { |f| YAML.safe_load(f) }&.each_key do |key|
|
36
|
+
res << "#{key}\n" if support_autocorrect?(key)
|
37
|
+
end
|
38
|
+
res
|
39
|
+
end
|
40
|
+
|
41
|
+
def support_autocorrect?(key)
|
42
|
+
cop = Object.const_get "RuboCop::Cop::#{key.gsub(%r{/}, "::")}"
|
43
|
+
cop.support_autocorrect? && cop.new(RuboCop::ConfigLoader.default_configuration).safe_autocorrect?
|
44
|
+
rescue NameError
|
45
|
+
false
|
20
46
|
end
|
21
|
-
res
|
22
|
-
end
|
23
47
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
48
|
+
def generate_header
|
49
|
+
[
|
50
|
+
horizontal_line,
|
51
|
+
header("Rubocop TODO searcher"),
|
52
|
+
title("Version", Rubocop::SafeTodoSearcher::VERSION),
|
53
|
+
title("Date", DateTime.now.strftime("%Y-%m-%d %H:%M:%S"))
|
54
|
+
]
|
55
|
+
end
|
56
|
+
|
57
|
+
def header(text)
|
58
|
+
HighLine.new.color("++++++ #{text} ++++++", :bold)
|
59
|
+
end
|
60
|
+
|
61
|
+
def title(title, value, color = :green)
|
62
|
+
"#{HighLine.new.color(title, color)}: #{value}"
|
63
|
+
end
|
64
|
+
|
65
|
+
def horizontal_line(color = :none)
|
66
|
+
HighLine.new.color("--------------------------------------------------", :bold, color)
|
67
|
+
end
|
29
68
|
end
|
30
69
|
end
|
31
70
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-safe_todo_searcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "ydah\n\n"
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: highline
|
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: rubocop
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -179,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
193
|
- !ruby/object:Gem::Version
|
180
194
|
version: '0'
|
181
195
|
requirements: []
|
182
|
-
rubygems_version: 3.0.3
|
196
|
+
rubygems_version: 3.0.3.1
|
183
197
|
signing_key:
|
184
198
|
specification_version: 4
|
185
199
|
summary: Check if Cop auto correct is available in .rubocop_todo.yml.
|