lint_trap 0.0.2 → 0.0.3

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 (117) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +97 -0
  3. data/Dockerfile +222 -0
  4. data/Gemfile +2 -0
  5. data/Rakefile +45 -0
  6. data/circle.yml +22 -0
  7. data/config/checkstyle/checkstyle_logger-all.jar +0 -0
  8. data/config/checkstyle/sun_checks.xml +177 -0
  9. data/config/coffeelint/lint_trap.coffee +12 -0
  10. data/config/jshint/formatter.js +22 -0
  11. data/config/rubocop/formatter.rb +22 -0
  12. data/config/scsslint/scsslint +34 -0
  13. data/lib/lint_trap/command.rb +39 -0
  14. data/lib/lint_trap/container/base.rb +30 -0
  15. data/lib/lint_trap/container/docker.rb +46 -0
  16. data/lib/lint_trap/container/fake.rb +28 -0
  17. data/lib/lint_trap/language/base.rb +18 -0
  18. data/lib/lint_trap/language/coffeescript.rb +13 -0
  19. data/lib/lint_trap/language/cpp.rb +17 -0
  20. data/lib/lint_trap/language/css.rb +13 -0
  21. data/lib/lint_trap/language/go.rb +13 -0
  22. data/lib/lint_trap/language/java.rb +13 -0
  23. data/lib/lint_trap/language/javascript.rb +13 -0
  24. data/lib/lint_trap/language/json.rb +13 -0
  25. data/lib/lint_trap/language/python.rb +13 -0
  26. data/lib/lint_trap/language/ruby.rb +13 -0
  27. data/lib/lint_trap/language/scss.rb +13 -0
  28. data/lib/lint_trap/language.rb +50 -0
  29. data/lib/lint_trap/linter/base.rb +58 -0
  30. data/lib/lint_trap/linter/checkstyle.rb +24 -0
  31. data/lib/lint_trap/linter/coffeelint.rb +21 -0
  32. data/lib/lint_trap/linter/cppcheck.rb +18 -0
  33. data/lib/lint_trap/linter/csslint.rb +23 -0
  34. data/lib/lint_trap/linter/golint.rb +19 -0
  35. data/lib/lint_trap/linter/jshint.rb +20 -0
  36. data/lib/lint_trap/linter/jsonlint.rb +18 -0
  37. data/lib/lint_trap/linter/pylint.rb +19 -0
  38. data/lib/lint_trap/linter/rubocop.rb +22 -0
  39. data/lib/lint_trap/linter/scsslint.rb +22 -0
  40. data/lib/lint_trap/linter.rb +42 -0
  41. data/lib/lint_trap/{parsers/base_parser.rb → parser/base.rb} +8 -9
  42. data/lib/lint_trap/{parsers/csslint_parser.rb → parser/csslint.rb} +4 -5
  43. data/lib/lint_trap/{parsers/line_parser.rb → parser/line.rb} +14 -5
  44. data/lib/lint_trap/parser/standard.rb +22 -0
  45. data/lib/lint_trap/parser/vim_quickfix.rb +19 -0
  46. data/lib/lint_trap/version.rb +1 -1
  47. data/lib/lint_trap.rb +5 -14
  48. data/lint_trap.gemspec +3 -0
  49. data/spec/command_spec.rb +38 -0
  50. data/spec/container/docker_spec.rb +34 -0
  51. data/spec/container/fake_spec.rb +29 -0
  52. data/spec/fixtures/Good.java +6 -0
  53. data/spec/fixtures/bad.coffee +1 -0
  54. data/spec/fixtures/bad.cpp +5 -0
  55. data/spec/fixtures/bad.css +4 -0
  56. data/spec/fixtures/bad.go +7 -0
  57. data/spec/fixtures/bad.java +3 -0
  58. data/spec/fixtures/bad.js +3 -0
  59. data/spec/fixtures/bad.json +4 -0
  60. data/spec/fixtures/bad.py +2 -0
  61. data/spec/fixtures/bad.rb +4 -0
  62. data/spec/fixtures/bad.scss +3 -0
  63. data/spec/fixtures/good.coffee +1 -0
  64. data/spec/fixtures/good.cpp +4 -0
  65. data/spec/fixtures/good.css +3 -0
  66. data/spec/fixtures/good.go +7 -0
  67. data/spec/fixtures/good.js +5 -0
  68. data/spec/fixtures/good.json +4 -0
  69. data/spec/fixtures/good.py +6 -0
  70. data/spec/fixtures/good.rb +5 -0
  71. data/spec/fixtures/good.scss +3 -0
  72. data/spec/fixtures/lint.txt +1 -0
  73. data/spec/integration/checkstyle_spec.rb +52 -0
  74. data/spec/integration/coffeelint_spec.rb +44 -0
  75. data/spec/integration/cppcheck_spec.rb +60 -0
  76. data/spec/integration/csslint_spec.rb +44 -0
  77. data/spec/integration/golint_spec.rb +44 -0
  78. data/spec/integration/jshint_spec.rb +70 -0
  79. data/spec/integration/jsonlint_spec.rb +60 -0
  80. data/spec/integration/pylint_spec.rb +51 -0
  81. data/spec/integration/rubocop_spec.rb +52 -0
  82. data/spec/integration/scsslint_spec.rb +44 -0
  83. data/spec/language/coffeescript_spec.rb +8 -0
  84. data/spec/language/cpp_spec.rb +8 -0
  85. data/spec/language/css_spec.rb +8 -0
  86. data/spec/language/go_spec.rb +8 -0
  87. data/spec/language/java_spec.rb +8 -0
  88. data/spec/language/javascript_spec.rb +8 -0
  89. data/spec/language/json_spec.rb +8 -0
  90. data/spec/language/python_spec.rb +8 -0
  91. data/spec/language/ruby_spec.rb +8 -0
  92. data/spec/language/scss_spec.rb +8 -0
  93. data/spec/language_spec.rb +143 -0
  94. data/spec/lint_trap_spec.rb +0 -16
  95. data/spec/linter/checkstyle_spec.rb +45 -0
  96. data/spec/linter/coffeelint_spec.rb +46 -0
  97. data/spec/linter/cppcheck_spec.rb +26 -0
  98. data/spec/linter/csslint_spec.rb +44 -0
  99. data/spec/linter/golint_spec.rb +22 -0
  100. data/spec/linter/jshint_spec.rb +44 -0
  101. data/spec/linter/jsonlint_spec.rb +22 -0
  102. data/spec/linter/pylint_spec.rb +46 -0
  103. data/spec/linter/rubocop_spec.rb +48 -0
  104. data/spec/linter/scsslint_spec.rb +44 -0
  105. data/spec/linter_spec.rb +67 -0
  106. data/spec/parser/csslint_spec.rb +25 -0
  107. data/spec/{parsers/standard_parser_spec.rb → parser/standard_spec.rb} +4 -3
  108. data/spec/{parsers/vim_quickfix_parser_spec.rb → parser/vim_quickfix_spec.rb} +5 -4
  109. data/spec/spec_helper.rb +8 -0
  110. data/spec/support/fixture_file_helper.rb +8 -0
  111. metadata +193 -18
  112. data/lib/lint_trap/parser_factory.rb +0 -32
  113. data/lib/lint_trap/parsers/null_parser.rb +0 -11
  114. data/lib/lint_trap/parsers/standard_parser.rb +0 -23
  115. data/lib/lint_trap/parsers/vim_quickfix_parser.rb +0 -20
  116. data/spec/parser_factory_spec.rb +0 -17
  117. data/spec/parsers/csslint_parser_spec.rb +0 -26
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lint_trap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Allen Madsen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-13 00:00:00.000000000 Z
11
+ date: 2015-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: github-linguist
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.2'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +66,20 @@ dependencies:
52
66
  - - ">="
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec-its
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: pry-byebug
57
85
  requirement: !ruby/object:Gem::Requirement
