pronto 0.2.4 → 0.2.5

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: 9764bd034fe7490ff73bae579e775a7efc788f1a
4
- data.tar.gz: 849916874ac63000262cecb9f32a470de3e0b32f
3
+ metadata.gz: d85ffaed02fa2f49086a92e01633f8bc60e4ee2d
4
+ data.tar.gz: 379414ffc3b8c96e02a28b61a13c69aa09759fd7
5
5
  SHA512:
6
- metadata.gz: bc211bca56bc45ac6bc81598774ec7ca639cb1214a45bdf0093916e139ef2dbe88b57c893321c81d435171a2dc0d0a8f6b3330a04b45a38540d78d2ef2758a42
7
- data.tar.gz: 98ebcbc5f7edc67341686a34b4fb908882f98c1a7134016b39004b4b9973db0418ea440e69fd31516125b7f081dfdb4aeaa1638691fffa675672055b8a5c3b35
6
+ metadata.gz: fb2afdea289a79e12e905ccd593edfd9112c1cfe7ac76c60c814f857af49e47866279f3117d9d5e517eefc790682c4218feb2414a4312bee6688fde44a6626aa
7
+ data.tar.gz: f636ae3b8d131e2640b0076e4797a8cfb6a6e2d9e901d09420d06400882fe7db66b9ffe273c1f1104c039931a5517ea84bb7dc17e6c609088f2281fff5410689
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2013 Mindaugas Mozūras
3
+ Copyright (c) 2014 Mindaugas Mozūras
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -60,7 +60,9 @@ Currently available runners:
60
60
  * [pronto-rubocop](https://github.com/mmozuras/pronto-rubocop)
61
61
  * [pronto-flay](https://github.com/mmozuras/pronto-flay)
62
62
  * [pronto-brakeman](https://github.com/mmozuras/pronto-brakeman)
63
+ * [pronto-foodcritic](https://github.com/mmozuras/pronto-foodcritic)
63
64
  * [pronto-rails_best_practices](https://github.com/mmozuras/pronto-rails_best_practices)
65
+ * [pronto-reek](https://github.com/mmozuras/pronto-reek)
64
66
  * [pronto-poper](https://github.com/mmozuras/pronto-poper)
65
67
  * [pronto-jshint](https://github.com/mmozuras/pronto-jshint)
66
68
  * [pronto-spell](https://github.com/mmozuras/pronto-spell)
data/lib/pronto.rb CHANGED
@@ -15,6 +15,7 @@ require 'pronto/runner'
15
15
  require 'pronto/formatter/text_formatter'
16
16
  require 'pronto/formatter/json_formatter'
17
17
  require 'pronto/formatter/github_formatter'
18
+ require 'pronto/formatter/checkstyle_formatter'
18
19
  require 'pronto/formatter/formatter'
19
20
 
20
21
  module Pronto
@@ -0,0 +1,63 @@
1
+ require 'rexml/document'
2
+
3
+ module Pronto
4
+ module Formatter
5
+ class CheckstyleFormatter
6
+ def initialize
7
+ @output = ''
8
+ end
9
+
10
+ def format(messages, _)
11
+ open_xml
12
+ process_messages(messages)
13
+ close_xml
14
+
15
+ @output
16
+ end
17
+
18
+ private
19
+
20
+ def open_xml
21
+ @document = REXML::Document.new.tap do |d|
22
+ d << REXML::XMLDecl.new
23
+ end
24
+ @checkstyle = REXML::Element.new('checkstyle', @document)
25
+ end
26
+
27
+ def process_messages(messages)
28
+ group_messages(messages).map do |path, path_messages|
29
+ REXML::Element.new('file', @checkstyle).tap do |file|
30
+ file.attributes['name'] = path
31
+ add_file_messages(path_messages, file)
32
+ end
33
+ end
34
+ end
35
+
36
+ def group_messages(messages)
37
+ messages.group_by { |message| message.path }
38
+ end
39
+
40
+ def add_file_messages(path_messages, file)
41
+ path_messages.each do |message|
42
+ REXML::Element.new('error', file).tap do |e|
43
+ e.attributes['line'] = message.line.new_lineno if message.line
44
+ e.attributes['severity'] = to_checkstyle_severity(message.level)
45
+ e.attributes['message'] = message.msg
46
+ e.attributes['source'] = 'com.puppycrawl.tools.checkstyle.pronto'
47
+ end
48
+ end
49
+ end
50
+
51
+ def close_xml
52
+ @document.write(@output, 2)
53
+ end
54
+
55
+ def to_checkstyle_severity(pronto_level)
56
+ case pronto_level
57
+ when :error, :fatal then 'error'
58
+ else pronto_level.to_s
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -12,6 +12,7 @@ module Pronto
12
12
  FORMATTERS = {
13
13
  'github' => GithubFormatter,
14
14
  'json' => JsonFormatter,
15
+ 'checkstyle' => CheckstyleFormatter,
15
16
  'text' => TextFormatter
16
17
  }
17
18
  end
@@ -1,3 +1,3 @@
1
1
  module Pronto
2
- VERSION = '0.2.4'
2
+ VERSION = '0.2.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pronto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mindaugas Mozūras
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-13 00:00:00.000000000 Z
11
+ date: 2014-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rugged
@@ -101,7 +101,12 @@ executables:
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
+ - LICENSE
105
+ - README.md
106
+ - bin/pronto
107
+ - lib/pronto.rb
104
108
  - lib/pronto/cli.rb
109
+ - lib/pronto/formatter/checkstyle_formatter.rb
105
110
  - lib/pronto/formatter/formatter.rb
106
111
  - lib/pronto/formatter/github_formatter.rb
107
112
  - lib/pronto/formatter/json_formatter.rb
@@ -110,19 +115,15 @@ files:
110
115
  - lib/pronto/plugin.rb
111
116
  - lib/pronto/rake_task/travis_pull_request.rb
112
117
  - lib/pronto/rugged/commit.rb
118
+ - lib/pronto/rugged/diff.rb
113
119
  - lib/pronto/rugged/diff/delta.rb
114
120
  - lib/pronto/rugged/diff/line.rb
115
121
  - lib/pronto/rugged/diff/patch.rb
116
- - lib/pronto/rugged/diff.rb
117
122
  - lib/pronto/rugged/remote.rb
118
123
  - lib/pronto/rugged/repository.rb
119
124
  - lib/pronto/rugged/tree.rb
120
125
  - lib/pronto/runner.rb
121
126
  - lib/pronto/version.rb
122
- - lib/pronto.rb
123
- - LICENSE
124
- - README.md
125
- - bin/pronto
126
127
  homepage: http://github.org/mmozuras/pronto
127
128
  licenses:
128
129
  - MIT
@@ -143,9 +144,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
144
  version: 1.3.6
144
145
  requirements: []
145
146
  rubyforge_project:
146
- rubygems_version: 2.0.7
147
+ rubygems_version: 2.2.2
147
148
  signing_key:
148
149
  specification_version: 4
149
150
  summary: Pronto runs analysis quickly by checking only the introduced changes
150
151
  test_files: []
151
- has_rdoc: