lint_trap 0.0.13 → 0.0.14
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/lib/lint_trap/container/base.rb +9 -2
- data/lib/lint_trap/container/docker.rb +10 -2
- data/lib/lint_trap/version.rb +1 -1
- data/spec/command_spec.rb +3 -1
- data/spec/container/docker_spec.rb +22 -7
- data/spec/integration/base_spec.rb +1 -1
- data/spec/integration/checkstyle_spec.rb +1 -1
- data/spec/integration/coffeelint_spec.rb +1 -1
- data/spec/integration/cppcheck_spec.rb +4 -4
- data/spec/integration/csslint_spec.rb +1 -1
- data/spec/integration/golint_spec.rb +1 -1
- data/spec/integration/jshint_spec.rb +1 -1
- data/spec/integration/jsonlint_spec.rb +1 -1
- data/spec/integration/pylint_spec.rb +1 -1
- data/spec/integration/rubocop_spec.rb +1 -1
- data/spec/integration/scsslint_spec.rb +1 -1
- data/spec/parser/base_spec.rb +1 -1
- data/spec/parser/line_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91b370e674d44dad5e9d53a8679ef006512a2c59
|
4
|
+
data.tar.gz: 479b9f36c2720e98a64dc89e1cecc07868dc3f9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e3a5e71fc5a801515d19e139f94ac7c3745c29cf7b9e37e101a3588f9f4dd61f9d4f4037a78759f2e92e9ad0aaf5f1e1f10026dcc93ed1e0c8b81789e5a7824
|
7
|
+
data.tar.gz: c421bc8a945487ee9b53b6d6ab9aa2a49c3e74b622755fa3f9cfb4d6bf6995ef8096873669113f6beeb423101b77213ded9dfae851e8b7e7945b86a35c5f3e1e
|
@@ -8,9 +8,10 @@ module LintTrap
|
|
8
8
|
|
9
9
|
LOCAL_CONFIG_PATH = Pathname.new(File.expand_path('../../../../config', __FILE__))
|
10
10
|
|
11
|
-
def initialize(image, repo_path)
|
11
|
+
def initialize(image, repo_path, options = {})
|
12
12
|
@image = image
|
13
13
|
@repo_path = Pathname.new(repo_path)
|
14
|
+
@options = default_options.merge(options)
|
14
15
|
end
|
15
16
|
|
16
17
|
def pull
|
@@ -31,7 +32,13 @@ module LintTrap
|
|
31
32
|
|
32
33
|
protected
|
33
34
|
|
34
|
-
attr_reader :image, :repo_path
|
35
|
+
attr_reader :image, :repo_path, :options
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def default_options
|
40
|
+
{}
|
41
|
+
end
|
35
42
|
end
|
36
43
|
end
|
37
44
|
end
|
@@ -42,8 +42,12 @@ module LintTrap
|
|
42
42
|
|
43
43
|
private
|
44
44
|
|
45
|
+
def default_options
|
46
|
+
{remove_container: true}
|
47
|
+
end
|
48
|
+
|
45
49
|
def flags
|
46
|
-
[
|
50
|
+
flags = [
|
47
51
|
# '-m', '50m', # memory
|
48
52
|
# '-c', '1', # number of cpus
|
49
53
|
'--net="none"',
|
@@ -52,7 +56,11 @@ module LintTrap
|
|
52
56
|
'-v', "#{repo_path}:#{CODE_PATH}",
|
53
57
|
"--workdir=#{CODE_PATH}",
|
54
58
|
'--user=lint_trap'
|
55
|
-
]
|
59
|
+
]
|
60
|
+
|
61
|
+
flags.unshift('--rm') if options[:remove_container]
|
62
|
+
|
63
|
+
flags.join(' ')
|
56
64
|
end
|
57
65
|
end
|
58
66
|
end
|
data/lib/lint_trap/version.rb
CHANGED
data/spec/command_spec.rb
CHANGED
@@ -6,6 +6,8 @@ describe LintTrap::Command do
|
|
6
6
|
let(:container){LintTrap::Container::Docker.new('lintci/rubocop', fixture_path)}
|
7
7
|
|
8
8
|
describe '#run' do
|
9
|
+
let(:container){LintTrap::Container::Docker.new('lintci/rubocop', fixture_path, remove_container: ENV['CI'].nil?)}
|
10
|
+
|
9
11
|
it 'generates the expected output' do
|
10
12
|
success = command.run(container) do |io|
|
11
13
|
expect(io.read).to eq(" 1\tlint\n")
|
@@ -18,7 +20,7 @@ describe LintTrap::Command do
|
|
18
20
|
describe '#command/#to_s' do
|
19
21
|
it 'generates a wrapped executable command' do
|
20
22
|
expect(command.to_s(container)).to eq(
|
21
|
-
'docker run --net="none" --privileged=false '\
|
23
|
+
'docker run --rm --net="none" --privileged=false '\
|
22
24
|
"-v #{LintTrap::Container::Base::LOCAL_CONFIG_PATH}:/config "\
|
23
25
|
"-v #{fixture_path}:/src --workdir=/src --user=lint_trap lintci/rubocop "\
|
24
26
|
'cat -b /src/lint.txt'
|
@@ -24,13 +24,28 @@ describe LintTrap::Container::Docker do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
describe '#wrap' do
|
27
|
-
|
28
|
-
|
29
|
-
'
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
27
|
+
context 'with remove_container option' do
|
28
|
+
it 'wraps the command passed in with a call to docker' do
|
29
|
+
expect(container.wrap('ls')).to eq(
|
30
|
+
'docker run --rm --net="none" --privileged=false '\
|
31
|
+
"-v #{described_class::LOCAL_CONFIG_PATH}:/config "\
|
32
|
+
'-v /local/path:/src '\
|
33
|
+
"--workdir=/src --user=lint_trap #{image} ls"
|
34
|
+
)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'without remove_container option' do
|
39
|
+
subject(:container){described_class.new(image, '/local/path', remove_container: false)}
|
40
|
+
|
41
|
+
it 'wraps the command passed in with a call to docker' do
|
42
|
+
expect(container.wrap('ls')).to eq(
|
43
|
+
'docker run --net="none" --privileged=false '\
|
44
|
+
"-v #{described_class::LOCAL_CONFIG_PATH}:/config "\
|
45
|
+
'-v /local/path:/src '\
|
46
|
+
"--workdir=/src --user=lint_trap #{image} ls"
|
47
|
+
)
|
48
|
+
end
|
34
49
|
end
|
35
50
|
end
|
36
51
|
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe LintTrap::Linter::Base do
|
4
4
|
let(:image){LintTrap::Linter::RuboCop.new.image_version}
|
5
|
-
let(:container){LintTrap::Container::Docker.new(image, fixture_path)}
|
5
|
+
let(:container){LintTrap::Container::Docker.new(image, fixture_path, remove_container: ENV['CI'].nil?)}
|
6
6
|
let(:options){{}}
|
7
7
|
subject(:linter) do
|
8
8
|
ErrorLinter = Class.new(described_class) do
|
@@ -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(linter.image_version, fixture_path)}
|
4
|
+
let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path, remove_container: ENV['CI'].nil?)}
|
5
5
|
let(:options){{}}
|
6
6
|
subject(:linter){described_class.new}
|
7
7
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe LintTrap::Linter::CoffeeLint do
|
4
|
-
let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path)}
|
4
|
+
let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path, remove_container: ENV['CI'].nil?)}
|
5
5
|
let(:options){{}}
|
6
6
|
subject(:linter){described_class.new}
|
7
7
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe LintTrap::Linter::CPPCheck do
|
4
|
-
let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path)}
|
4
|
+
let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path, remove_container: ENV['CI'].nil?)}
|
5
5
|
let(:options){{}}
|
6
6
|
subject(:linter){described_class.new}
|
7
7
|
|
@@ -26,7 +26,7 @@ describe LintTrap::Linter::CPPCheck do
|
|
26
26
|
length: nil,
|
27
27
|
rule: 'unassignedVariable',
|
28
28
|
severity: 'style',
|
29
|
-
message: "Variable 'p' is not assigned a value."
|
29
|
+
message: start_with("Variable 'p' is not assigned a value.") # Other text sometimes gets added
|
30
30
|
}, {
|
31
31
|
file: file,
|
32
32
|
line: '4',
|
@@ -34,7 +34,7 @@ describe LintTrap::Linter::CPPCheck do
|
|
34
34
|
length: nil,
|
35
35
|
rule: 'uninitvar',
|
36
36
|
severity: 'error',
|
37
|
-
message: 'Uninitialized variable: p'
|
37
|
+
message: start_with('Uninitialized variable: p')
|
38
38
|
}, {
|
39
39
|
file: file,
|
40
40
|
line: '1',
|
@@ -42,7 +42,7 @@ describe LintTrap::Linter::CPPCheck do
|
|
42
42
|
length: nil,
|
43
43
|
rule: 'unusedFunction',
|
44
44
|
severity: 'style',
|
45
|
-
message: "The function 'f' is never used."
|
45
|
+
message: start_with("The function 'f' is never used.")
|
46
46
|
}
|
47
47
|
)
|
48
48
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe LintTrap::Linter::CSSLint do
|
4
|
-
let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path)}
|
4
|
+
let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path, remove_container: ENV['CI'].nil?)}
|
5
5
|
let(:options){{}}
|
6
6
|
subject(:linter){described_class.new}
|
7
7
|
|
@@ -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(linter.image_version, fixture_path)}
|
4
|
+
let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path, remove_container: ENV['CI'].nil?)}
|
5
5
|
let(:options){{}}
|
6
6
|
subject(:linter){described_class.new}
|
7
7
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe LintTrap::Linter::JSHint do
|
4
|
-
let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path)}
|
4
|
+
let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path, remove_container: ENV['CI'].nil?)}
|
5
5
|
let(:options){{}}
|
6
6
|
subject(:linter){described_class.new}
|
7
7
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe LintTrap::Linter::JSONLint do
|
4
|
-
let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path)}
|
4
|
+
let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path, remove_container: ENV['CI'].nil?)}
|
5
5
|
let(:options){{}}
|
6
6
|
subject(:linter){described_class.new}
|
7
7
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe LintTrap::Linter::PyLint do
|
4
|
-
let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path)}
|
4
|
+
let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path, remove_container: ENV['CI'].nil?)}
|
5
5
|
let(:options){{}}
|
6
6
|
subject(:linter){described_class.new}
|
7
7
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe LintTrap::Linter::RuboCop do
|
4
|
-
let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path)}
|
4
|
+
let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path, remove_container: ENV['CI'].nil?)}
|
5
5
|
let(:options){{}}
|
6
6
|
subject(:linter){described_class.new}
|
7
7
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe LintTrap::Linter::SCSSLint do
|
4
|
-
let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path)}
|
4
|
+
let(:container){LintTrap::Container::Docker.new(linter.image_version, fixture_path, remove_container: ENV['CI'].nil?)}
|
5
5
|
let(:options){{}}
|
6
6
|
subject(:linter){described_class.new}
|
7
7
|
|
data/spec/parser/base_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe LintTrap::Parser::Base do
|
4
4
|
let(:image){LintTrap::Linter::RuboCop.new.image_version}
|
5
|
-
let(:container){LintTrap::Container::Docker.new(image, fixture_path)}
|
5
|
+
let(:container){LintTrap::Container::Docker.new(image, fixture_path, remove_container: ENV['CI'].nil?)}
|
6
6
|
subject(:parser){Class.new(described_class).new(StringIO.new, container)}
|
7
7
|
|
8
8
|
describe '#parse' do
|
data/spec/parser/line_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe LintTrap::Parser::Line do
|
4
4
|
let(:image){LintTrap::Linter::RuboCop.new.image_version}
|
5
|
-
let(:container){LintTrap::Container::Docker.new(image, fixture_path)}
|
5
|
+
let(:container){LintTrap::Container::Docker.new(image, fixture_path, remove_container: ENV['CI'].nil?)}
|
6
6
|
subject(:parser){Class.new(described_class).new(StringIO.new('violation'), container)}
|
7
7
|
|
8
8
|
describe '#parse' do
|