@@ -75,26 +103,117 @@ extra_rdoc_files: []
75
103
  files:
76
104
  - ".gitignore"
77
105
  - ".rspec"
106
+ - ".rubocop.yml"
107
+ - Dockerfile
78
108
  - Gemfile
79
109
  - LICENSE.txt
80
110
  - README.md
81
111
  - Rakefile
112
+ - circle.yml
113
+ - config/checkstyle/checkstyle_logger-all.jar
114
+ - config/checkstyle/sun_checks.xml
115
+ - config/coffeelint/lint_trap.coffee
116
+ - config/jshint/formatter.js
117
+ - config/rubocop/formatter.rb
118
+ - config/scsslint/scsslint
82
119
  - lib/lint_trap.rb
83
- - lib/lint_trap/parser_factory.rb
84
- - lib/lint_trap/parsers/base_parser.rb
85
- - lib/lint_trap/parsers/csslint_parser.rb
86
- - lib/lint_trap/parsers/line_parser.rb
87
- - lib/lint_trap/parsers/null_parser.rb
88
- - lib/lint_trap/parsers/standard_parser.rb
89
- - lib/lint_trap/parsers/vim_quickfix_parser.rb
120
+ - lib/lint_trap/command.rb
121
+ - lib/lint_trap/container/base.rb
122
+ - lib/lint_trap/container/docker.rb
123
+ - lib/lint_trap/container/fake.rb
124
+ - lib/lint_trap/language.rb
125
+ - lib/lint_trap/language/base.rb
126
+ - lib/lint_trap/language/coffeescript.rb
127
+ - lib/lint_trap/language/cpp.rb
128
+ - lib/lint_trap/language/css.rb
129
+ - lib/lint_trap/language/go.rb
130
+ - lib/lint_trap/language/java.rb
131
+ - lib/lint_trap/language/javascript.rb
132
+ - lib/lint_trap/language/json.rb
133
+ - lib/lint_trap/language/python.rb
134
+ - lib/lint_trap/language/ruby.rb
135
+ - lib/lint_trap/language/scss.rb
136
+ - lib/lint_trap/linter.rb
137
+ - lib/lint_trap/linter/base.rb
138
+ - lib/lint_trap/linter/checkstyle.rb
139
+ - lib/lint_trap/linter/coffeelint.rb
140
+ - lib/lint_trap/linter/cppcheck.rb
141
+ - lib/lint_trap/linter/csslint.rb
142
+ - lib/lint_trap/linter/golint.rb
143
+ - lib/lint_trap/linter/jshint.rb
144
+ - lib/lint_trap/linter/jsonlint.rb
145
+ - lib/lint_trap/linter/pylint.rb
146
+ - lib/lint_trap/linter/rubocop.rb
147
+ - lib/lint_trap/linter/scsslint.rb
148
+ - lib/lint_trap/parser/base.rb
149
+ - lib/lint_trap/parser/csslint.rb
150
+ - lib/lint_trap/parser/line.rb
151
+ - lib/lint_trap/parser/standard.rb
152
+ - lib/lint_trap/parser/vim_quickfix.rb
90
153
  - lib/lint_trap/version.rb
