foodcritic-junit 0.2.0 → 0.2.2

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
  SHA1:
3
- metadata.gz: 9f3b81709705972df2c617e822ccf45ef8e0eea2
4
- data.tar.gz: 05ba866ee057c4bbb4634dff0a65f041db12e4c7
3
+ metadata.gz: f083c412583bf8626f534c4c8a690dd87b994ba8
4
+ data.tar.gz: 9266323d2bac360733467dfb6d5f0d70fbfc5ec2
5
5
  SHA512:
6
- metadata.gz: 355616baa56b06fae478ed295c5bc67679ae8a315528f48d257831ce61adc500e91c793dfa5a96b661b2eec7b8e81ee3f3a00d3b47c41ecdd02bb4ee32f98ebc
7
- data.tar.gz: 969058aa08ed71c60e4f981868ce2441d6f81028d5376dae0369f0ddf72c4790f279bcb14982454231e1f0564e806964aa2eba930e19131be781bab221da44ec
6
+ metadata.gz: 233ba0d9cf1026c2a85a5201e3b0ab51f567da541235c8ff637d9ededf4e9c2e1103c38fcf7a445b4993e6956cec83256d4d7282f60ed9d89a5fe91f231e1a59
7
+ data.tar.gz: efc608dc4fee9ef80326855ad1432c1f267195edbf3e27a74b7cc6bfb64987dbbd2cdf8c95baecbcb2b1262068ade495add211017462cba564e1c1d9258c1b6c
data/README.md CHANGED
@@ -9,6 +9,8 @@ $ bundle exec foodcritic -C . | bundle exec foodcritic-junit
9
9
  => Wrote test/reports/report.xml
10
10
  ```
11
11
 
12
+ ![Example JUNIT output](http://i.imgur.com/ZoOI3yk.png?1)
13
+
12
14
  ## Install
13
15
 
14
16
  In your Gemfile: `gem 'foodcritic-junit'` or just `gem install foodcritic-junit`
@@ -23,31 +23,40 @@ module Foodcritic
23
23
  write_output
24
24
  end
25
25
 
26
+ def store_violation
27
+ if current_violation
28
+ violations.push({
29
+ rule: current_violation[:rule],
30
+ message: current_violation[:message],
31
+ file_name: current_file_name,
32
+ lines: current_violation_lines.join("\n")
33
+ })
34
+ end
35
+ end
36
+
26
37
  def parse_violations
27
38
  input.each_line do |line|
28
39
  line.chomp!
29
40
 
30
- @current_file_name = line if File.exist?(line)
41
+ if File.exist?(line)
42
+ store_violation
43
+ @current_violation = nil
44
+ @current_violation_lines = []
45
+ @current_file_name = line
46
+ end
31
47
 
32
48
  violation = line.match(/(?<rule>[A-Z]+\d+?):\s(?<message>.+?)$/)
33
49
 
34
50
  if violation
35
51
  # We got a new violation, store the current one + it's lines
36
- if current_violation
37
- violations.push({
38
- rule: current_violation[:rule],
39
- message: current_violation[:message],
40
- file_name: current_file_name,
41
- lines: current_violation_lines.join("\n")
42
- })
43
- end
44
-
52
+ store_violation
45
53
  @current_violation = violation
46
54
  @current_violation_lines = []
47
55
  else
48
56
  current_violation_lines << line.lstrip if current_violation_lines
49
57
  end
50
58
  end
59
+ store_violation
51
60
  end
52
61
 
53
62
  def output_file_path
@@ -1,5 +1,5 @@
1
1
  module Foodcritic
2
2
  module Junit
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foodcritic-junit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Vendetta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-14 00:00:00.000000000 Z
11
+ date: 2017-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foodcritic