lint_trap 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lint_trap/command.rb +2 -2
- data/lib/lint_trap/language/base.rb +5 -5
- data/lib/lint_trap/language/coffeescript.rb +1 -1
- data/lib/lint_trap/language/cpp.rb +2 -2
- data/lib/lint_trap/language/css.rb +1 -1
- data/lib/lint_trap/language/go.rb +1 -1
- data/lib/lint_trap/language/java.rb +1 -1
- data/lib/lint_trap/language/javascript.rb +1 -1
- data/lib/lint_trap/language/json.rb +1 -1
- data/lib/lint_trap/language/python.rb +1 -1
- data/lib/lint_trap/language/ruby.rb +1 -1
- data/lib/lint_trap/language/scss.rb +1 -1
- data/lib/lint_trap/language.rb +3 -2
- data/lib/lint_trap/linter/base.rb +8 -11
- data/lib/lint_trap/linter.rb +4 -2
- data/lib/lint_trap/version.rb +1 -1
- data/spec/command_spec.rb +8 -21
- data/spec/integration/checkstyle_spec.rb +6 -15
- data/spec/integration/coffeelint_spec.rb +6 -15
- data/spec/integration/cppcheck_spec.rb +6 -15
- data/spec/integration/csslint_spec.rb +6 -15
- data/spec/integration/golint_spec.rb +6 -15
- data/spec/integration/jshint_spec.rb +6 -15
- data/spec/integration/jsonlint_spec.rb +6 -15
- data/spec/integration/pylint_spec.rb +6 -15
- data/spec/integration/rubocop_spec.rb +6 -15
- data/spec/integration/scsslint_spec.rb +6 -15
- data/spec/language/coffeescript_spec.rb +1 -1
- data/spec/language/cpp_spec.rb +1 -1
- data/spec/language/css_spec.rb +1 -1
- data/spec/language/go_spec.rb +1 -1
- data/spec/language/java_spec.rb +1 -1
- data/spec/language/javascript_spec.rb +1 -1
- data/spec/language/json_spec.rb +1 -1
- data/spec/language/python_spec.rb +1 -1
- data/spec/language/ruby_spec.rb +1 -1
- data/spec/language/scss_spec.rb +1 -1
- data/spec/language_spec.rb +20 -20
- data/spec/linter/checkstyle_spec.rb +6 -6
- data/spec/linter/coffeelint_spec.rb +5 -5
- data/spec/linter/cppcheck_spec.rb +3 -3
- data/spec/linter/csslint_spec.rb +5 -5
- data/spec/linter/golint_spec.rb +3 -3
- data/spec/linter/jshint_spec.rb +6 -6
- data/spec/linter/jsonlint_spec.rb +3 -3
- data/spec/linter/pylint_spec.rb +6 -6
- data/spec/linter/rubocop_spec.rb +6 -6
- data/spec/linter/scsslint_spec.rb +5 -5
- data/spec/linter_spec.rb +16 -10
- data/spec/spec_helper.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 048fa7d8ad65b35c53e5c8cf57560334b8cb55ec
|
4
|
+
data.tar.gz: 3847e8340d6b6f5ba74b66596d23163d18436ee7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34a346a1866a70b46d71a336ef591c2a26738209ad7424da6ef9847bcff1585df5bb19349cdb1af29976ad4e9a61aa3ad987364a07b9720a6adf9e4e54d007ce
|
7
|
+
data.tar.gz: a109bda2726893b13598208b154ef35e1fd7be8d07ac660a76253d0c6db0f2514328acdb75a36c5fb9cd2487e37b3558a676cca959982d320495daccaa914bc8
|
data/lib/lint_trap/command.rb
CHANGED
@@ -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.
|
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)}
|
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.
|
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
|
data/lib/lint_trap/language.rb
CHANGED
@@ -17,8 +17,9 @@ module LintTrap
|
|
17
17
|
@languages = {}
|
18
18
|
|
19
19
|
class << self
|
20
|
-
def register(
|
21
|
-
|
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
|
11
|
-
|
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.
|
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
|
|
data/lib/lint_trap/linter.rb
CHANGED
data/lib/lint_trap/version.rb
CHANGED
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){'
|
4
|
+
let(:file){fixture_path('lint.txt')}
|
5
5
|
let(:command){described_class.new('cat', %w(-b), [file])}
|
6
|
-
let(:container){LintTrap::Container::
|
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
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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::
|
5
|
-
|
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
|
-
|
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::
|
5
|
-
|
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
|
-
|
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::
|
5
|
-
|
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
|
-
|
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::
|
5
|
-
|
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
|
-
|
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::
|
5
|
-
|
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
|
-
|
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::
|
5
|
-
|
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
|
-
|
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::
|
5
|
-
|
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
|
-
|
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::
|
5
|
-
|
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
|
-
|
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::
|
5
|
-
|
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
|
-
|
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
|