91
154
  - lint_trap.gemspec
155
+ - spec/command_spec.rb
156
+ - spec/container/docker_spec.rb
157
+ - spec/container/fake_spec.rb
158
+ - spec/fixtures/Good.java
159
+ - spec/fixtures/bad.coffee
160
+ - spec/fixtures/bad.cpp
161
+ - spec/fixtures/bad.css
162
+ - spec/fixtures/bad.go
163
+ - spec/fixtures/bad.java
164
+ - spec/fixtures/bad.js
165
+ - spec/fixtures/bad.json
166
+ - spec/fixtures/bad.py
167
+ - spec/fixtures/bad.rb
168
+ - spec/fixtures/bad.scss
169
+ - spec/fixtures/good.coffee
170
+ - spec/fixtures/good.cpp
171
+ - spec/fixtures/good.css
172
+ - spec/fixtures/good.go
173
+ - spec/fixtures/good.js
174
+ - spec/fixtures/good.json
175
+ - spec/fixtures/good.py
176
+ - spec/fixtures/good.rb
177
+ - spec/fixtures/good.scss
178
+ - spec/fixtures/lint.txt
179
+ - spec/integration/checkstyle_spec.rb
180
+ - spec/integration/coffeelint_spec.rb
181
+ - spec/integration/cppcheck_spec.rb
182
+ - spec/integration/csslint_spec.rb
183
+ - spec/integration/golint_spec.rb
184
+ - spec/integration/jshint_spec.rb
185
+ - spec/integration/jsonlint_spec.rb
186
+ - spec/integration/pylint_spec.rb
187
+ - spec/integration/rubocop_spec.rb
188
+ - spec/integration/scsslint_spec.rb
189
+ - spec/language/coffeescript_spec.rb
190
+ - spec/language/cpp_spec.rb
191
+ - spec/language/css_spec.rb
192
+ - spec/language/go_spec.rb
193
+ - spec/language/java_spec.rb
194
+ - spec/language/javascript_spec.rb
195
+ - spec/language/json_spec.rb
196
+ - spec/language/python_spec.rb
197
+ - spec/language/ruby_spec.rb
198
+ - spec/language/scss_spec.rb
199
+ - spec/language_spec.rb
92
200
  - spec/lint_trap_spec.rb
