rubocop_rules 1.1.1 → 1.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 +4 -4
- data/.ruby-version +1 -0
- data/.travis.yml +1 -1
- data/CHANGELOG.md +6 -0
- data/Gemfile +2 -0
- data/README.md +1 -1
- data/Rakefile +2 -0
- data/bin/console +1 -0
- data/bin/rubocop-rules +1 -0
- data/lib/rubocop_rules.rb +2 -0
- data/lib/rubocop_rules/cli.rb +26 -2
- data/lib/rubocop_rules/version.rb +3 -1
- data/rubocop-rules.gemspec +2 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be00bb5e611c0b6d7c8ef1f1baacf144a7059ff367189f4bd953b656de51448e
|
4
|
+
data.tar.gz: 4c462ddf90cc19d6cab0ec9b3fadd6c66b7cd21fc4f64de246833bbac468b7f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 372b60ca0732d7f97f4c6fb1343965b0267279bfe206b6de2eb5a1e839faa685edcee74775aef941e21ea5107088418a6004f49fd295d0282873cf598eeb4455
|
7
|
+
data.tar.gz: 84008f06871c873d1e3fb4a738c30e0521354c3585eda8c60573f34420b6c26de0f454e50ad4c6a72315428cf1c715b5d8012aaa0536cf79d043b4c94bd62c53
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.5.1
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -116,4 +116,4 @@ Keep this to a minimum and always consider if it belongs in .rubocop_common.yml
|
|
116
116
|
|
117
117
|
## Development
|
118
118
|
|
119
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
119
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/klippx/rubocop_rules.
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
data/bin/rubocop-rules
CHANGED
data/lib/rubocop_rules.rb
CHANGED
data/lib/rubocop_rules/cli.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'thor'
|
2
4
|
require 'open3'
|
3
5
|
require 'git'
|
@@ -21,7 +23,7 @@ module RubocopRules
|
|
21
23
|
puts RubocopRules::VERSION
|
22
24
|
end
|
23
25
|
|
24
|
-
desc 'init', 'Initialize
|
26
|
+
desc 'init', 'Initialize Rubocop Rules in your project'
|
25
27
|
def init
|
26
28
|
puts 'Copying config... '
|
27
29
|
copy_file 'templates/.rubosync.yml', '.rubosync.yml'
|
@@ -38,7 +40,7 @@ module RubocopRules
|
|
38
40
|
insert_into_file '.rubocop.yml', ' - .rubocop_todo.yml', after: " - .rubocop_common.yml\n"
|
39
41
|
end
|
40
42
|
|
41
|
-
desc 'update', 'Regenerate
|
43
|
+
desc 'update', 'Regenerate Rubocop Rules configuration in your project'
|
42
44
|
def update
|
43
45
|
puts 'Recreating configuration...'
|
44
46
|
ensure_rubosync_config
|
@@ -50,10 +52,30 @@ module RubocopRules
|
|
50
52
|
comment_lines '.rubocop.yml', /\.rubocop_todo\.yml/
|
51
53
|
generate_todo(silent: true)
|
52
54
|
uncomment_lines '.rubocop.yml', /\.rubocop_todo\.yml/
|
55
|
+
clean_up_rubocop_config
|
53
56
|
end
|
54
57
|
|
55
58
|
private
|
56
59
|
|
60
|
+
def clean_up_rubocop_config
|
61
|
+
gsub_file '.rubocop.yml', all_inherit_lines_rex, ''
|
62
|
+
insert_into_file '.rubocop.yml', todo_string_block, after: "# our violation whitelist.\n"
|
63
|
+
gsub_file '.rubocop.yml', /^ - .rubocop_common.yml\n+/, " - .rubocop_common.yml\n\n"
|
64
|
+
end
|
65
|
+
|
66
|
+
def all_inherit_lines_rex
|
67
|
+
/(^inherit_from:\n)|(^ - .rubocop_common.yml\n+)|(^ - .rubocop_todo.yml\n+)/
|
68
|
+
end
|
69
|
+
|
70
|
+
def todo_string_block
|
71
|
+
<<~TODO
|
72
|
+
inherit_from:
|
73
|
+
- .rubocop_todo.yml
|
74
|
+
- .rubocop_common.yml
|
75
|
+
|
76
|
+
TODO
|
77
|
+
end
|
78
|
+
|
57
79
|
def generate_todo(silent: false)
|
58
80
|
run_process(command: 'rubocop -a', silent: silent)
|
59
81
|
run_process(command: 'rubocop --auto-gen-config', silent: silent)
|
@@ -63,6 +85,7 @@ module RubocopRules
|
|
63
85
|
unless File.exist?('.rubosync.yml')
|
64
86
|
raise 'Missing configuration file! Please add and configure .rubosync.yml'
|
65
87
|
end
|
88
|
+
|
66
89
|
@config = YAML.safe_load(ERB.new(File.read('.rubosync.yml')).result, [], [], true)
|
67
90
|
end
|
68
91
|
|
@@ -70,6 +93,7 @@ module RubocopRules
|
|
70
93
|
unless @config && @config['git'] && @config['git']['repo']
|
71
94
|
raise 'Missing git repo in configuration! Please configure .rubosync.yml'
|
72
95
|
end
|
96
|
+
|
73
97
|
repo = @config['git']['repo']
|
74
98
|
|
75
99
|
puts "Downloading latest configuration from #{repo}..."
|
data/rubocop-rules.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop_rules
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathias Klippinge
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|
@@ -109,6 +109,7 @@ files:
|
|
109
109
|
- ".rspec"
|
110
110
|
- ".rubocop.yml"
|
111
111
|
- ".rubocop_common.yml"
|
112
|
+
- ".ruby-version"
|
112
113
|
- ".travis.yml"
|
113
114
|
- CHANGELOG.md
|
114
115
|
- Gemfile
|