slim_lint 0.13.0 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/default.yml +10 -2
- data/lib/slim_lint/cli.rb +1 -1
- data/lib/slim_lint/configuration.rb +1 -1
- data/lib/slim_lint/linter/empty_lines.rb +24 -0
- data/lib/slim_lint/linter/trailing_blank_lines.rb +18 -0
- data/lib/slim_lint/version.rb +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf8c56ea545885c5a0214e60a865a266f4459ed5
|
4
|
+
data.tar.gz: a8d108a971c36c77e507374a4aeffcbf5d188381
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58880962969b559714aa8c51b406d92d8854da6bdc38a65f505c1f8192e96e09847c9bb361b379d3189b4dfd964762ab62599e1a8820a54f7cb50e20c75a3154
|
7
|
+
data.tar.gz: 1cbe595ed72c75eee128580bbdcb59db30569593537b8b9a2c46f34c2c5ba2e182c25beb8df81a191fdbdecd7ec398bf0c3358aa86af3d5f55a766853493f33d
|
data/config/default.yml
CHANGED
@@ -18,6 +18,9 @@ linters:
|
|
18
18
|
EmptyControlStatement:
|
19
19
|
enabled: true
|
20
20
|
|
21
|
+
EmptyLines:
|
22
|
+
enabled: true
|
23
|
+
|
21
24
|
RedundantDiv:
|
22
25
|
enabled: true
|
23
26
|
|
@@ -32,9 +35,11 @@ linters:
|
|
32
35
|
# WARNING: If you define this list in your own .slim-lint.yml file, you'll
|
33
36
|
# be overriding the list defined here.
|
34
37
|
ignored_cops:
|
38
|
+
- Layout/AlignArray
|
35
39
|
- Layout/AlignHash
|
36
40
|
- Layout/AlignParameters
|
37
41
|
- Layout/FirstParameterIndentation
|
42
|
+
- Layout/IndentArray
|
38
43
|
- Layout/IndentationConsistency
|
39
44
|
- Layout/IndentationWidth
|
40
45
|
- Layout/MultilineArrayBraceLayout
|
@@ -50,9 +55,9 @@ linters:
|
|
50
55
|
- Lint/EndAlignment
|
51
56
|
- Lint/Void
|
52
57
|
- Metrics/BlockLength
|
58
|
+
- Metrics/BlockNesting
|
53
59
|
- Metrics/LineLength
|
54
|
-
-
|
55
|
-
- Style/FileName
|
60
|
+
- Naming/FileName
|
56
61
|
- Style/FrozenStringLiteralComment
|
57
62
|
- Style/IfUnlessModifier
|
58
63
|
- Style/Next
|
@@ -64,5 +69,8 @@ linters:
|
|
64
69
|
TagCase:
|
65
70
|
enabled: true
|
66
71
|
|
72
|
+
TrailingBlankLines:
|
73
|
+
enabled: true
|
74
|
+
|
67
75
|
TrailingWhitespace:
|
68
76
|
enabled: true
|
data/lib/slim_lint/cli.rb
CHANGED
@@ -96,7 +96,7 @@ module SlimLint
|
|
96
96
|
# Ensure `include` and `exclude` options for linters are arrays
|
97
97
|
# (since users can specify a single string glob pattern for convenience)
|
98
98
|
def ensure_linter_include_exclude_arrays_exist
|
99
|
-
@hash['linters'].
|
99
|
+
@hash['linters'].each_key do |linter_name|
|
100
100
|
%w[include exclude].each do |option|
|
101
101
|
linter_config = @hash['linters'][linter_name]
|
102
102
|
linter_config[option] = Array(linter_config[option])
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module SlimLint
|
2
|
+
# This linter checks for two or more consecutive blank lines
|
3
|
+
# and for the first blank line in file.
|
4
|
+
class Linter::EmptyLines < Linter
|
5
|
+
include LinterRegistry
|
6
|
+
|
7
|
+
on_start do |_sexp|
|
8
|
+
dummy_node = Struct.new(:line)
|
9
|
+
|
10
|
+
was_empty = true
|
11
|
+
document.source.lines.each_with_index do |line, i|
|
12
|
+
if line.blank?
|
13
|
+
if was_empty
|
14
|
+
report_lint(dummy_node.new(i + 1),
|
15
|
+
'Extra empty line detected')
|
16
|
+
end
|
17
|
+
was_empty = true
|
18
|
+
else
|
19
|
+
was_empty = false
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module SlimLint
|
2
|
+
# This linter looks for trailing blank lines and a final newline.
|
3
|
+
class Linter::TrailingBlankLines < Linter
|
4
|
+
include LinterRegistry
|
5
|
+
|
6
|
+
on_start do |_sexp|
|
7
|
+
dummy_node = Struct.new(:line)
|
8
|
+
|
9
|
+
if !document.source.end_with?("\n")
|
10
|
+
report_lint(dummy_node.new(document.source_lines.size),
|
11
|
+
'No blank line in the end of file')
|
12
|
+
elsif document.source.lines.last.blank?
|
13
|
+
report_lint(dummy_node.new(document.source.lines.size),
|
14
|
+
'Multiple empty lines in the end of file')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/slim_lint/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slim_lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shane da Silva
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slim
|
@@ -50,14 +50,14 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0.
|
53
|
+
version: 0.50.0
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: 0.
|
60
|
+
version: 0.50.0
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: sysexits
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -132,11 +132,13 @@ files:
|
|
132
132
|
- lib/slim_lint/linter/comment_control_statement.rb
|
133
133
|
- lib/slim_lint/linter/consecutive_control_statements.rb
|
134
134
|
- lib/slim_lint/linter/empty_control_statement.rb
|
135
|
+
- lib/slim_lint/linter/empty_lines.rb
|
135
136
|
- lib/slim_lint/linter/line_length.rb
|
136
137
|
- lib/slim_lint/linter/redundant_div.rb
|
137
138
|
- lib/slim_lint/linter/rubocop.rb
|
138
139
|
- lib/slim_lint/linter/tab.rb
|
139
140
|
- lib/slim_lint/linter/tag_case.rb
|
141
|
+
- lib/slim_lint/linter/trailing_blank_lines.rb
|
140
142
|
- lib/slim_lint/linter/trailing_whitespace.rb
|
141
143
|
- lib/slim_lint/linter_registry.rb
|
142
144
|
- lib/slim_lint/linter_selector.rb
|
@@ -180,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
182
|
version: '0'
|
181
183
|
requirements: []
|
182
184
|
rubyforge_project:
|
183
|
-
rubygems_version: 2.6.
|
185
|
+
rubygems_version: 2.6.13
|
184
186
|
signing_key:
|
185
187
|
specification_version: 4
|
186
188
|
summary: Slim template linting tool
|