code_quality 0.2.0 → 0.3.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 +4 -4
- data/README.md +3 -3
- data/README_for_rake.md +3 -3
- data/lib/code_quality/version.rb +1 -1
- data/lib/tasks/code_quality.rake +7 -7
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eace4c0b5c37da862ea1badeb54ef4f0163236d4f3b73134cbe7dfea9830de86
|
4
|
+
data.tar.gz: 2927bcc4f3ddff5ff6c142bfdb5835f2fafba593148c547d6e8ca6142d111df4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce5e2c0afa00141987f63bbfaedfbffd7595fe1b888f9dfa90816e1de0a3b8ffd83097ddec857656ce79452417174a37b06e723e0e0891f82dccc3beba52a927
|
7
|
+
data.tar.gz: 8d318b6278cf2111400c19c0dc296c572fe6a2a3855bc22850b40bc352d2ff060330e7b8086d1562f9122c201ca1a4057d484eaff321bee1b413100f2c19d622
|
data/README.md
CHANGED
@@ -182,11 +182,11 @@ output example:
|
|
182
182
|
##### options for rubocop
|
183
183
|
|
184
184
|
```
|
185
|
-
# e.g.: code_quality quality_audit:rubocop
|
185
|
+
# e.g.: code_quality quality_audit:rubocop rubocop_max_offenses=100
|
186
186
|
# options:
|
187
187
|
# config_formula: use which formula for config, supports "github, "rails" or path_to_your_local_config.yml, default is "github"
|
188
188
|
# cli_options: pass extract options, e.g.: cli_options="--show-cops"
|
189
|
-
#
|
189
|
+
# rubocop_max_offenses: if config rubocop_max_offenses then audit it with detected offenses number in report, e.g.: rubocop_max_offenses=100
|
190
190
|
```
|
191
191
|
|
192
192
|
output example:
|
@@ -215,7 +215,7 @@ output example:
|
|
215
215
|
|
216
216
|
```
|
217
217
|
# run all at once
|
218
|
-
code_quality quality_audit lowest_score=90
|
218
|
+
code_quality quality_audit lowest_score=90 rubocop_max_offenses=100 metrics=stats,rails_best_practices,roodi rails_best_practices_max_offenses=10 roodi_max_offenses=10
|
219
219
|
```
|
220
220
|
|
221
221
|
#### work with CI
|
data/README_for_rake.md
CHANGED
@@ -172,11 +172,11 @@ output example:
|
|
172
172
|
##### options for rubocop
|
173
173
|
|
174
174
|
```
|
175
|
-
# e.g.: rake code_quality:quality_audit:rubocop
|
175
|
+
# e.g.: rake code_quality:quality_audit:rubocop rubocop_max_offenses=100
|
176
176
|
# options:
|
177
177
|
# config_formula: use which formula for config, supports "github, "rails" or path_to_your_local_config.yml, default is "github"
|
178
178
|
# cli_options: pass extract options, e.g.: cli_options="--show-cops"
|
179
|
-
#
|
179
|
+
# rubocop_max_offenses: if config rubocop_max_offenses then audit it with detected offenses number in report, e.g.: rubocop_max_offenses=100
|
180
180
|
```
|
181
181
|
|
182
182
|
output example:
|
@@ -205,7 +205,7 @@ output example:
|
|
205
205
|
|
206
206
|
```
|
207
207
|
# run all at once
|
208
|
-
rake code_quality:quality_audit lowest_score=90
|
208
|
+
rake code_quality:quality_audit lowest_score=90 rubocop_max_offenses=100 metrics=stats,rails_best_practices,roodi rails_best_practices_max_offenses=10 roodi_max_offenses=10
|
209
209
|
```
|
210
210
|
|
211
211
|
#### work with CI
|
data/lib/code_quality/version.rb
CHANGED
data/lib/tasks/code_quality.rake
CHANGED
@@ -145,14 +145,14 @@ namespace :code_quality do
|
|
145
145
|
end
|
146
146
|
|
147
147
|
desc "rubocop - audit coding style"
|
148
|
-
# e.g.: rake code_quality:quality_audit:rubocop
|
148
|
+
# e.g.: rake code_quality:quality_audit:rubocop rubocop_max_offenses=100
|
149
149
|
# options:
|
150
150
|
# config_formula: use which formula for config, supports "github, "rails" or path_to_your_local_config.yml, default is "github"
|
151
151
|
# cli_options: pass extract options, e.g.: cli_options="--show-cops"
|
152
|
-
#
|
152
|
+
# rubocop_max_offenses: if config rubocop_max_offenses then audit it with detected offenses number in report, e.g.: rubocop_max_offenses=100
|
153
153
|
task :rubocop => :prepare do |task|
|
154
154
|
run_audit task, "rubocop - RuboCop is a Ruby static code analyzer. Out of the box it will enforce many of the guidelines outlined in the community Ruby Style Guide." do
|
155
|
-
options = options_from_env(:config_formula, :cli_options, :
|
155
|
+
options = options_from_env(:config_formula, :cli_options, :rubocop_max_offenses)
|
156
156
|
|
157
157
|
config_formulas = {
|
158
158
|
'github' => 'https://github.com/github/rubocop-github',
|
@@ -177,12 +177,12 @@ namespace :code_quality do
|
|
177
177
|
puts "Report generated to #{report_path}"
|
178
178
|
show_in_browser File.realpath(report_path)
|
179
179
|
|
180
|
-
# if config
|
181
|
-
if options[:
|
180
|
+
# if config rubocop_max_offenses then audit it with detected offenses number in report
|
181
|
+
if options[:rubocop_max_offenses]
|
182
182
|
if report[-20..-1] =~ /(\d+) *Total/
|
183
183
|
detected_offenses = $1.to_i
|
184
|
-
max_offenses = options[:
|
185
|
-
audit_faild "Detected offenses #{colorize(detected_offenses, :yellow)} is more then #{colorize(max_offenses, :yellow)}, must improve your code quality or set a lower #{colorize("
|
184
|
+
max_offenses = options[:rubocop_max_offenses].to_i
|
185
|
+
audit_faild "Detected offenses #{colorize(detected_offenses, :yellow)} is more then #{colorize(max_offenses, :yellow)}, must improve your code quality or set a lower #{colorize("rubocop_max_offenses", :black, :white)}" if detected_offenses > max_offenses
|
186
186
|
end
|
187
187
|
end
|
188
188
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: code_quality
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RainChen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler-audit
|
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
187
|
version: '0'
|
188
188
|
requirements: []
|
189
189
|
rubyforge_project:
|
190
|
-
rubygems_version: 2.7.
|
190
|
+
rubygems_version: 2.7.6
|
191
191
|
signing_key:
|
192
192
|
specification_version: 4
|
193
193
|
summary: run code quality and security audit report with one command
|