93
- - spec/parser_factory_spec.rb
94
- - spec/parsers/csslint_parser_spec.rb
95
- - spec/parsers/standard_parser_spec.rb
96
- - spec/parsers/vim_quickfix_parser_spec.rb
201
+ - spec/linter/checkstyle_spec.rb
202
+ - spec/linter/coffeelint_spec.rb
203
+ - spec/linter/cppcheck_spec.rb
204
+ - spec/linter/csslint_spec.rb
205
+ - spec/linter/golint_spec.rb
206
+ - spec/linter/jshint_spec.rb
207
+ - spec/linter/jsonlint_spec.rb
208
+ - spec/linter/pylint_spec.rb
209
+ - spec/linter/rubocop_spec.rb
210
+ - spec/linter/scsslint_spec.rb
211
+ - spec/linter_spec.rb
212
+ - spec/parser/csslint_spec.rb
213
+ - spec/parser/standard_spec.rb
214
+ - spec/parser/vim_quickfix_spec.rb
97
215
  - spec/spec_helper.rb
216
+ - spec/support/fixture_file_helper.rb
98
217
  homepage: https://github.com/lintci/lint_trap
99
218
  licenses:
100
219
  - MIT
@@ -115,14 +234,70 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
234
  version: '0'
116
235
  requirements: []
117
236
  rubyforge_project:
118
- rubygems_version: 2.4.1
237
+ rubygems_version: 2.4.5
119
238
  signing_key:
120
239
  specification_version: 4
121
240
  summary: Parses the output of various linters.
122
241
  test_files:
242
+ - spec/command_spec.rb
243
+ - spec/container/docker_spec.rb
244
+ - spec/container/fake_spec.rb
245
+ - spec/fixtures/Good.java
246
+ - spec/fixtures/bad.coffee
247
+ - spec/fixtures/bad.cpp
248
+ - spec/fixtures/bad.css
249
+ - spec/fixtures/bad.go
250
+ - spec/fixtures/bad.java
251
+ - spec/fixtures/bad.js
252
+ - spec/fixtures/bad.json
253
+ - spec/fixtures/bad.py
254
+ - spec/fixtures/bad.rb
255
+ - spec/fixtures/bad.scss
256
+ - spec/fixtures/good.coffee
257
+ - spec/fixtures/good.cpp
258
+ - spec/fixtures/good.css
259
+ - spec/fixtures/good.go
260
+ - spec/fixtures/good.js
261
+ - spec/fixtures/good.json
262
+ - spec/fixtures/good.py
263
+ - spec/fixtures/good.rb
264
+ - spec/fixtures/good.scss
265
+ - spec/fixtures/lint.txt
266
+ - spec/integration/checkstyle_spec.rb
267
+ - spec/integration/coffeelint_spec.rb
268
+ - spec/integration/cppcheck_spec.rb
269
+ - spec/integration/csslint_spec.rb
270
+ - spec/integration/golint_spec.rb
271
+ - spec/integration/jshint_spec.rb
272
+ - spec/integration/jsonlint_spec.rb
273
+ - spec/integration/pylint_spec.rb
274
+ - spec/integration/rubocop_spec.rb
275
+ - spec/integration/scsslint_spec.rb
276
+ - spec/language/coffeescript_spec.rb
277
+ - spec/language/cpp_spec.rb
278
+ - spec/language/css_spec.rb
279
+ - spec/language/go_spec.rb
280
+ - spec/language/java_spec.rb
281
+ - spec/language/javascript_spec.rb
282
+ - spec/language/json_spec.rb
283
+ - spec/language/python_spec.rb
284
+ - spec/language/ruby_spec.rb
285
+ - spec/language/scss_spec.rb
286
+ - spec/language_spec.rb
123
287
  - spec/lint_trap_spec.rb
124
- - spec/parser_factory_spec.rb
125
- - spec/parsers/csslint_parser_spec.rb
126
- - spec/parsers/standard_parser_spec.rb
127
- - spec/parsers/vim_quickfix_parser_spec.rb
288
+ - spec/linter/checkstyle_spec.rb
289
+ - spec/linter/coffeelint_spec.rb
290
+ - spec/linter/cppcheck_spec.rb
291
+ - spec/linter/csslint_spec.rb
292
+ - spec/linter/golint_spec.rb
293
+ - spec/linter/jshint_spec.rb
294
+ - spec/linter/jsonlint_spec.rb
295
+ - spec/linter/pylint_spec.rb
296
+ - spec/linter/rubocop_spec.rb
297
+ - spec/linter/scsslint_spec.rb
298
+ - spec/linter_spec.rb
299
+ - spec/parser/csslint_spec.rb
300
+ - spec/parser/standard_spec.rb
301
+ - spec/parser/vim_quickfix_spec.rb
128
302
  - spec/spec_helper.rb
