lint_trap 0.0.11 → 0.0.13
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/Dockerfile +1 -1
- data/Rakefile +32 -22
- data/circle.yml +0 -2
- data/config/checkstyle/checkstyle_logger-6.6-all.jar +0 -0
- data/config/checkstyle/sun_checks.xml +2 -1
- data/docker/checkstyle/Dockerfile +19 -0
- data/docker/coffeelint/Dockerfile +21 -0
- data/docker/cppcheck/Dockerfile +24 -0
- data/docker/csslint/Dockerfile +21 -0
- data/docker/golint/Dockerfile +19 -0
- data/docker/jshint/Dockerfile +21 -0
- data/docker/jsonlint/Dockerfile +21 -0
- data/docker/pylint/Dockerfile +24 -0
- data/docker/rubocop/Dockerfile +21 -0
- data/docker/scsslint/Dockerfile +21 -0
- data/lib/lint_trap/command.rb +2 -3
- data/lib/lint_trap/container/base.rb +10 -3
- data/lib/lint_trap/container/docker.rb +16 -3
- data/lib/lint_trap/container/fake.rb +3 -0
- data/lib/lint_trap/execution_error.rb +12 -0
- data/lib/lint_trap/linter/base.rb +29 -18
- data/lib/lint_trap/linter/checkstyle.rb +12 -5
- data/lib/lint_trap/linter/coffeelint.rb +6 -2
- data/lib/lint_trap/linter/cppcheck.rb +5 -1
- data/lib/lint_trap/linter/csslint.rb +6 -2
- data/lib/lint_trap/linter/golint.rb +6 -2
- data/lib/lint_trap/linter/jshint.rb +6 -2
- data/lib/lint_trap/linter/jsonlint.rb +6 -2
- data/lib/lint_trap/linter/pylint.rb +5 -1
- data/lib/lint_trap/linter/rubocop.rb +6 -2
- data/lib/lint_trap/linter/scsslint.rb +7 -3
- data/lib/lint_trap/linter/unknown.rb +4 -0
- data/lib/lint_trap/linter.rb +4 -0
- data/lib/lint_trap/parser/base.rb +1 -1
- data/lib/lint_trap/parser/line.rb +12 -6
- data/lib/lint_trap/version.rb +1 -1
- data/lint_trap.gemspec +15 -14
- data/spec/command_spec.rb +8 -5
- data/spec/container/base_spec.rb +31 -0
- data/spec/container/docker_spec.rb +27 -7
- data/spec/execution_error_spec.rb +11 -0
- data/spec/integration/base_spec.rb +33 -0
- data/spec/integration/checkstyle_spec.rb +1 -1
- data/spec/integration/coffeelint_spec.rb +16 -10
- data/spec/integration/cppcheck_spec.rb +9 -1
- data/spec/integration/csslint_spec.rb +16 -10
- data/spec/integration/golint_spec.rb +8 -10
- data/spec/integration/jshint_spec.rb +9 -1
- data/spec/integration/jsonlint_spec.rb +9 -1
- data/spec/integration/pylint_spec.rb +9 -1
- data/spec/integration/rubocop_spec.rb +9 -1
- data/spec/integration/scsslint_spec.rb +16 -10
- data/spec/language/coffeescript_spec.rb +1 -0
- data/spec/language/cpp_spec.rb +1 -0
- data/spec/language/css_spec.rb +1 -0
- data/spec/language/go_spec.rb +1 -0
- data/spec/language/java_spec.rb +1 -0
- data/spec/language/javascript_spec.rb +1 -0
- data/spec/language/json_spec.rb +1 -0
- data/spec/language/python_spec.rb +1 -0
- data/spec/language/ruby_spec.rb +1 -0
- data/spec/language/scss_spec.rb +1 -0
- data/spec/language/unknown_spec.rb +1 -0
- data/spec/linter/base_spec.rb +24 -0
- data/spec/linter/checkstyle_spec.rb +8 -4
- data/spec/linter/coffeelint_spec.rb +5 -2
- data/spec/linter/cppcheck_spec.rb +4 -1
- data/spec/linter/csslint_spec.rb +5 -2
- data/spec/linter/golint_spec.rb +4 -1
- data/spec/linter/jshint_spec.rb +5 -2
- data/spec/linter/jsonlint_spec.rb +4 -1
- data/spec/linter/pylint_spec.rb +5 -2
- data/spec/linter/rubocop_spec.rb +5 -2
- data/spec/linter/scsslint_spec.rb +5 -2
- data/spec/linter/unknown_spec.rb +3 -0
- data/spec/linter_spec.rb +20 -1
- data/spec/parser/base_spec.rb +13 -0
- data/spec/parser/csslint_spec.rb +3 -1
- data/spec/parser/line_spec.rb +13 -0
- data/spec/parser/standard_spec.rb +4 -2
- data/spec/parser/vim_quickfix_spec.rb +10 -10
- data/spec/spec_helper.rb +15 -0
- data/spec/support/dockerfile.rb +12 -0
- data/spec/support/examples/language.rb +1 -1
- metadata +43 -4
- data/config/checkstyle/checkstyle_logger-all.jar +0 -0
@@ -9,9 +9,13 @@ module LintTrap
|
|
9
9
|
super(Language::CSS)
|
10
10
|
end
|
11
11
|
|
12
|
+
def version
|
13
|
+
'0.10.0'
|
14
|
+
end
|
15
|
+
|
12
16
|
private
|
13
17
|
|
14
|
-
def flags
|
18
|
+
def flags(_container, options)
|
15
19
|
[
|
16
20
|
'--format=compact'
|
17
21
|
].tap do |flags|
|
@@ -19,7 +23,7 @@ module LintTrap
|
|
19
23
|
end
|
20
24
|
end
|
21
25
|
|
22
|
-
def parser(stdout)
|
26
|
+
def parser(stdout, container)
|
23
27
|
LintTrap::Parser::CSSLint.new(stdout, container)
|
24
28
|
end
|
25
29
|
end
|
@@ -9,13 +9,17 @@ module LintTrap
|
|
9
9
|
super(Language::Go)
|
10
10
|
end
|
11
11
|
|
12
|
+
def version
|
13
|
+
LintTrap::VERSION
|
14
|
+
end
|
15
|
+
|
12
16
|
private
|
13
17
|
|
14
|
-
def flags
|
18
|
+
def flags(_container, _options)
|
15
19
|
[]
|
16
20
|
end
|
17
21
|
|
18
|
-
def parser(stdout)
|
22
|
+
def parser(stdout, container)
|
19
23
|
LintTrap::Parser::VimQuickfix.new(stdout, container)
|
20
24
|
end
|
21
25
|
end
|
@@ -10,11 +10,15 @@ module LintTrap
|
|
10
10
|
super(Language::JavaScript)
|
11
11
|
end
|
12
12
|
|
13
|
+
def version
|
14
|
+
'2.5.11'
|
15
|
+
end
|
16
|
+
|
13
17
|
private
|
14
18
|
|
15
|
-
def flags
|
19
|
+
def flags(container, options)
|
16
20
|
[
|
17
|
-
'--reporter', config_path(FORMATTER)
|
21
|
+
'--reporter', container.config_path(FORMATTER)
|
18
22
|
].tap do |flags|
|
19
23
|
flags.concat(['--config', options[:config]]) if options[:config]
|
20
24
|
end
|
@@ -8,13 +8,17 @@ module LintTrap
|
|
8
8
|
super(Language::JSON)
|
9
9
|
end
|
10
10
|
|
11
|
+
def version
|
12
|
+
'0.0.4'
|
13
|
+
end
|
14
|
+
|
11
15
|
private
|
12
16
|
|
13
|
-
def command_name
|
17
|
+
def command_name(_container)
|
14
18
|
'durable-json-lint'
|
15
19
|
end
|
16
20
|
|
17
|
-
def flags
|
21
|
+
def flags(_container, _options)
|
18
22
|
['--format', '{{file}}:{{line}}:{{column}}:::error:{{{description}}}']
|
19
23
|
end
|
20
24
|
end
|
@@ -10,11 +10,15 @@ module LintTrap
|
|
10
10
|
super(Language::Ruby)
|
11
11
|
end
|
12
12
|
|
13
|
+
def version
|
14
|
+
'0.31.0'
|
15
|
+
end
|
16
|
+
|
13
17
|
private
|
14
18
|
|
15
|
-
def flags
|
19
|
+
def flags(container, options)
|
16
20
|
[
|
17
|
-
'--require', config_path(FORMATTER),
|
21
|
+
'--require', container.config_path(FORMATTER),
|
18
22
|
'--format', 'LintTrap::Rubocop::Formatter',
|
19
23
|
'--no-color'
|
20
24
|
].tap do |flags|
|
@@ -10,11 +10,15 @@ module LintTrap
|
|
10
10
|
super(Language::SCSS)
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
14
|
-
|
13
|
+
def version
|
14
|
+
'0.38.0'
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
17
|
+
def command_name(container)
|
18
|
+
container.config_path(COMMAND)
|
19
|
+
end
|
20
|
+
|
21
|
+
def flags(_container, options)
|
18
22
|
[
|
19
23
|
'--format=LintTrap'
|
20
24
|
].tap do |flags|
|
data/lib/lint_trap/linter.rb
CHANGED
@@ -5,12 +5,17 @@ module LintTrap
|
|
5
5
|
# Handles parsing line by line with regex
|
6
6
|
class Line < Base
|
7
7
|
def parse
|
8
|
-
|
9
|
-
puts line if ENV['DEBUG_LINTING']
|
10
|
-
next unless (violation = parse_line(line))
|
8
|
+
output = ''
|
11
9
|
|
12
|
-
|
10
|
+
io.each_line do |line|
|
11
|
+
if (violation = parse_line(line))
|
12
|
+
yield violation
|
13
|
+
else
|
14
|
+
output << line
|
15
|
+
end
|
13
16
|
end
|
17
|
+
|
18
|
+
output
|
14
19
|
end
|
15
20
|
|
16
21
|
private
|
@@ -18,7 +23,8 @@ module LintTrap
|
|
18
23
|
def parse_line(line)
|
19
24
|
return unless (match = line.match(violation_regex))
|
20
25
|
|
21
|
-
violation =
|
26
|
+
violation = {}
|
27
|
+
violation_fields.each do |field|
|
22
28
|
violation[field.to_sym] = if match.names.include?(field) && !match[field].empty?
|
23
29
|
match[field]
|
24
30
|
else
|
@@ -34,7 +40,7 @@ module LintTrap
|
|
34
40
|
end
|
35
41
|
|
36
42
|
def violation_regex
|
37
|
-
raise NotImplementedError, "
|
43
|
+
raise NotImplementedError, "Must implement violation_regex."
|
38
44
|
end
|
39
45
|
|
40
46
|
def standardize(violation)
|
data/lib/lint_trap/version.rb
CHANGED
data/lint_trap.gemspec
CHANGED
@@ -4,25 +4,26 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'lint_trap/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'lint_trap'
|
8
8
|
spec.version = LintTrap::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
9
|
+
spec.authors = ['Allen Madsen']
|
10
|
+
spec.email = ['blatyo@gmail.com']
|
11
|
+
spec.summary = 'Parses the output of various linters.'
|
12
|
+
spec.description = 'Parses the output of various linters.'
|
13
|
+
spec.homepage = 'https://github.com/lintci/lint_trap'
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.executables = spec.files.grep(%r{^bin/})
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}){|f| File.basename(f)}
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = [
|
19
|
+
spec.require_paths = ['lib']
|
20
20
|
|
21
21
|
spec.add_runtime_dependency 'github-linguist', '~> 4.2'
|
22
22
|
|
23
|
-
spec.add_development_dependency
|
24
|
-
spec.add_development_dependency
|
25
|
-
spec.add_development_dependency
|
26
|
-
spec.add_development_dependency
|
27
|
-
spec.add_development_dependency
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
24
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
25
|
+
spec.add_development_dependency 'rspec'
|
26
|
+
spec.add_development_dependency 'rspec-its'
|
27
|
+
spec.add_development_dependency 'pry-byebug'
|
28
|
+
spec.add_development_dependency 'simplecov'
|
28
29
|
end
|
data/spec/command_spec.rb
CHANGED
@@ -3,22 +3,25 @@ require 'spec_helper'
|
|
3
3
|
describe LintTrap::Command do
|
4
4
|
let(:file){fixture_path('lint.txt')}
|
5
5
|
let(:command){described_class.new('cat', %w(-b), [file])}
|
6
|
-
let(:container){LintTrap::Container::Docker.new('lintci/
|
6
|
+
let(:container){LintTrap::Container::Docker.new('lintci/rubocop', fixture_path)}
|
7
7
|
|
8
8
|
describe '#run' do
|
9
9
|
it 'generates the expected output' do
|
10
|
-
command.run(container) do |io|
|
10
|
+
success = command.run(container) do |io|
|
11
11
|
expect(io.read).to eq(" 1\tlint\n")
|
12
12
|
end
|
13
|
+
|
14
|
+
expect(success).to be_truthy
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
16
18
|
describe '#command/#to_s' do
|
17
19
|
it 'generates a wrapped executable command' do
|
18
20
|
expect(command.to_s(container)).to eq(
|
19
|
-
|
20
|
-
"-v #{
|
21
|
-
|
21
|
+
'docker run --net="none" --privileged=false '\
|
22
|
+
"-v #{LintTrap::Container::Base::LOCAL_CONFIG_PATH}:/config "\
|
23
|
+
"-v #{fixture_path}:/src --workdir=/src --user=lint_trap lintci/rubocop "\
|
24
|
+
'cat -b /src/lint.txt'
|
22
25
|
)
|
23
26
|
end
|
24
27
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe LintTrap::Container::Base do
|
4
|
+
subject(:container) do
|
5
|
+
Class.new(described_class).new('lintci/rubocop', '/src')
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#pull' do
|
9
|
+
it 'raises an error if not overriden' do
|
10
|
+
expect{container.pull}.to raise_error(NotImplementedError, 'Must implement pull.')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#wrap' do
|
15
|
+
it 'raises an error if not overriden' do
|
16
|
+
expect{container.wrap('ls')}.to raise_error(NotImplementedError, 'Must implement wrap.')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#config_path' do
|
21
|
+
it 'raises an error if not overriden' do
|
22
|
+
expect{container.config_path('/config')}.to raise_error(NotImplementedError, 'Must implement config_path.')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '#file_path' do
|
27
|
+
it 'raises an error if not overriden' do
|
28
|
+
expect{container.file_path('/src')}.to raise_error(NotImplementedError, 'Must implement file_path.')
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -1,15 +1,35 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe LintTrap::Container::Docker do
|
4
|
-
|
4
|
+
let(:image){LintTrap::Linter::RuboCop.new.image_version}
|
5
|
+
subject(:container){described_class.new(image, '/local/path')}
|
6
|
+
|
7
|
+
describe '#pull' do
|
8
|
+
context 'when image exists' do
|
9
|
+
it 'completes successfully' do
|
10
|
+
expect(container.pull).to be_truthy
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'when image does not exist' do
|
15
|
+
subject(:container){described_class.new('lintci/missing', '/local/path')}
|
16
|
+
|
17
|
+
it 'raises an error' do
|
18
|
+
expect{container.pull}.to raise_error(
|
19
|
+
LintTrap::Container::Base::ImagePullError,
|
20
|
+
/An error occurred while running `docker pull lintci\/missing`. The output was:\n/
|
21
|
+
)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
5
25
|
|
6
26
|
describe '#wrap' do
|
7
27
|
it 'wraps the command passed in with a call to docker' do
|
8
28
|
expect(container.wrap('ls')).to eq(
|
9
|
-
'docker run --privileged=false '\
|
10
|
-
"-v #{described_class::LOCAL_CONFIG_PATH}:/
|
11
|
-
'-v /local/path:/
|
12
|
-
|
29
|
+
'docker run --net="none" --privileged=false '\
|
30
|
+
"-v #{described_class::LOCAL_CONFIG_PATH}:/config "\
|
31
|
+
'-v /local/path:/src '\
|
32
|
+
"--workdir=/src --user=lint_trap #{image} ls"
|
13
33
|
)
|
14
34
|
end
|
15
35
|
end
|
@@ -22,13 +42,13 @@ describe LintTrap::Container::Docker do
|
|
22
42
|
|
23
43
|
describe '#container_path' do
|
24
44
|
it 'returns the absolute path of the file in the container' do
|
25
|
-
expect(container.container_path('/local/path/bad.file')).to eq('/
|
45
|
+
expect(container.container_path('/local/path/bad.file')).to eq('/src/bad.file')
|
26
46
|
end
|
27
47
|
end
|
28
48
|
|
29
49
|
describe '#local_path' do
|
30
50
|
it 'returns the absolute path of the file outside the container' do
|
31
|
-
expect(container.local_path('/
|
51
|
+
expect(container.local_path('/src/bad.file')).to eq('/local/path/bad.file')
|
32
52
|
end
|
33
53
|
end
|
34
54
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe LintTrap::ExecutionError do
|
4
|
+
let(:command){'ls'}
|
5
|
+
let(:output){"Ain't got no time for that"}
|
6
|
+
subject(:error){described_class.new(command, output)}
|
7
|
+
|
8
|
+
its(:message){is_expected.to eq("An error occurred while running `#{command}`. The output was:\n#{output}")}
|
9
|
+
its(:command){is_expected.to eq(command)}
|
10
|
+
its(:output){is_expected.to eq(output)}
|
11
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe LintTrap::Linter::Base do
|
4
|
+
let(:image){LintTrap::Linter::RuboCop.new.image_version}
|
5
|
+
let(:container){LintTrap::Container::Docker.new(image, fixture_path)}
|
6
|
+
let(:options){{}}
|
7
|
+
subject(:linter) do
|
8
|
+
ErrorLinter = Class.new(described_class) do
|
9
|
+
def command_name(_container)
|
10
|
+
'ls'
|
11
|
+
end
|
12
|
+
|
13
|
+
def flags(_container, _options)
|
14
|
+
[]
|
15
|
+
end
|
16
|
+
end.new
|
17
|
+
end
|
18
|
+
|
19
|
+
describe '#lint' do
|
20
|
+
context 'when linting fails' do
|
21
|
+
let(:file){fixture_path('this-does-not-exist.rb')}
|
22
|
+
|
23
|
+
it 'raises an error with console output' do
|
24
|
+
expect{|b| linter.lint([file], container, options, &b)}.to raise_error(
|
25
|
+
LintTrap::Linter::LintError,
|
26
|
+
start_with(
|
27
|
+
'An error occurred while running `docker run'
|
28
|
+
)
|
29
|
+
)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe LintTrap::Linter::CheckStyle do
|
4
|
-
let(:container){LintTrap::Container::Docker.new(
|
4
|
+
let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path)}
|
5
5
|
let(:options){{}}
|
6
6
|
subject(:linter){described_class.new}
|
7
7
|
|
@@ -1,25 +1,31 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe LintTrap::Linter::CoffeeLint do
|
4
|
-
let(:container){LintTrap::Container::Docker.new(
|
4
|
+
let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path)}
|
5
5
|
let(:options){{}}
|
6
6
|
subject(:linter){described_class.new}
|
7
7
|
|
8
|
+
describe '#version' do
|
9
|
+
subject(:dockerfile){Dockerfile.new(linter.name)}
|
10
|
+
|
11
|
+
it 'matches the linters version' do
|
12
|
+
expect(dockerfile.include_env?('COFFEELINT_VERSION', linter.version)).to be_truthy
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
8
16
|
describe '#lint' do
|
9
17
|
context 'when linting a bad file' do
|
10
18
|
let(:file){fixture_path('bad.coffee')}
|
11
19
|
|
12
20
|
it 'generates lint' do
|
13
21
|
expect{|b| linter.lint([file], container, options, &b)}.to yield_successive_args(
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
message: 'Class names should be camel cased'
|
22
|
-
}
|
22
|
+
file: file,
|
23
|
+
line: '1',
|
24
|
+
column: nil,
|
25
|
+
length: nil,
|
26
|
+
rule: 'camel_case_classes',
|
27
|
+
severity: 'error',
|
28
|
+
message: 'Class name should be UpperCamelCased'
|
23
29
|
)
|
24
30
|
end
|
25
31
|
end
|
@@ -1,10 +1,18 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe LintTrap::Linter::CPPCheck do
|
4
|
-
let(:container){LintTrap::Container::Docker.new(
|
4
|
+
let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path)}
|
5
5
|
let(:options){{}}
|
6
6
|
subject(:linter){described_class.new}
|
7
7
|
|
8
|
+
describe '#version' do
|
9
|
+
subject(:dockerfile){Dockerfile.new(linter.name)}
|
10
|
+
|
11
|
+
it 'matches the linters version' do
|
12
|
+
expect(dockerfile.include_env?('CPPCHECK_VERSION', linter.version)).to be_truthy
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
8
16
|
describe '#lint' do
|
9
17
|
context 'when linting a bad file' do
|
10
18
|
let(:file){fixture_path('bad.cpp')}
|
@@ -1,25 +1,31 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe LintTrap::Linter::CSSLint do
|
4
|
-
let(:container){LintTrap::Container::Docker.new(
|
4
|
+
let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path)}
|
5
5
|
let(:options){{}}
|
6
6
|
subject(:linter){described_class.new}
|
7
7
|
|
8
|
+
describe '#version' do
|
9
|
+
subject(:dockerfile){Dockerfile.new(linter.name)}
|
10
|
+
|
11
|
+
it 'matches the linters version' do
|
12
|
+
expect(dockerfile.include_env?('CSSLINT_VERSION', linter.version)).to be_truthy
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
8
16
|
describe '#lint' do
|
9
17
|
context 'when linting a bad file' do
|
10
18
|
let(:file){fixture_path('bad.css')}
|
11
19
|
|
12
20
|
it 'generates lint' do
|
13
21
|
expect{|b| linter.lint([file], container, options, &b)}.to yield_successive_args(
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
message: 'Using width with border can sometimes make elements larger than you expect.'
|
22
|
-
}
|
22
|
+
file: file,
|
23
|
+
line: '2',
|
24
|
+
column: '5',
|
25
|
+
length: nil,
|
26
|
+
rule: nil,
|
27
|
+
severity: 'Warning',
|
28
|
+
message: 'Using width with border can sometimes make elements larger than you expect.'
|
23
29
|
)
|
24
30
|
end
|
25
31
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe LintTrap::Linter::GoLint do
|
4
|
-
let(:container){LintTrap::Container::Docker.new(
|
4
|
+
let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path)}
|
5
5
|
let(:options){{}}
|
6
6
|
subject(:linter){described_class.new}
|
7
7
|
|
@@ -11,15 +11,13 @@ describe LintTrap::Linter::GoLint do
|
|
11
11
|
|
12
12
|
it 'generates lint' do
|
13
13
|
expect{|b| linter.lint([file], container, options, &b)}.to yield_successive_args(
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
message: 'exported function Main should have comment or be unexported'
|
22
|
-
}
|
14
|
+
file: file,
|
15
|
+
line: '5',
|
16
|
+
column: '1',
|
17
|
+
length: nil,
|
18
|
+
rule: nil,
|
19
|
+
severity: nil,
|
20
|
+
message: 'exported function Main should have comment or be unexported'
|
23
21
|
)
|
24
22
|
end
|
25
23
|
end
|
@@ -1,10 +1,18 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe LintTrap::Linter::JSHint do
|
4
|
-
let(:container){LintTrap::Container::Docker.new(
|
4
|
+
let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path)}
|
5
5
|
let(:options){{}}
|
6
6
|
subject(:linter){described_class.new}
|
7
7
|
|
8
|
+
describe '#version' do
|
9
|
+
subject(:dockerfile){Dockerfile.new(linter.name)}
|
10
|
+
|
11
|
+
it 'matches the linters version' do
|
12
|
+
expect(dockerfile.include_env?('JSHINT_VERSION', linter.version)).to be_truthy
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
8
16
|
describe '#lint' do
|
9
17
|
context 'when linting a bad file' do
|
10
18
|
let(:file){fixture_path('bad.js')}
|
@@ -1,10 +1,18 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe LintTrap::Linter::JSONLint do
|
4
|
-
let(:container){LintTrap::Container::Docker.new(
|
4
|
+
let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path)}
|
5
5
|
let(:options){{}}
|
6
6
|
subject(:linter){described_class.new}
|
7
7
|
|
8
|
+
describe '#version' do
|
9
|
+
subject(:dockerfile){Dockerfile.new(linter.name)}
|
10
|
+
|
11
|
+
it 'matches the linters version' do
|
12
|
+
expect(dockerfile.include_env?('JSONLINT_VERSION', linter.version)).to be_truthy
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
8
16
|
describe '#lint' do
|
9
17
|
context 'when linting a bad file' do
|
10
18
|
let(:file){fixture_path('bad.json')}
|
@@ -1,10 +1,18 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe LintTrap::Linter::PyLint do
|
4
|
-
let(:container){LintTrap::Container::Docker.new(
|
4
|
+
let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path)}
|
5
5
|
let(:options){{}}
|
6
6
|
subject(:linter){described_class.new}
|
7
7
|
|
8
|
+
describe '#version' do
|
9
|
+
subject(:dockerfile){Dockerfile.new(linter.name)}
|
10
|
+
|
11
|
+
it 'matches the linters version' do
|
12
|
+
expect(dockerfile.include_env?('PYLINT_VERSION', linter.version)).to be_truthy
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
8
16
|
describe '#lint' do
|
9
17
|
context 'when linting a bad file' do
|
10
18
|
let(:file){fixture_path('bad.py')}
|
@@ -1,10 +1,18 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe LintTrap::Linter::RuboCop do
|
4
|
-
let(:container){LintTrap::Container::Docker.new(
|
4
|
+
let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path)}
|
5
5
|
let(:options){{}}
|
6
6
|
subject(:linter){described_class.new}
|
7
7
|
|
8
|
+
describe '#version' do
|
9
|
+
subject(:dockerfile){Dockerfile.new(linter.name)}
|
10
|
+
|
11
|
+
it 'matches the linters version' do
|
12
|
+
expect(dockerfile.include_env?('RUBOCOP_VERSION', linter.version)).to be_truthy
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
8
16
|
describe '#lint' do
|
9
17
|
context 'when linting a bad file' do
|
10
18
|
let(:file){fixture_path('bad.rb')}
|