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.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/Dockerfile +1 -1
  3. data/Rakefile +32 -22
  4. data/circle.yml +0 -2
  5. data/config/checkstyle/checkstyle_logger-6.6-all.jar +0 -0
  6. data/config/checkstyle/sun_checks.xml +2 -1
  7. data/docker/checkstyle/Dockerfile +19 -0
  8. data/docker/coffeelint/Dockerfile +21 -0
  9. data/docker/cppcheck/Dockerfile +24 -0
  10. data/docker/csslint/Dockerfile +21 -0
  11. data/docker/golint/Dockerfile +19 -0
  12. data/docker/jshint/Dockerfile +21 -0
  13. data/docker/jsonlint/Dockerfile +21 -0
  14. data/docker/pylint/Dockerfile +24 -0
  15. data/docker/rubocop/Dockerfile +21 -0
  16. data/docker/scsslint/Dockerfile +21 -0
  17. data/lib/lint_trap/command.rb +2 -3
  18. data/lib/lint_trap/container/base.rb +10 -3
  19. data/lib/lint_trap/container/docker.rb +16 -3
  20. data/lib/lint_trap/container/fake.rb +3 -0
  21. data/lib/lint_trap/execution_error.rb +12 -0
  22. data/lib/lint_trap/linter/base.rb +29 -18
  23. data/lib/lint_trap/linter/checkstyle.rb +12 -5
  24. data/lib/lint_trap/linter/coffeelint.rb +6 -2
  25. data/lib/lint_trap/linter/cppcheck.rb +5 -1
  26. data/lib/lint_trap/linter/csslint.rb +6 -2
  27. data/lib/lint_trap/linter/golint.rb +6 -2
  28. data/lib/lint_trap/linter/jshint.rb +6 -2
  29. data/lib/lint_trap/linter/jsonlint.rb +6 -2
  30. data/lib/lint_trap/linter/pylint.rb +5 -1
  31. data/lib/lint_trap/linter/rubocop.rb +6 -2
  32. data/lib/lint_trap/linter/scsslint.rb +7 -3
  33. data/lib/lint_trap/linter/unknown.rb +4 -0
  34. data/lib/lint_trap/linter.rb +4 -0
  35. data/lib/lint_trap/parser/base.rb +1 -1
  36. data/lib/lint_trap/parser/line.rb +12 -6
  37. data/lib/lint_trap/version.rb +1 -1
  38. data/lint_trap.gemspec +15 -14
  39. data/spec/command_spec.rb +8 -5
  40. data/spec/container/base_spec.rb +31 -0
  41. data/spec/container/docker_spec.rb +27 -7
  42. data/spec/execution_error_spec.rb +11 -0
  43. data/spec/integration/base_spec.rb +33 -0
  44. data/spec/integration/checkstyle_spec.rb +1 -1
  45. data/spec/integration/coffeelint_spec.rb +16 -10
  46. data/spec/integration/cppcheck_spec.rb +9 -1
  47. data/spec/integration/csslint_spec.rb +16 -10
  48. data/spec/integration/golint_spec.rb +8 -10
  49. data/spec/integration/jshint_spec.rb +9 -1
  50. data/spec/integration/jsonlint_spec.rb +9 -1
  51. data/spec/integration/pylint_spec.rb +9 -1
  52. data/spec/integration/rubocop_spec.rb +9 -1
  53. data/spec/integration/scsslint_spec.rb +16 -10
  54. data/spec/language/coffeescript_spec.rb +1 -0
  55. data/spec/language/cpp_spec.rb +1 -0
  56. data/spec/language/css_spec.rb +1 -0
  57. data/spec/language/go_spec.rb +1 -0
  58. data/spec/language/java_spec.rb +1 -0
  59. data/spec/language/javascript_spec.rb +1 -0
  60. data/spec/language/json_spec.rb +1 -0
  61. data/spec/language/python_spec.rb +1 -0
  62. data/spec/language/ruby_spec.rb +1 -0
  63. data/spec/language/scss_spec.rb +1 -0
  64. data/spec/language/unknown_spec.rb +1 -0
  65. data/spec/linter/base_spec.rb +24 -0
  66. data/spec/linter/checkstyle_spec.rb +8 -4
  67. data/spec/linter/coffeelint_spec.rb +5 -2
  68. data/spec/linter/cppcheck_spec.rb +4 -1
  69. data/spec/linter/csslint_spec.rb +5 -2
  70. data/spec/linter/golint_spec.rb +4 -1
  71. data/spec/linter/jshint_spec.rb +5 -2
  72. data/spec/linter/jsonlint_spec.rb +4 -1
  73. data/spec/linter/pylint_spec.rb +5 -2
  74. data/spec/linter/rubocop_spec.rb +5 -2
  75. data/spec/linter/scsslint_spec.rb +5 -2
  76. data/spec/linter/unknown_spec.rb +3 -0
  77. data/spec/linter_spec.rb +20 -1
  78. data/spec/parser/base_spec.rb +13 -0
  79. data/spec/parser/csslint_spec.rb +3 -1
  80. data/spec/parser/line_spec.rb +13 -0
  81. data/spec/parser/standard_spec.rb +4 -2
  82. data/spec/parser/vim_quickfix_spec.rb +10 -10
  83. data/spec/spec_helper.rb +15 -0
  84. data/spec/support/dockerfile.rb +12 -0
  85. data/spec/support/examples/language.rb +1 -1
  86. metadata +43 -4
  87. 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
@@ -8,9 +8,13 @@ module LintTrap
8
8
  super(Language::Python)
9
9
  end
10
10
 
11
+ def version
12
+ '1.3.1-3'
13
+ end
14
+
11
15
  private
12
16
 
13
- def flags
17
+ def flags(_container, options)
14
18
  [
15
19
  '-r', 'no',
16
20
  '--msg-template', '"{abspath}:{line}:{column}::{symbol}:{category}:{msg}"'
@@ -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 command_name
14
- config_path(COMMAND)
13
+ def version
14
+ '0.38.0'
15
15
  end
16
16
 
17
- def flags
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|
@@ -14,6 +14,10 @@ module LintTrap
14
14
  super(Language::Unknown)
15
15
  end
16
16
 
17
+ def version
18
+ LintTrap::VERSION
19
+ end
20
+
17
21
  def known?
18
22
  false
19
23
  end
@@ -26,6 +26,10 @@ module LintTrap
26
26
  linters[name]
27
27
  end
28
28
 
29
+ def all
30
+ linters.values
31
+ end
32
+
29
33
  protected
30
34
 
31
35
  attr_reader :linters
@@ -7,7 +7,7 @@ module LintTrap
7
7
  end
8
8
 
9
9
  def parse
10
- raise NotImplementedError, "Subclass #{self.class.name} must implement parse."
10
+ raise NotImplementedError, "Must implement parse."
11
11
  end
12
12
 
13
13
  protected
@@ -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
- io.each_line do |line|
9
- puts line if ENV['DEBUG_LINTING']
10
- next unless (violation = parse_line(line))
8
+ output = ''
11
9
 
12
- yield violation
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 = violation_fields.each_with_object({}) do |field, 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, "Subclass #{self.class.name} must implement violation_regex."
43
+ raise NotImplementedError, "Must implement violation_regex."
38
44
  end
39
45
 
40
46
  def standardize(violation)
@@ -1,3 +1,3 @@
1
1
  module LintTrap
2
- VERSION = '0.0.11'
2
+ VERSION = '0.0.13'
3
3
  end
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 = "lint_trap"
7
+ spec.name = 'lint_trap'
8
8
  spec.version = LintTrap::VERSION
9
- spec.authors = ["Allen Madsen"]
10
- spec.email = ["blatyo@gmail.com"]
11
- spec.summary = %q{Parses the output of various linters.}
12
- spec.description = %q{Parses the output of various linters.}
13
- spec.homepage = "https://github.com/lintci/lint_trap"
14
- spec.license = "MIT"
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/}) { |f| File.basename(f) }
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 = ["lib"]
19
+ spec.require_paths = ['lib']
20
20
 
21
21
  spec.add_runtime_dependency 'github-linguist', '~> 4.2'
22
22
 
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"
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/spin_cycle', fixture_path)}
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
- "docker run --privileged=false -v #{LintTrap::Container::Base::LOCAL_CONFIG_PATH}:/opt/lint_trap/config "\
20
- "-v #{fixture_path}:/home/spin_cycle --workdir=/home/spin_cycle --user=spin_cycle lintci/spin_cycle "\
21
- 'cat -b /home/spin_cycle/lint.txt'
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
- subject(:container){described_class.new('lintci/spin_cycle:latest', '/local/path')}
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}:/opt/lint_trap/config "\
11
- '-v /local/path:/home/spin_cycle '\
12
- '--workdir=/home/spin_cycle --user=spin_cycle lintci/spin_cycle:latest ls'
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('/home/spin_cycle/bad.file')
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('/home/spin_cycle/bad.file')).to eq('/local/path/bad.file')
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('lintci/spin_cycle:latest', fixture_path)}
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('lintci/spin_cycle:latest', fixture_path)}
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
- file: file,
16
- line: '1',
17
- column: nil,
18
- length: nil,
19
- rule: 'camel_case_classes',
20
- severity: 'error',
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('lintci/spin_cycle:latest', fixture_path)}
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('lintci/spin_cycle:latest', fixture_path)}
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
- file: file,
16
- line: '2',
17
- column: '5',
18
- length: nil,
19
- rule: nil,
20
- severity: 'Warning',
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('lintci/spin_cycle:latest', fixture_path)}
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
- file: file,
16
- line: '5',
17
- column: '1',
18
- length: nil,
19
- rule: nil,
20
- severity: nil,
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('lintci/spin_cycle:latest', fixture_path)}
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('lintci/spin_cycle:latest', fixture_path)}
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('lintci/spin_cycle:latest', fixture_path)}
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('lintci/spin_cycle:latest', fixture_path)}
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')}