303
+ - spec/support/fixture_file_helper.rb
@@ -1,32 +0,0 @@
1
- require_relative 'parsers/null_parser'
2
- require_relative 'parsers/standard_parser'
3
- require_relative 'parsers/vim_quickfix_parser'
4
- require_relative 'parsers/csslint_parser'
5
-
6
- module LintTrap
7
- # Determines the appropriate parser for the given linter
8
- module ParserFactory
9
- class << self
10
- def register(linter, parser)
11
- @parsers ||= Hash.new{|h, k| h[k] = Parsers::NullParser}
12
- @parsers[linter] = parser
13
- end
14
-
15
- def parser_for(linter)
16
- @parsers[linter]
17
- end
18
- end
19
-
20
- register 'standard', Parsers::StandardParser
21
- register 'vim_quickfix', Parsers::VimQuickfixParser
22
-
23
- register 'checkstyle', Parsers::StandardParser
24
- register 'coffeelint', Parsers::StandardParser
25
- register 'csslint', Parsers::CSSLintParser
26
- register 'golint', Parsers::VimQuickfixParser
27
- register 'jshint', Parsers::StandardParser
28
- register 'jsonlint', Parsers::StandardParser
29
- register 'rubocop', Parsers::StandardParser
30
- register 'scsslint', Parsers::StandardParser
31
- end
32
- end
@@ -1,11 +0,0 @@
1
- require_relative 'base_parser'
2
-
3
- module LintTrap
4
- module Parsers
5
- # Handles parsing for unknown linters
6
- class NullParser < BaseParser
7
- def parse
8
- end
9
- end
10
- end
11
- end
@@ -1,23 +0,0 @@
1
- require_relative 'line_parser'
2
-
3
- module LintTrap
4
- module Parsers
5
- # Handles parsing LintCI standard format
6
- class StandardParser < LineParser
7
-
8
- private
9
-
10
- def violation_regex
11
- /
12
- (?<file>[^:]+):
13
- (?<line>[^:]*):
14
- (?<column>[^:]*):
15
- (?<length>[^:]*):
16
- (?<rule>[^:]*):
17
- (?<severity>[^:]*):
18
- (?<message>.+)
19
- /x
20
- end
21
- end
22
- end
23
- end
@@ -1,20 +0,0 @@
1
- require_relative 'line_parser'
2
-
3
- module LintTrap
4
- module Parsers
5
- # Handles parsing LintCI standard format
6
- class VimQuickfixParser < LineParser
7
-
8
- private
9
-
10
- def violation_regex
11
- /
12
- (?<file>[^:]+):
13
- (?<line>[^:]*):
14
- (?<column>[^:]*):\s*
15
- (?<message>.+)
16
- /x
17
- end
18
- end
19
- end
20
- end
@@ -1,17 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe LintTrap::ParserFactory do
4
- describe '.linter_for' do
5
- it 'returns a NullParser when no valid linter is given' do
6
- expect(described_class.parser_for('blah')).to eq(LintTrap::Parsers::NullParser)
7
- end
8
-
9
- it 'returns the StandardParser when a valid linter is given' do
10
- expect(described_class.parser_for('rubocop')).to eq(LintTrap::Parsers::StandardParser)
11
- end
12
-
13
- it 'returns the VimQuickfixParser when the parser itself is specified' do
14
- expect(described_class.parser_for('vim_quickfix')).to eq(LintTrap::Parsers::VimQuickfixParser)
15
- end
16
- end
17
- end
@@ -1,26 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe LintTrap::Parsers::CSSLintParser do
4
- let(:parser_output) do
5
- "bad.css: line 2, col 5, Error - Using width with border can sometimes"\
6
- " make elements larger than you expect.\n\n"
7
- end
8
- let(:io){StringIO.new(parser_output)}
9
- subject(:parser){described_class}
10
-
11
- describe '.parse' do
12
- it 'parses violations from io' do
13
- expect{|b| parser.parse(io, &b)}.to yield_successive_args(
14
- {
15
- file: 'bad.css',
16
- line: '2',
17
- column: '5',
18
- length: nil,
19
- rule: nil,
20
- severity: 'Error',
21
- message: 'Using width with border can sometimes make elements larger than you expect.'
22
- }
23
- )
24
- end
25
- end
26
- end