code_quality 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c97a301536ac1e5078182bd45230e6adfa3a2c472bdceee4982844e27d536441
4
- data.tar.gz: 98a33f7a35c23d1a787f534e2847c3b664310b7751d1864ef109b9c88412b841
3
+ metadata.gz: ce1b29f26412c92229b44e6c88942516150530704c7497046109b4ae9c73502d
4
+ data.tar.gz: 65b101687e65a2510fbc2842f5313059aa0e21f2a971179928e27e6a947305ee
5
5
  SHA512:
6
- metadata.gz: d394a0c35a8ee45ca255f071b279a8eb6effda067333e9c5df9b938b3f1c2c27c281516147f0a91efa4939dd53280c27caa5e34d01adf3758d0bc7cd3863c040
7
- data.tar.gz: d6a4d1502a04558ba0d6be06bdf0d080723b10d18203edf21268798af22a621d398026b84103808f958b00ff1c53738e95233882f15b422b604ddea54229da01
6
+ metadata.gz: 2ef7f4e2e65635d002a2d306af20a1d075c876642bef72c66a906aafad988766ddcd5901a9d41d8b9f0d00e86aa58e8bfe686acf37a1a98e14e9655f32f01539
7
+ data.tar.gz: 0da44037de11fd8dafd39badf65dc6f202dc5d3c9aa52a8684ed89c05b091238013a618700e8976e15479782636176738eb09799978f4c3936d8f38d76302adc
@@ -1,3 +1,3 @@
1
1
  module CodeQuality
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
@@ -111,7 +111,7 @@ namespace :code_quality do
111
111
 
112
112
  # if config lowest_score then audit it with report score
113
113
  if options[:lowest_score]
114
- if report.last(20) =~ /Score: (.+)/
114
+ if report[-20..-1] =~ /Score: (.+)/
115
115
  report_score = $1.to_f
116
116
  lowest_score = options[:lowest_score].to_f
117
117
  audit_faild "Report score #{colorize(report_score, :yellow)} is lower then #{colorize(lowest_score, :yellow)}, must improve your code quality or set a higher #{colorize("lowest_score", :black, :white)}" if report_score < lowest_score
@@ -155,7 +155,7 @@ namespace :code_quality do
155
155
 
156
156
  # if config max_offenses then audit it with detected offenses number in report
157
157
  if options[:max_offenses]
158
- if report.last(20) =~ /(\d+) *Total/
158
+ if report[-20..-1] =~ /(\d+) *Total/
159
159
  detected_offenses = $1.to_i
160
160
  max_offenses = options[:max_offenses].to_i
161
161
  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("max_offenses", :black, :white)}" if detected_offenses > max_offenses
@@ -253,9 +253,9 @@ namespace :code_quality do
253
253
  report_path: "",
254
254
  failure: "",
255
255
  }
256
-
257
256
  puts "## #{title}"
258
257
  puts "", "```"
258
+ exc = nil
259
259
  begin
260
260
  realtime(&block)
261
261
  rescue SystemExit => exc
@@ -266,6 +266,7 @@ namespace :code_quality do
266
266
  @audit_tasks[task_name][:report_path] = @report_path.sub("tmp/code_quality/", "")
267
267
  end
268
268
  puts "```", ""
269
+ raise exc if exc
269
270
  end
270
271
 
271
272
  def realtime(&block)
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.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - RainChen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-19 00:00:00.000000000 Z
11
+ date: 2018-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler-audit