rubocop-safe_todo_searcher 0.1.1 → 0.1.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: 28cb4cdd395182a2e4ac5da05e630ab5a71ed1f8ef724e5ecc22b2f8cf5d68fb
4
- data.tar.gz: 767910bdab35e8a6fd99d0af5860a2e0dd74b4da02671985a3022045b4ba7247
3
+ metadata.gz: 8b7a18ffdd32249f8ae28b6bc0390626068b80740aab32f5853d5a315fa57675
4
+ data.tar.gz: 2459d8c1d8cd5ac0e3c296f0e887fce08f9a25aef10a8fda794349fafef895f9
5
5
  SHA512:
6
- metadata.gz: f1b191a2a688d32a880510a2791f98a289c1a256864b62ca29c0b36b9dec69cae249ef541af5ca0b6b54760d050254e37b6c702ce626202c5b61e6f0213f9ccb
7
- data.tar.gz: 7155c18638f0b7af8a170867c40bf1bca07608ac73e01d8e979c83e726b0f25ba054ed0a2225a793f9dce27916d897d3719993df558fd400a2eae2373eeff3b0
6
+ metadata.gz: 416cc45b863ea5290f275abfd9d755ffc105812e35cb78cd26b26659c77f3f3ed7f679264e4a101491877806c8913ae113213e58a43bd9f5510026bfdd2dde83
7
+ data.tar.gz: a1ea62866061ff6009f5962533c8046c32851ef134b87e91ebb5c47b52f06485f8fc8d77c93177d6742db96a486b2cd38d0aa74e29f24263cd4bdf283ca6f1f9
data/.rubocop.yml CHANGED
@@ -1,5 +1,7 @@
1
1
  AllCops:
2
2
  TargetRubyVersion: 2.6
3
+ NewCops: enable
4
+ SuggestExtensions: false
3
5
 
4
6
  Style/StringLiterals:
5
7
  Enabled: true
@@ -10,4 +12,13 @@ Style/StringLiteralsInInterpolation:
10
12
  EnforcedStyle: double_quotes
11
13
 
12
14
  Layout/LineLength:
13
- Max: 120
15
+ Enabled: false
16
+
17
+ Documentation:
18
+ Enabled: false
19
+
20
+ Style/FrozenStringLiteralComment:
21
+ Enabled: false
22
+
23
+ Metrics:
24
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.2] - 2022-01-07
4
+
5
+ ### New features:
6
+ - [#14](https://github.com/ydah/rubocop-safe_todo_searcher/pull/14/commits/80e2b415fb7af12463c71d162c4d956261b13a7b) : Add support official extensions.
7
+
8
+ ### Bug fixes
9
+ - [#9](https://github.com/ydah/rubocop-safe_todo_searcher/pull/9/commits/7005c9c9165aefccd67f7d2c912593f87ee6b229) : Fixes to not search rubocop_todo.yml if it doesn't exist.
10
+ - [#9](https://github.com/ydah/rubocop-safe_todo_searcher/pull/9/commits/28ccb1eadaca3fb983a72e990636650d6d16ca88) : Fixes rubocop_todo.yml to output an error message if it doesn't exist.
11
+ - [#15](https://github.com/ydah/rubocop-safe_todo_searcher/pull/16/commits/4d01c6593b6927dc1d27c8b1e18d194a97144b1f) : Fixes to detect Unsafe cops.
12
+
13
+ ## [0.1.1] - 2021-12-28
14
+
15
+ ### New features:
16
+ - [#2](https://github.com/ydah/rubocop-safe_todo_searcher/pull/2) : Support rubocop-rails extention.
17
+
3
18
  ## [0.1.0] - 2021-12-27
4
19
 
5
20
  - Initial release
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Rubocop SafeTodoSearcher [![Gem Version](https://badge.fury.io/rb/rubocop-safe_todo_searcher.svg)](https://badge.fury.io/rb/rubocop-safe_todo_searcher) [![Maintainability](https://api.codeclimate.com/v1/badges/38a1dd096ef8135421af/maintainability)](https://codeclimate.com/github/ydah/rubocop-safe_todo_searcher/maintainability)
1
+ # Rubocop SafeTodoSearcher [![CI](https://github.com/ydah/rubocop-safe_todo_searcher/actions/workflows/ci.yml/badge.svg)](https://github.com/ydah/rubocop-safe_todo_searcher/actions/workflows/ci.yml) [![Gem Version](https://badge.fury.io/rb/rubocop-safe_todo_searcher.svg)](https://badge.fury.io/rb/rubocop-safe_todo_searcher) [![Maintainability](https://api.codeclimate.com/v1/badges/38a1dd096ef8135421af/maintainability)](https://codeclimate.com/github/ydah/rubocop-safe_todo_searcher/maintainability)
2
2
 
3
3
  Search `rubocop_todo.yml` to see if there are any cop that can be resolved with auto correct.
4
4
  If you want to know if the pending remarks in your `rubocop_todo.yml `can be deleted automatically, please use it.
data/exe/safe-search CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'rubocop/safe_todo_searcher'
3
+ require "rubocop/safe_todo_searcher"
4
4
 
5
5
  puts Rubocop::SafeTodoSearcher.search
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rubocop
4
4
  module SafeTodoSearcher
5
- VERSION = "0.1.1"
5
+ VERSION = "0.1.2"
6
6
  end
7
7
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "rubocop"
2
4
  require "rubocop-rails"
3
5
  require "yaml"
@@ -8,14 +10,22 @@ module Rubocop
8
10
  class Error < StandardError; end
9
11
 
10
12
  def self.search
11
- res = ""
12
- open(".rubocop_todo.yml", "r") { |f| YAML.load(f) }.each_key do |key|
13
- klass = Object.const_get "RuboCop::Cop::#{key.gsub(%r{/}, "::")}"
14
- res << "#{key}\n" if klass.support_autocorrect?
15
- rescue StandardError
16
- nil
13
+ File.exist?(".rubocop_todo.yml") ? parse : "rubocop_todo.yml does not exist"
14
+ end
15
+
16
+ def self.parse
17
+ res = +""
18
+ File.open(".rubocop_todo.yml", "r") { |f| YAML.safe_load(f) }.each_key do |key|
19
+ res << "#{key}\n" if support_autocorrect?(key)
17
20
  end
18
21
  res
19
22
  end
23
+
24
+ def self.support_autocorrect?(key)
25
+ cop = Object.const_get "RuboCop::Cop::#{key.gsub(%r{/}, "::")}"
26
+ cop.support_autocorrect? && cop.new(RuboCop::ConfigLoader.default_configuration).safe_autocorrect?
27
+ rescue NameError
28
+ false
29
+ end
20
30
  end
21
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-safe_todo_searcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
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: 2021-12-28 00:00:00.000000000 Z
11
+ date: 2022-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.21'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubocop-minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop-performance
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: rubocop-rails
29
57
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +66,48 @@ dependencies:
38
66
  - - ">="
39
67
  - !ruby/object:Gem::Version
40
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop-rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-sequel
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
41
111
  - !ruby/object:Gem::Dependency
42
112
  name: rake
43
113
  requirement: !ruby/object:Gem::Requirement
@@ -93,9 +163,7 @@ homepage: https://github.com/ydah/rubocop-safe_todo_searcher
93
163
  licenses:
94
164
  - MIT
95
165
  metadata:
96
- homepage_uri: https://github.com/ydah/rubocop-safe_todo_searcher
97
- source_code_uri: https://github.com/ydah/rubocop-safe_todo_searcher
98
- changelog_uri: https://github.com/ydah/rubocop-safe_todo_searcher/blob/main/CHANGELOG.md
166
+ rubygems_mfa_required: 'true'
99
167
  post_install_message:
100
168
  rdoc_options: []
101
169
  require_paths: