lint_trap 0.0.6 → 0.0.7

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 (52) hide show
  1. checksums.yaml +4 -4
  2. data/lib/lint_trap/command.rb +2 -2
  3. data/lib/lint_trap/language/base.rb +5 -5
  4. data/lib/lint_trap/language/coffeescript.rb +1 -1
  5. data/lib/lint_trap/language/cpp.rb +2 -2
  6. data/lib/lint_trap/language/css.rb +1 -1
  7. data/lib/lint_trap/language/go.rb +1 -1
  8. data/lib/lint_trap/language/java.rb +1 -1
  9. data/lib/lint_trap/language/javascript.rb +1 -1
  10. data/lib/lint_trap/language/json.rb +1 -1
  11. data/lib/lint_trap/language/python.rb +1 -1
  12. data/lib/lint_trap/language/ruby.rb +1 -1
  13. data/lib/lint_trap/language/scss.rb +1 -1
  14. data/lib/lint_trap/language.rb +3 -2
  15. data/lib/lint_trap/linter/base.rb +8 -11
  16. data/lib/lint_trap/linter.rb +4 -2
  17. data/lib/lint_trap/version.rb +1 -1
  18. data/spec/command_spec.rb +8 -21
  19. data/spec/integration/checkstyle_spec.rb +6 -15
  20. data/spec/integration/coffeelint_spec.rb +6 -15
  21. data/spec/integration/cppcheck_spec.rb +6 -15
  22. data/spec/integration/csslint_spec.rb +6 -15
  23. data/spec/integration/golint_spec.rb +6 -15
  24. data/spec/integration/jshint_spec.rb +6 -15
  25. data/spec/integration/jsonlint_spec.rb +6 -15
  26. data/spec/integration/pylint_spec.rb +6 -15
  27. data/spec/integration/rubocop_spec.rb +6 -15
  28. data/spec/integration/scsslint_spec.rb +6 -15
  29. data/spec/language/coffeescript_spec.rb +1 -1
  30. data/spec/language/cpp_spec.rb +1 -1
  31. data/spec/language/css_spec.rb +1 -1
  32. data/spec/language/go_spec.rb +1 -1
  33. data/spec/language/java_spec.rb +1 -1
  34. data/spec/language/javascript_spec.rb +1 -1
  35. data/spec/language/json_spec.rb +1 -1
  36. data/spec/language/python_spec.rb +1 -1
  37. data/spec/language/ruby_spec.rb +1 -1
  38. data/spec/language/scss_spec.rb +1 -1
  39. data/spec/language_spec.rb +20 -20
  40. data/spec/linter/checkstyle_spec.rb +6 -6
  41. data/spec/linter/coffeelint_spec.rb +5 -5
  42. data/spec/linter/cppcheck_spec.rb +3 -3
  43. data/spec/linter/csslint_spec.rb +5 -5
  44. data/spec/linter/golint_spec.rb +3 -3
  45. data/spec/linter/jshint_spec.rb +6 -6
  46. data/spec/linter/jsonlint_spec.rb +3 -3
  47. data/spec/linter/pylint_spec.rb +6 -6
  48. data/spec/linter/rubocop_spec.rb +6 -6
  49. data/spec/linter/scsslint_spec.rb +5 -5
  50. data/spec/linter_spec.rb +16 -10
  51. data/spec/spec_helper.rb +1 -0
  52. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2f396478f2c6a32c23ecfdf34a20676b4ed71758
4
- data.tar.gz: a9e32df036ae6f899d5e3faded18fa079f9038b1
3
+ metadata.gz: 048fa7d8ad65b35c53e5c8cf57560334b8cb55ec
4
+ data.tar.gz: 3847e8340d6b6f5ba74b66596d23163d18436ee7
5
5
  SHA512:
6
- metadata.gz: 500e66d0eecf70fa532c19f49cd7799db0bdd2bb97199722a4c8458cc6c090f6c279af0610229eb8afd16bbaf5b94a1c611084cb87793d8e990499d53ae01bf0
7
- data.tar.gz: e36300d63d52083907aef118e1e2326f3dddf87801ed7249fc62ac157a21f27982bca86fc0c68a11f7dd33d9e041721e8d844689cd646aecefc3505fda8e580b
6
+ metadata.gz: 34a346a1866a70b46d71a336ef591c2a26738209ad7424da6ef9847bcff1585df5bb19349cdb1af29976ad4e9a61aa3ad987364a07b9720a6adf9e4e54d007ce
7
+ data.tar.gz: a109bda2726893b13598208b154ef35e1fd7be8d07ac660a76253d0c6db0f2514328acdb75a36c5fb9cd2487e37b3558a676cca959982d320495daccaa914bc8
@@ -15,7 +15,7 @@ module LintTrap
15
15
  def run(container)
16
16
  Bundler.with_clean_env do
17
17
  puts command(container) if ENV['DEBUG_LINTING']
18
- Open3.popen3(command(container)) do |_, stdout, _, thread|
18
+ Open3.popen2e(command(container)) do |_, stdout, thread|
19
19
  yield stdout
20
20
 
21
21
  thread.join
@@ -24,7 +24,7 @@ module LintTrap
24
24
  end
25
25
 
26
26
  def command(container = LintTrap::Container::Fake.new)
27
- container.wrap("#{binary} #{flags} #{files(container)} 2>&1")
27
+ container.wrap("#{binary} #{flags} #{files(container)}")
28
28
  end
29
29
  alias_method :to_s, :command
30
30
 
@@ -2,17 +2,17 @@ module LintTrap
2
2
  module Language
3
3
  # Interface for languages
4
4
  class Base
5
- def self.canonical_name
6
- name.split('::').last
7
- end
8
-
9
5
  def name
10
- self.class.canonical_name
6
+ self.class.name.split('::').last
11
7
  end
12
8
 
13
9
  def linters
14
10
  raise NotImplementedError, 'Must define what linters this language supports.'
15
11
  end
12
+
13
+ def ==(other)
14
+ name == other.name
15
+ end
16
16
  end
17
17
  end
18
18
  end
@@ -6,7 +6,7 @@ module LintTrap
6
6
  # CoffeeScript
7
7
  class CoffeeScript < Base
8
8
  def linters
9
- [Linter::CoffeeLint]
9
+ [Linter::CoffeeLint].map(&:new)
10
10
  end
11
11
  end
12
12
  end
@@ -5,12 +5,12 @@ module LintTrap
5
5
  module Language
6
6
  # C++
7
7
  class CPP < Base
8
- def self.canonical_name
8
+ def name
9
9
  'C++'
10
10
  end
11
11
 
12
12
  def linters
13
- [Linter::CPPCheck]
13
+ [Linter::CPPCheck].map(&:new)
14
14
  end
15
15
  end
16
16
  end
@@ -6,7 +6,7 @@ module LintTrap
6
6
  # CSS
7
7
  class CSS < Base
8
8
  def linters
9
- [Linter::CSSLint]
9
+ [Linter::CSSLint].map(&:new)
10
10
  end
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ module LintTrap
6
6
  # Go
7
7
  class Go < Base
8
8
  def linters
9
- [Linter::GoLint]
9
+ [Linter::GoLint].map(&:new)
10
10
  end
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ module LintTrap
6
6
  # Java
7
7
  class Java < Base
8
8
  def linters
9
- [Linter::CheckStyle]
9
+ [Linter::CheckStyle].map(&:new)
10
10
  end
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ module LintTrap
6
6
  # JavaScript
7
7
  class JavaScript < Base
8
8
  def linters
9
- [Linter::JSHint]
9
+ [Linter::JSHint].map(&:new)
10
10
  end
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ module LintTrap
6
6
  # JSON
7
7
  class JSON < Base
8
8
  def linters
9
- [Linter::JSONLint]
9
+ [Linter::JSONLint].map(&:new)
10
10
  end
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ module LintTrap
6
6
  # Python
7
7
  class Python < Base
8
8
  def linters
9
- [Linter::PyLint]
9
+ [Linter::PyLint].map(&:new)
10
10
  end
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ module LintTrap
6
6
  # Ruby
7
7
  class Ruby < Base
8
8
  def linters
9
- [Linter::RuboCop]
9
+ [Linter::RuboCop].map(&:new)
10
10
  end
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ module LintTrap
6
6
  # SCSS
7
7
  class SCSS < Base
8
8
  def linters
9
- [Linter::SCSSLint]
9
+ [Linter::SCSSLint].map(&:new)
10
10
  end
11
11
  end
12
12
  end
@@ -17,8 +17,9 @@ module LintTrap
17
17
  @languages = {}
18
18
 
19
19
  class << self
20
- def register(language)
21
- languages[language.canonical_name] = language
20
+ def register(language_class)
21
+ language = language_class.new
22
+ languages[language.name] = language
22
23
  end
23
24
 
24
25
  def detect(file)
@@ -7,16 +7,9 @@ module LintTrap
7
7
  class Base
8
8
  CONFIG_PATH = File.expand_path('../../../../config', __FILE__)
9
9
 
10
- def self.canonical_name
11
- name.split('::').last
12
- end
13
-
14
- def initialize(container:, **options)
15
- @container = container
16
- @options = options
17
- end
10
+ def lint(files, container, options)
11
+ @container, @options = container, options
18
12
 
19
- def lint(files)
20
13
  command(files).run(container) do |stdout|
21
14
  parser(stdout).parse do |violation|
22
15
  yield violation
@@ -25,7 +18,11 @@ module LintTrap
25
18
  end
26
19
 
27
20
  def name
28
- self.class.canonical_name
21
+ self.class.name.split('::').last
22
+ end
23
+
24
+ def ==(other)
25
+ name == other.name
29
26
  end
30
27
 
31
28
  protected
@@ -46,7 +43,7 @@ module LintTrap
46
43
  container.config_path(path)
47
44
  end
48
45
 
49
- def flags
46
+ def flags(options)
50
47
  raise NotImplementedError, 'Method flags must be implemented.'
51
48
  end
52
49
 
@@ -15,8 +15,10 @@ module LintTrap
15
15
  @linters = {}
16
16
 
17
17
  class << self
18
- def register(linter)
19
- linters[linter.canonical_name] = linter
18
+ def register(linter_class)
19
+ linter = linter_class.new
20
+
21
+ linters[linter.name] = linter
20
22
  end
21
23
 
22
24
  def find(name)
@@ -1,3 +1,3 @@
1
1
  module LintTrap
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  end
data/spec/command_spec.rb CHANGED
@@ -1,13 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe LintTrap::Command do
4
- let(:file){'fake file.txt'}
4
+ let(:file){fixture_path('lint.txt')}
5
5
  let(:command){described_class.new('cat', %w(-b), [file])}
6
- let(:container){LintTrap::Container::Fake.new}
6
+ let(:container){LintTrap::Container::Docker.new('lintci/spin_cycle', fixture_path)}
7
7
 
8
8
  describe '#run' do
9
- let(:file){File.expand_path('../fixtures/lint.txt', __FILE__)}
10
-
11
9
  it 'generates the expected output' do
12
10
  command.run(container) do |io|
13
11
  expect(io.read).to eq(" 1\tlint\n")
@@ -16,23 +14,12 @@ describe LintTrap::Command do
16
14
  end
17
15
 
18
16
  describe '#command/#to_s' do
19
- context 'with fake container' do
20
- it 'generates a bare executable command' do
21
- expect(command.to_s).to eq('cat -b fake\ file.txt 2>&1')
22
- end
23
- end
24
-
25
- context 'with docker container' do
26
- let(:file){fixture_path('lint.txt')}
27
- let(:container){LintTrap::Container::Docker.new('lint/runner', fixture_path)}
28
-
29
- it 'generates a wrapped executable command' do
30
- expect(command.to_s(container)).to eq(
31
- "docker run --privileged=false -v #{LintTrap::Container::Base::LOCAL_CONFIG_PATH}:/opt/lint_trap/config "\
32
- "-v #{fixture_path}:/home/spin_cycle --workdir=/home/spin_cycle --user=spin_cycle lint/runner "\
33
- 'cat -b /home/spin_cycle/lint.txt 2>&1'
34
- )
35
- end
17
+ it 'generates a wrapped executable command' do
18
+ 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'
22
+ )
36
23
  end
37
24
  end
38
25
  end
@@ -1,15 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe LintTrap::Linter::CheckStyle do
4
- let(:container){LintTrap::Container::Fake.new}
5
- subject(:linter){described_class.new(container: container)}
4
+ let(:container){LintTrap::Container::Docker.new('lintci/spin_cycle:latest', fixture_path)}
5
+ let(:options){{}}
6
+ subject(:linter){described_class.new}
6
7
 
7
- shared_examples '#lint' do
8
+ describe '#lint' do
8
9
  context 'when linting a bad file' do
9
10
  let(:file){fixture_path('bad.java')}
10
11
 
11
12
  it 'generates lint' do
12
- expect{|b| linter.lint([file], &b)}.to yield_successive_args(
13
+ expect{|b| linter.lint([file], container, options, &b)}.to yield_successive_args(
13
14
  {
14
15
  file: file,
15
16
  line: '1',
@@ -35,18 +36,8 @@ describe LintTrap::Linter::CheckStyle do
35
36
  let(:file){fixture_path('Good.java')}
36
37
 
37
38
  it 'generates no lint' do
38
- expect{|b| linter.lint([file], &b)}.to_not yield_control
39
+ expect{|b| linter.lint([file], container, options, &b)}.to_not yield_control
39
40
  end
40
41
  end
41
42
  end
42
-
43
- context 'with docker container', if: !ENV['SKIP_DOCKER'] do
44
- let(:container){LintTrap::Container::Docker.new('lintci/spin_cycle:latest', fixture_path)}
45
-
46
- it_behaves_like '#lint'
47
- end
48
-
49
- context 'without a docker container', if: ENV['SKIP_DOCKER'] do
50
- it_behaves_like '#lint'
51
- end
52
43
  end
@@ -1,15 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe LintTrap::Linter::CoffeeLint do
4
- let(:container){LintTrap::Container::Fake.new}
5
- subject(:linter){described_class.new(container: container)}
4
+ let(:container){LintTrap::Container::Docker.new('lintci/spin_cycle:latest', fixture_path)}
5
+ let(:options){{}}
6
+ subject(:linter){described_class.new}
6
7
 
7
- shared_examples '#lint' do
8
+ describe '#lint' do
8
9
  context 'when linting a bad file' do
9
10
  let(:file){fixture_path('bad.coffee')}
10
11
 
11
12
  it 'generates lint' do
12
- expect{|b| linter.lint([file], &b)}.to yield_successive_args(
13
+ expect{|b| linter.lint([file], container, options, &b)}.to yield_successive_args(
13
14
  {
14
15
  file: file,
15
16
  line: '1',
@@ -27,18 +28,8 @@ describe LintTrap::Linter::CoffeeLint do
27
28
  let(:file){fixture_path('good.coffee')}
28
29
 
29
30
  it 'generates no lint' do
30
- expect{|b| linter.lint([file], &b)}.to_not yield_control
31
+ expect{|b| linter.lint([file], container, options, &b)}.to_not yield_control
31
32
  end
32
33
  end
33
34
  end
34
-
35
- context 'with docker container', if: !ENV['SKIP_DOCKER'] do
36
- let(:container){LintTrap::Container::Docker.new('lintci/spin_cycle:latest', fixture_path)}
37
-
38
- it_behaves_like '#lint'
39
- end
40
-
41
- context 'without a docker container', if: ENV['SKIP_DOCKER'] do
42
- it_behaves_like '#lint'
43
- end
44
35
  end
@@ -1,15 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe LintTrap::Linter::CPPCheck do
4
- let(:container){LintTrap::Container::Fake.new}
5
- subject(:linter){described_class.new(container: container)}
4
+ let(:container){LintTrap::Container::Docker.new('lintci/spin_cycle:latest', fixture_path)}
5
+ let(:options){{}}
6
+ subject(:linter){described_class.new}
6
7
 
7
- shared_examples '#lint' do
8
+ describe '#lint' do
8
9
  context 'when linting a bad file' do
9
10
  let(:file){fixture_path('bad.cpp')}
10
11
 
11
12
  it 'generates lint' do
12
- expect{|b| linter.lint([file], &b)}.to yield_successive_args(
13
+ expect{|b| linter.lint([file], container, options, &b)}.to yield_successive_args(
13
14
  {
14
15
  file: file,
15
16
  line: '3',
@@ -43,18 +44,8 @@ describe LintTrap::Linter::CPPCheck do
43
44
  let(:file){fixture_path('good.cpp')}
44
45
 
45
46
  it 'generates no lint' do
46
- expect{|b| linter.lint([file], &b)}.to_not yield_control
47
+ expect{|b| linter.lint([file], container, options, &b)}.to_not yield_control
47
48
  end
48
49
  end
49
50
  end
50
-
51
- context 'with docker container', if: !ENV['SKIP_DOCKER'] do
52
- let(:container){LintTrap::Container::Docker.new('lintci/spin_cycle:latest', fixture_path)}
53
-
54
- it_behaves_like '#lint'
55
- end
56
-
57
- context 'without a docker container', if: ENV['SKIP_DOCKER'] do
58
- it_behaves_like '#lint'
59
- end
60
51
  end
@@ -1,15 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe LintTrap::Linter::CSSLint do
4
- let(:container){LintTrap::Container::Fake.new}
5
- subject(:linter){described_class.new(container: container)}
4
+ let(:container){LintTrap::Container::Docker.new('lintci/spin_cycle:latest', fixture_path)}
5
+ let(:options){{}}
6
+ subject(:linter){described_class.new}
6
7
 
7
- shared_examples '#lint' do
8
+ describe '#lint' do
8
9
  context 'when linting a bad file' do
9
10
  let(:file){fixture_path('bad.css')}
10
11
 
11
12
  it 'generates lint' do
12
- expect{|b| linter.lint([file], &b)}.to yield_successive_args(
13
+ expect{|b| linter.lint([file], container, options, &b)}.to yield_successive_args(
13
14
  {
14
15
  file: file,
15
16
  line: '2',
@@ -27,18 +28,8 @@ describe LintTrap::Linter::CSSLint do
27
28
  let(:file){fixture_path('good.css')}
28
29
 
29
30
  it 'generates no lint' do
30
- expect{|b| linter.lint([file], &b)}.to_not yield_control
31
+ expect{|b| linter.lint([file], container, options, &b)}.to_not yield_control
31
32
  end
32
33
  end
33
34
  end
34
-
35
- context 'with docker container', if: !ENV['SKIP_DOCKER'] do
36
- let(:container){LintTrap::Container::Docker.new('lintci/spin_cycle:latest', fixture_path)}
37
-
38
- it_behaves_like '#lint'
39
- end
40
-
41
- context 'without a docker container', if: ENV['SKIP_DOCKER'] do
42
- it_behaves_like '#lint'
43
- end
44
35
  end
@@ -1,15 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe LintTrap::Linter::GoLint do
4
- let(:container){LintTrap::Container::Fake.new}
5
- subject(:linter){described_class.new(container: container)}
4
+ let(:container){LintTrap::Container::Docker.new('lintci/spin_cycle:latest', fixture_path)}
5
+ let(:options){{}}
6
+ subject(:linter){described_class.new}
6
7
 
7
- shared_examples '#lint' do
8
+ describe '#lint' do
8
9
  context 'when linting a bad file' do
9
10
  let(:file){fixture_path('bad.go')}
10
11
 
11
12
  it 'generates lint' do
12
- expect{|b| linter.lint([file], &b)}.to yield_successive_args(
13
+ expect{|b| linter.lint([file], container, options, &b)}.to yield_successive_args(
13
14
  {
14
15
  file: file,
15
16
  line: '5',
@@ -27,18 +28,8 @@ describe LintTrap::Linter::GoLint do
27
28
  let(:file){fixture_path('good.go')}
28
29
 
29
30
  it 'generates no lint' do
30
- expect{|b| linter.lint([file], &b)}.to_not yield_control
31
+ expect{|b| linter.lint([file], container, options, &b)}.to_not yield_control
31
32
  end
32
33
  end
33
34
  end
34
-
35
- context 'with docker container', if: !ENV['SKIP_DOCKER'] do
36
- let(:container){LintTrap::Container::Docker.new('lintci/spin_cycle:latest', fixture_path)}
37
-
38
- it_behaves_like '#lint'
39
- end
40
-
41
- context 'without a docker container', if: ENV['SKIP_DOCKER'] do
42
- it_behaves_like '#lint'
43
- end
44
35
  end
@@ -1,15 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe LintTrap::Linter::JSHint do
4
- let(:container){LintTrap::Container::Fake.new}
5
- subject(:linter){described_class.new(container: container)}
4
+ let(:container){LintTrap::Container::Docker.new('lintci/spin_cycle:latest', fixture_path)}
5
+ let(:options){{}}
6
+ subject(:linter){described_class.new}
6
7
 
7
- shared_examples '#lint' do
8
+ describe '#lint' do
8
9
  context 'when linting a bad file' do
9
10
  let(:file){fixture_path('bad.js')}
10
11
 
11
12
  it 'generates lint' do
12
- expect{|b| linter.lint([file], &b)}.to yield_successive_args(
13
+ expect{|b| linter.lint([file], container, options, &b)}.to yield_successive_args(
13
14
  {
14
15
  file: file,
15
16
  line: '2',
@@ -53,18 +54,8 @@ describe LintTrap::Linter::JSHint do
53
54
  let(:file){fixture_path('good.js')}
54
55
 
55
56
  it 'generates no lint' do
56
- expect{|b| linter.lint([file], &b)}.to_not yield_control
57
+ expect{|b| linter.lint([file], container, options, &b)}.to_not yield_control
57
58
  end
58
59
  end
59
60
  end
60
-
61
- context 'with docker container', if: !ENV['SKIP_DOCKER'] do
62
- let(:container){LintTrap::Container::Docker.new('lintci/spin_cycle:latest', fixture_path)}
63
-
64
- it_behaves_like '#lint'
65
- end
66
-
67
- context 'without a docker container', if: ENV['SKIP_DOCKER'] do
68
- it_behaves_like '#lint'
69
- end
70
61
  end
@@ -1,15 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe LintTrap::Linter::JSONLint do
4
- let(:container){LintTrap::Container::Fake.new}
5
- subject(:linter){described_class.new(container: container)}
4
+ let(:container){LintTrap::Container::Docker.new('lintci/spin_cycle:latest', fixture_path)}
5
+ let(:options){{}}
6
+ subject(:linter){described_class.new}
6
7
 
7
- shared_examples '#lint' do
8
+ describe '#lint' do
8
9
  context 'when linting a bad file' do
9
10
  let(:file){fixture_path('bad.json')}
10
11
 
11
12
  it 'generates lint' do
12
- expect{|b| linter.lint([file], &b)}.to yield_successive_args(
13
+ expect{|b| linter.lint([file], container, options, &b)}.to yield_successive_args(
13
14
  {
14
15
  file: file,
15
16
  line: '2',
@@ -43,18 +44,8 @@ describe LintTrap::Linter::JSONLint do
43
44
  let(:file){fixture_path('good.json')}
44
45
 
45
46
  it 'generates no lint' do
46
- expect{|b| linter.lint([file], &b)}.to_not yield_control
47
+ expect{|b| linter.lint([file], container, options, &b)}.to_not yield_control
47
48
  end
48
49
  end
49
50
  end
50
-
51
- context 'with docker container', if: !ENV['SKIP_DOCKER'] do
52
- let(:container){LintTrap::Container::Docker.new('lintci/spin_cycle:latest', fixture_path)}
53
-
54
- it_behaves_like '#lint'
55
- end
56
-
57
- context 'without a docker container', if: ENV['SKIP_DOCKER'] do
58
- it_behaves_like '#lint'
59
- end
60
51
  end
@@ -1,15 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe LintTrap::Linter::PyLint do
4
- let(:container){LintTrap::Container::Fake.new}
5
- subject(:linter){described_class.new(container: container)}
4
+ let(:container){LintTrap::Container::Docker.new('lintci/spin_cycle:latest', fixture_path)}
5
+ let(:options){{}}
6
+ subject(:linter){described_class.new}
6
7
 
7
- shared_examples '#lint' do
8
+ describe '#lint' do
8
9
  context 'when linting a bad file' do
9
10
  let(:file){fixture_path('bad.py')}
10
11
 
11
12
  it 'generates lint' do
12
- expect{|b| linter.lint([file], &b)}.to yield_successive_args(
13
+ expect{|b| linter.lint([file], container, options, &b)}.to yield_successive_args(
13
14
  {
14
15
  file: file,
15
16
  line: '1',
@@ -34,18 +35,8 @@ describe LintTrap::Linter::PyLint do
34
35
  let(:file){fixture_path('good.py')}
35
36
 
36
37
  it 'generates no lint' do
37
- expect{|b| linter.lint([file], &b)}.to_not yield_control
38
+ expect{|b| linter.lint([file], container, options, &b)}.to_not yield_control
38
39
  end
39
40
  end
40
41
  end
41
-
42
- context 'with docker container', if: !ENV['SKIP_DOCKER'] do
43
- let(:container){LintTrap::Container::Docker.new('lintci/spin_cycle:latest', fixture_path)}
44
-
45
- it_behaves_like '#lint'
46
- end
47
-
48
- context 'without a docker container', if: ENV['SKIP_DOCKER'] do
49
- it_behaves_like '#lint'
50
- end
51
42
  end
@@ -1,15 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe LintTrap::Linter::RuboCop do
4
- let(:container){LintTrap::Container::Fake.new}
5
- subject(:linter){described_class.new(container: container)}
4
+ let(:container){LintTrap::Container::Docker.new('lintci/spin_cycle:latest', fixture_path)}
5
+ let(:options){{}}
6
+ subject(:linter){described_class.new}
6
7
 
7
- shared_examples '#lint' do
8
+ describe '#lint' do
8
9
  context 'when linting a bad file' do
9
10
  let(:file){fixture_path('bad.rb')}
10
11
 
11
12
  it 'generates lint' do
12
- expect{|b| linter.lint([file], &b)}.to yield_successive_args(
13
+ expect{|b| linter.lint([file], container, options, &b)}.to yield_successive_args(
13
14
  {
14
15
  file: file,
15
16
  line: '1',
@@ -35,18 +36,8 @@ describe LintTrap::Linter::RuboCop do
35
36
  let(:file){fixture_path('good.rb')}
36
37
 
37
38
  it 'generates no lint' do
38
- expect{|b| linter.lint([file], &b)}.to_not yield_control
39
+ expect{|b| linter.lint([file], container, options, &b)}.to_not yield_control
39
40
  end
40
41
  end
41
42
  end
42
-
43
- context 'with docker container', if: !ENV['SKIP_DOCKER'] do
44
- let(:container){LintTrap::Container::Docker.new('lintci/spin_cycle:latest', fixture_path)}
45
-
46
- it_behaves_like '#lint'
47
- end
48
-
49
- context 'without a docker container', if: ENV['SKIP_DOCKER'] do
50
- it_behaves_like '#lint'
51
- end
52
43
  end