slim_lint 0.7.2 → 0.8.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/config/default.yml +2 -2
- data/lib/slim_lint/reporter/checkstyle_reporter.rb +40 -0
- data/lib/slim_lint/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14a2012a5817a251de5af2b5999c3ad273316c04
|
4
|
+
data.tar.gz: f0a44d0c9a16c616b17f68b22471cef8c6cef947
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82e61a0bd07f08ad43f3bb9ddb101a0467167673e6d003d237ec860382e38ab701050046d3cb240c47f7e1e2912209d47cb305c95944f6056ffe3b4d867261e3
|
7
|
+
data.tar.gz: ecdb1237f3021305b51bd3a5048b7c7b2140ff7b750d4a5104d7e755e6613327f63e86acfed62edccc133aa07f761340bdf2f0a55dd14f14f86f82c8109ed901
|
data/config/default.yml
CHANGED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'rexml/document'
|
2
|
+
|
3
|
+
module SlimLint
|
4
|
+
# Outputs report as a Checkstyle XML document.
|
5
|
+
class Reporter::CheckstyleReporter < Reporter
|
6
|
+
def display_report(report)
|
7
|
+
document = REXML::Document.new.tap do |d|
|
8
|
+
d << REXML::XMLDecl.new
|
9
|
+
end
|
10
|
+
checkstyle = REXML::Element.new('checkstyle', document)
|
11
|
+
|
12
|
+
report.lints.group_by(&:filename).map do |lint|
|
13
|
+
map_file(lint, checkstyle)
|
14
|
+
end
|
15
|
+
|
16
|
+
log.log document.to_s
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def map_file(file, checkstyle)
|
22
|
+
REXML::Element.new('file', checkstyle).tap do |f|
|
23
|
+
path_name = file.first
|
24
|
+
path_name = relative_path(file) if defined?(relative_path)
|
25
|
+
f.attributes['name'] = path_name
|
26
|
+
|
27
|
+
file.last.map { |o| map_offense(o, f) }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def map_offense(offence, parent)
|
32
|
+
REXML::Element.new('error', parent).tap do |e|
|
33
|
+
e.attributes['line'] = offence.line
|
34
|
+
e.attributes['severity'] = offence.error? ? 'error' : 'warning'
|
35
|
+
e.attributes['message'] = offence.message
|
36
|
+
e.attributes['source'] = 'slim-lint'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/slim_lint/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slim_lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shane da Silva
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slim
|
@@ -148,6 +148,7 @@ files:
|
|
148
148
|
- lib/slim_lint/rake_task.rb
|
149
149
|
- lib/slim_lint/report.rb
|
150
150
|
- lib/slim_lint/reporter.rb
|
151
|
+
- lib/slim_lint/reporter/checkstyle_reporter.rb
|
151
152
|
- lib/slim_lint/reporter/default_reporter.rb
|
152
153
|
- lib/slim_lint/reporter/json_reporter.rb
|
153
154
|
- lib/slim_lint/ruby_extract_engine.rb
|
@@ -183,4 +184,3 @@ signing_key:
|
|
183
184
|
specification_version: 4
|
184
185
|
summary: Slim template linting tool
|
185
186
|
test_files: []
|
186
|
-
has_rdoc:
|