lint_trap 0.0.8 → 0.0.9
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/Rakefile +71 -22
- data/circle.yml +8 -2
- data/lib/lint_trap/language/base.rb +6 -2
- data/lib/lint_trap/language/coffeescript.rb +1 -1
- data/lib/lint_trap/language/cpp.rb +1 -1
- 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/linter/base.rb +8 -0
- data/lib/lint_trap/linter/checkstyle.rb +4 -0
- data/lib/lint_trap/linter/coffeelint.rb +4 -0
- data/lib/lint_trap/linter/cppcheck.rb +4 -0
- data/lib/lint_trap/linter/csslint.rb +4 -0
- data/lib/lint_trap/linter/golint.rb +4 -0
- data/lib/lint_trap/linter/jshint.rb +4 -0
- data/lib/lint_trap/linter/jsonlint.rb +4 -0
- data/lib/lint_trap/linter/pylint.rb +4 -0
- data/lib/lint_trap/linter/rubocop.rb +4 -0
- data/lib/lint_trap/linter/scsslint.rb +4 -0
- data/lib/lint_trap/version.rb +1 -1
- data/spec/language/coffeescript_spec.rb +2 -0
- data/spec/language/cpp_spec.rb +2 -0
- data/spec/language/css_spec.rb +2 -0
- data/spec/language/go_spec.rb +2 -0
- data/spec/language/java_spec.rb +2 -0
- data/spec/language/javascript_spec.rb +2 -0
- data/spec/language/json_spec.rb +2 -0
- data/spec/language/python_spec.rb +2 -0
- data/spec/language/ruby_spec.rb +2 -0
- data/spec/language/scss_spec.rb +2 -0
- data/spec/linter/checkstyle_spec.rb +5 -1
- data/spec/linter/coffeelint_spec.rb +4 -0
- data/spec/linter/cppcheck_spec.rb +4 -0
- data/spec/linter/csslint_spec.rb +4 -0
- data/spec/linter/golint_spec.rb +4 -0
- data/spec/linter/jshint_spec.rb +4 -0
- data/spec/linter/jsonlint_spec.rb +4 -0
- data/spec/linter/pylint_spec.rb +4 -0
- data/spec/linter/rubocop_spec.rb +4 -0
- data/spec/linter/scsslint_spec.rb +4 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/support/examples/language.rb +12 -0
- data/spec/support/examples/linter.rb +11 -0
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f171a483bce815192fe84c70780c8ad31dd7162
|
4
|
+
data.tar.gz: cbb5e42420f0cd7ca00cc588d2abf268b35a00f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e33c63d67abec9904c004a1652e4ec2f34040bd5c3ecaed38a419c67ae9c4e71c6bf64eec6d13131309530d4cb99a628dbc6452e97b1be18aae707908d502e4
|
7
|
+
data.tar.gz: 03050267d12f19b005d4551209e4a343059e4e7d7b00e806359c69d81fd5001e0a63fe7dc8749378daf5271b5e1543d9025289759d1bc20c4d38b9676ead9f12
|
data/Rakefile
CHANGED
@@ -19,34 +19,83 @@ task :credentials do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
namespace :docker do
|
22
|
-
|
22
|
+
module Docker
|
23
|
+
DOCKER_CACHE_PATH = File.expand_path('~/.docker')
|
24
|
+
DOCKER_IMAGE_PATH = File.join(DOCKER_CACHE_PATH, 'image.tar')
|
25
|
+
IMAGE_NAME = 'lintci/spin_cycle'
|
23
26
|
|
24
|
-
|
25
|
-
return if $? == 0
|
27
|
+
BuildError = Class.new(StandardError)
|
26
28
|
|
27
|
-
raise DockerError, 'There was a problem executing the command.'
|
28
|
-
end
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
def tag
|
31
|
+
run("docker tag -f #{image_sha} #{image_latest}")
|
32
|
+
run("docker tag -f #{image_sha} #{image_version}")
|
33
|
+
end
|
33
34
|
|
34
|
-
|
35
|
-
|
35
|
+
def pull
|
36
|
+
run("docker pull #{image_latest}")
|
37
|
+
end
|
36
38
|
|
37
|
-
|
38
|
-
|
39
|
-
|
39
|
+
def load
|
40
|
+
if File.exist?(DOCKER_IMAGE_PATH)
|
41
|
+
run("docker load -i #{DOCKER_IMAGE_PATH}")
|
42
|
+
else
|
43
|
+
pull
|
44
|
+
end
|
45
|
+
end
|
40
46
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
47
|
+
def dump
|
48
|
+
require 'fileutils'
|
49
|
+
|
50
|
+
FileUtils.mkdir_p(DOCKER_CACHE_PATH)
|
51
|
+
run("docker save #{image_latest} > #{DOCKER_IMAGE_PATH}")
|
52
|
+
end
|
53
|
+
|
54
|
+
def build
|
55
|
+
run("docker build -t #{image_sha} .")
|
56
|
+
end
|
57
|
+
|
58
|
+
def push
|
59
|
+
run("docker login -e #{ENV['DOCKER_EMAIL']} -u #{ENV['DOCKER_USER']} -p #{ENV['DOCKER_PASSWORD']}")
|
60
|
+
run("docker push #{image_sha}")
|
61
|
+
run("docker push #{image_version}")
|
62
|
+
run("docker push #{image_latest}")
|
63
|
+
end
|
64
|
+
|
65
|
+
private
|
45
66
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
67
|
+
def run(command)
|
68
|
+
puts command
|
69
|
+
system(command)
|
70
|
+
|
71
|
+
raise BuildError, 'There was a problem executing the command.' unless $? == 0
|
72
|
+
end
|
73
|
+
|
74
|
+
def image_sha
|
75
|
+
"#{IMAGE_NAME}:#{sha}"
|
76
|
+
end
|
77
|
+
|
78
|
+
def image_version
|
79
|
+
require_relative 'lib/lint_trap/version'
|
80
|
+
|
81
|
+
"#{IMAGE_NAME}:#{LintTrap::VERSION}"
|
82
|
+
end
|
83
|
+
|
84
|
+
def image_latest
|
85
|
+
"#{IMAGE_NAME}:latest"
|
86
|
+
end
|
87
|
+
|
88
|
+
def sha
|
89
|
+
sha = ENV['CIRCLE_SHA1'] ? ENV['CIRCLE_SHA1'] : `git rev-parse HEAD`.strip
|
90
|
+
end
|
51
91
|
end
|
92
|
+
|
93
|
+
include Docker
|
94
|
+
|
95
|
+
task(:tag){tag}
|
96
|
+
task(:pull){pull}
|
97
|
+
task(:load){load}
|
98
|
+
task(:dump){dump}
|
99
|
+
task(:build){build}
|
100
|
+
task(:push){push}
|
52
101
|
end
|
data/circle.yml
CHANGED
@@ -8,12 +8,18 @@ checkout:
|
|
8
8
|
- git config --global user.email "circleci@lintci.com"
|
9
9
|
- git config --global user.name "LintCI's CircleCI Bot"
|
10
10
|
dependencies:
|
11
|
+
cache_directories:
|
12
|
+
- "~/.docker"
|
11
13
|
post:
|
12
|
-
- bundle exec rake docker:
|
14
|
+
- bundle exec rake docker:pull
|
15
|
+
- bundle exec rake docker:build
|
16
|
+
- bundle exec rake docker:tag
|
13
17
|
deployment:
|
14
18
|
master:
|
15
19
|
branch: master
|
16
20
|
commands:
|
17
|
-
- bundle exec rake credentials
|
21
|
+
- bundle exec rake credentials
|
22
|
+
- bundle exec rake release
|
23
|
+
- bundle exec rake docker:push
|
18
24
|
|
19
25
|
|
@@ -6,13 +6,17 @@ module LintTrap
|
|
6
6
|
self.class.name.split('::').last
|
7
7
|
end
|
8
8
|
|
9
|
-
def linters
|
10
|
-
|
9
|
+
def linters(*classes)
|
10
|
+
classes.map(&:new)
|
11
11
|
end
|
12
12
|
|
13
13
|
def ==(other)
|
14
14
|
name == other.name
|
15
15
|
end
|
16
|
+
|
17
|
+
def inspect
|
18
|
+
"<#{name}>"
|
19
|
+
end
|
16
20
|
end
|
17
21
|
end
|
18
22
|
end
|
@@ -21,10 +21,18 @@ module LintTrap
|
|
21
21
|
self.class.name.split('::').last
|
22
22
|
end
|
23
23
|
|
24
|
+
def languages(*classes)
|
25
|
+
classes.map(&:new)
|
26
|
+
end
|
27
|
+
|
24
28
|
def ==(other)
|
25
29
|
name == other.name
|
26
30
|
end
|
27
31
|
|
32
|
+
def inspect
|
33
|
+
"<#{name}>"
|
34
|
+
end
|
35
|
+
|
28
36
|
protected
|
29
37
|
|
30
38
|
attr_reader :container, :options
|
data/lib/lint_trap/version.rb
CHANGED
@@ -3,6 +3,8 @@ require 'spec_helper'
|
|
3
3
|
describe LintTrap::Language::CoffeeScript do
|
4
4
|
subject(:language){described_class.new}
|
5
5
|
|
6
|
+
it_behaves_like 'language'
|
7
|
+
|
6
8
|
its(:name){is_expected.to eq('CoffeeScript')}
|
7
9
|
its(:linters){is_expected.to eq([LintTrap::Linter::CoffeeLint.new])}
|
8
10
|
end
|
data/spec/language/cpp_spec.rb
CHANGED
data/spec/language/css_spec.rb
CHANGED
data/spec/language/go_spec.rb
CHANGED
data/spec/language/java_spec.rb
CHANGED
data/spec/language/json_spec.rb
CHANGED
data/spec/language/ruby_spec.rb
CHANGED
data/spec/language/scss_spec.rb
CHANGED
@@ -4,8 +4,12 @@ describe LintTrap::Linter::CheckStyle do
|
|
4
4
|
let(:container){LintTrap::Container::Fake.new}
|
5
5
|
let(:options){{}}
|
6
6
|
let(:files){%w(Good.java bad.java)}
|
7
|
-
subject(:linter){described_class.new}
|
8
7
|
let(:command){instance_double(LintTrap::Command)}
|
8
|
+
subject(:linter){described_class.new}
|
9
|
+
|
10
|
+
it_behaves_like 'linter'
|
11
|
+
|
12
|
+
its(:languages){is_expected.to eq([LintTrap::Language::Java.new])}
|
9
13
|
|
10
14
|
describe '#lint' do
|
11
15
|
context 'when config is provided' do
|
@@ -7,6 +7,10 @@ describe LintTrap::Linter::CoffeeLint do
|
|
7
7
|
subject(:linter){described_class.new}
|
8
8
|
let(:command){instance_double(LintTrap::Command)}
|
9
9
|
|
10
|
+
it_behaves_like 'linter'
|
11
|
+
|
12
|
+
its(:languages){is_expected.to eq([LintTrap::Language::CoffeeScript.new])}
|
13
|
+
|
10
14
|
describe '#lint' do
|
11
15
|
context 'when config is provided' do
|
12
16
|
let(:options){{config: 'coffeelint.json'}}
|
@@ -7,6 +7,10 @@ describe LintTrap::Linter::CPPCheck do
|
|
7
7
|
subject(:linter){described_class.new}
|
8
8
|
let(:command){instance_double(LintTrap::Command)}
|
9
9
|
|
10
|
+
it_behaves_like 'linter'
|
11
|
+
|
12
|
+
its(:languages){is_expected.to eq([LintTrap::Language::CPP.new])}
|
13
|
+
|
10
14
|
describe '#lint' do
|
11
15
|
it 'runs the lint command with the correct arguments' do
|
12
16
|
expect(LintTrap::Command).to receive(:new).with(
|
data/spec/linter/csslint_spec.rb
CHANGED
@@ -7,6 +7,10 @@ describe LintTrap::Linter::CSSLint do
|
|
7
7
|
subject(:linter){described_class.new}
|
8
8
|
let(:command){instance_double(LintTrap::Command)}
|
9
9
|
|
10
|
+
it_behaves_like 'linter'
|
11
|
+
|
12
|
+
its(:languages){is_expected.to eq([LintTrap::Language::CSS.new])}
|
13
|
+
|
10
14
|
describe '#lint' do
|
11
15
|
context 'when config is provided' do
|
12
16
|
let(:options){{config: '.csslintrc'}}
|
data/spec/linter/golint_spec.rb
CHANGED
@@ -7,6 +7,10 @@ describe LintTrap::Linter::GoLint do
|
|
7
7
|
subject(:linter){described_class.new}
|
8
8
|
let(:command){instance_double(LintTrap::Command)}
|
9
9
|
|
10
|
+
it_behaves_like 'linter'
|
11
|
+
|
12
|
+
its(:languages){is_expected.to eq([LintTrap::Language::Go.new])}
|
13
|
+
|
10
14
|
describe '#lint' do
|
11
15
|
it 'runs the lint command with the correct arguments' do
|
12
16
|
expect(LintTrap::Command).to receive(:new).with(
|
data/spec/linter/jshint_spec.rb
CHANGED
@@ -7,6 +7,10 @@ describe LintTrap::Linter::JSHint do
|
|
7
7
|
subject(:linter){described_class.new}
|
8
8
|
let(:command){instance_double(LintTrap::Command)}
|
9
9
|
|
10
|
+
it_behaves_like 'linter'
|
11
|
+
|
12
|
+
its(:languages){is_expected.to eq([LintTrap::Language::JavaScript.new])}
|
13
|
+
|
10
14
|
describe '#lint' do
|
11
15
|
context 'when config is provided' do
|
12
16
|
let(:options){{config: '.jshintrc'}}
|
@@ -7,6 +7,10 @@ describe LintTrap::Linter::JSONLint do
|
|
7
7
|
subject(:linter){described_class.new}
|
8
8
|
let(:command){instance_double(LintTrap::Command)}
|
9
9
|
|
10
|
+
it_behaves_like 'linter'
|
11
|
+
|
12
|
+
its(:languages){is_expected.to eq([LintTrap::Language::JSON.new])}
|
13
|
+
|
10
14
|
describe '#lint' do
|
11
15
|
it 'runs the lint command with the correct arguments' do
|
12
16
|
expect(LintTrap::Command).to receive(:new).with(
|
data/spec/linter/pylint_spec.rb
CHANGED
@@ -7,6 +7,10 @@ describe LintTrap::Linter::PyLint do
|
|
7
7
|
subject(:linter){described_class.new}
|
8
8
|
let(:command){instance_double(LintTrap::Command)}
|
9
9
|
|
10
|
+
it_behaves_like 'linter'
|
11
|
+
|
12
|
+
its(:languages){is_expected.to eq([LintTrap::Language::Python.new])}
|
13
|
+
|
10
14
|
describe '#lint' do
|
11
15
|
context 'when config is provided' do
|
12
16
|
let(:options){{config: '.pylintrc'}}
|
data/spec/linter/rubocop_spec.rb
CHANGED
@@ -7,6 +7,10 @@ describe LintTrap::Linter::RuboCop do
|
|
7
7
|
subject(:linter){described_class.new}
|
8
8
|
let(:command){instance_double(LintTrap::Command)}
|
9
9
|
|
10
|
+
it_behaves_like 'linter'
|
11
|
+
|
12
|
+
its(:languages){is_expected.to eq([LintTrap::Language::Ruby.new])}
|
13
|
+
|
10
14
|
describe '#lint' do
|
11
15
|
context 'when config is provided' do
|
12
16
|
let(:options){{config: '.rubocop.yml'}}
|
@@ -7,6 +7,10 @@ describe LintTrap::Linter::SCSSLint do
|
|
7
7
|
subject(:linter){described_class.new}
|
8
8
|
let(:command){instance_double(LintTrap::Command)}
|
9
9
|
|
10
|
+
it_behaves_like 'linter'
|
11
|
+
|
12
|
+
its(:languages){is_expected.to eq([LintTrap::Language::SCSS.new])}
|
13
|
+
|
10
14
|
describe '#lint' do
|
11
15
|
context 'when config is provided' do
|
12
16
|
let(:options){{config: '.scss-lint.yml'}}
|
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
shared_examples_for 'language' do
|
2
|
+
its(:linters){is_expected.to_not be_empty}
|
3
|
+
|
4
|
+
describe '#linters' do
|
5
|
+
it 'returns a list of linters which reference this language' do
|
6
|
+
language.linters.each do |linter|
|
7
|
+
expect(linter.languages).to include(language),
|
8
|
+
"expected #{linter.name} to reference #{language.name} as one of it's languages"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
shared_examples_for 'linter' do
|
2
|
+
its(:languages){is_expected.to_not be_empty}
|
3
|
+
|
4
|
+
describe '#languages' do
|
5
|
+
it 'returns a list of languages which reference this linter' do
|
6
|
+
linter.languages.each do |language|
|
7
|
+
expect(language.linters).to include(linter), "expected #{language.name} to reference #{linter.name} as one of it's linters"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lint_trap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Allen Madsen
|
@@ -213,6 +213,8 @@ files:
|
|
213
213
|
- spec/parser/standard_spec.rb
|
214
214
|
- spec/parser/vim_quickfix_spec.rb
|
215
215
|
- spec/spec_helper.rb
|
216
|
+
- spec/support/examples/language.rb
|
217
|
+
- spec/support/examples/linter.rb
|
216
218
|
- spec/support/fixture_file_helper.rb
|
217
219
|
homepage: https://github.com/lintci/lint_trap
|
218
220
|
licenses:
|
@@ -300,4 +302,6 @@ test_files:
|
|
300
302
|
- spec/parser/standard_spec.rb
|
301
303
|
- spec/parser/vim_quickfix_spec.rb
|
302
304
|
- spec/spec_helper.rb
|
305
|
+
- spec/support/examples/language.rb
|
306
|
+
- spec/support/examples/linter.rb
|
303
307
|
- spec/support/fixture_file_helper.rb
|