-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Florian Eckerstorfer
committed
Jun 9, 2015
0 parents
commit dfba865
Showing
6 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pkg/* | ||
Gemfile.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
gemspec | ||
|
||
gem "scss-lint", ">= 0.32.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
# jUnit formatter for SCSS-Lint | ||
|
||
[SCSS-Lint](https://github.com/causes/scss-lint) | ||
|
||
|
||
## Requirements | ||
|
||
Ruby gem: scss-lint >= 0.32.0 | ||
|
||
|
||
## Installation | ||
|
||
```bash | ||
gem install scss_lint_reporter_junit | ||
``` | ||
|
||
Check the installation: | ||
```bash | ||
scss-lint --require=scss_lint_reporter_junit --show-formatter | ||
``` | ||
Output is something like this | ||
``` | ||
Installed formatters: | ||
- JUnit | ||
- Config | ||
- Default | ||
- Files | ||
- JSON | ||
``` | ||
|
||
## Usage | ||
|
||
```bash | ||
scss-lint --require=scss_lint_reporter_junit --format=JUnit foo.scss | ||
``` | ||
[More detailed examples](https://github.com/causes/scss-lint/blob/master/README.md#usage) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
begin | ||
require 'bundler' | ||
Bundler.setup | ||
rescue LoadError | ||
$stderr.puts 'You need to have Bundler installed to be able build this gem.' | ||
end | ||
|
||
gemspec = eval(File.read(Dir["*.gemspec"].first)) | ||
|
||
|
||
desc "Validate the gemspec" | ||
task :validate do | ||
gemspec.validate | ||
end | ||
|
||
desc "Build gem locally" | ||
task :build => :validate do | ||
system "gem build #{gemspec.name}.gemspec" | ||
FileUtils.mkdir_p "pkg" | ||
FileUtils.mv "#{gemspec.name}-#{gemspec.version}.gem", "pkg" | ||
end | ||
|
||
desc "Install gem locally" | ||
task :install => :build do | ||
system "gem install ./pkg/#{gemspec.name}-#{gemspec.version}.gem" | ||
end | ||
|
||
desc "Remove generated files" | ||
task :clean do | ||
FileUtils.rm_rf "pkg" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
module SCSSLint | ||
class Reporter::JUnitReporter < Reporter | ||
def report_lints | ||
results = lints.group_by(&:filename) | ||
output = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" | ||
|
||
output << "<testsuite name=\"scsslint\" failures=\"#{results.length}\">\n" | ||
if !results.length | ||
output << " <testcase name=\"Empty\"/>\n" | ||
end | ||
results.each do |file_name, errors| | ||
output << " <testcase name=#{file_name.encode(xml: :attr)}>\n" | ||
output << " <failure message=\"#{errors.length} SCSSLint Failure\">" | ||
|
||
i = 1 | ||
errors.each do |error| | ||
output << "#{i}. line #{error.location.line}, column #{error.location.column}-" \ | ||
"#{error.location.length}: [#{error.severity}] #{error.linter.name if error.linter}: "\ | ||
"#{error.description.encode(xml: :attr)}" | ||
i += 1 | ||
end | ||
output << "</failure>\n" | ||
output << " </testcase>\n" | ||
end | ||
output << "</testsuite>\n" | ||
|
||
output | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# coding: UTF-8 | ||
|
||
Gem::Specification.new do |s| | ||
s.platform = Gem::Platform::RUBY | ||
s.license = "MIT" | ||
s.name = "scss_lint_reporter_junit" | ||
s.version = "0.1.0" | ||
s.summary = "Extend the scss-lint with a jUnit formatter" | ||
s.description = "This gem add a new formatter to the scss-lint which is compatible with the jUnit standard." | ||
s.homepage = "https://github.com/florianeckerstorfer/scss_lint_reporter_junit" | ||
s.authors = ["Florian Eckerstorfer"] | ||
s.email = ["[email protected]"] | ||
s.required_rubygems_version = ">= 1.3.6" | ||
s.files = s.files = Dir['lib/**/*.rb'] | ||
s.require_path = ['lib'] | ||
end |