haml_lint 0.25.1 → 0.26.0
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/config/default.yml +8 -4
- data/lib/haml_lint/linter/rubocop.rb +6 -1
- data/lib/haml_lint/linter/unnecessary_interpolation.rb +1 -1
- data/lib/haml_lint/linter/view_length.rb +19 -0
- data/lib/haml_lint/reporter/disabled_config_reporter.rb +9 -3
- data/lib/haml_lint/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd94eae8ee22841c46e2d3af6beb0a8b3083c305
|
4
|
+
data.tar.gz: 209d59375ccc51443638795414ca08cbb15a9ce1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37f51cc96857c95b8e32eab1cdc8bd992f8264c371869e56ce8b3eb304e80f0a8c90a313b9ad4ca2f1c8879a4a7e713d23a7c8cba38e0752c4b4ee6c75112f5f
|
7
|
+
data.tar.gz: affb71eddfa8eaf47096af284fa57c4d115072904e0c4b78934df1e0dc3eb4675a864b02b0d8343e0d80be6982456266c51c1a0dd12700dbd0619c629fc0bce8
|
data/config/default.yml
CHANGED
@@ -91,9 +91,12 @@ linters:
|
|
91
91
|
- Lint/BlockAlignment
|
92
92
|
- Lint/EndAlignment
|
93
93
|
- Lint/Void
|
94
|
+
- Layout/AlignParameters
|
95
|
+
- Layout/IndentationWidth
|
96
|
+
- Layout/TrailingBlankLines
|
97
|
+
- Layout/TrailingWhitespace
|
94
98
|
- Metrics/BlockLength
|
95
99
|
- Metrics/LineLength
|
96
|
-
- Style/AlignParameters
|
97
100
|
- Style/BlockNesting
|
98
101
|
- Style/ElseAlignment
|
99
102
|
- Style/EndOfLine
|
@@ -101,10 +104,7 @@ linters:
|
|
101
104
|
- Style/FinalNewline
|
102
105
|
- Style/FrozenStringLiteralComment
|
103
106
|
- Style/IfUnlessModifier
|
104
|
-
- Style/IndentationWidth
|
105
107
|
- Style/Next
|
106
|
-
- Style/TrailingBlankLines
|
107
|
-
- Style/TrailingWhitespace
|
108
108
|
- Style/WhileUntilModifier
|
109
109
|
|
110
110
|
RubyComments:
|
@@ -128,3 +128,7 @@ linters:
|
|
128
128
|
|
129
129
|
UnnecessaryStringOutput:
|
130
130
|
enabled: true
|
131
|
+
|
132
|
+
ViewLength:
|
133
|
+
enabled: true
|
134
|
+
max: 100
|
@@ -26,7 +26,12 @@ module HamlLint
|
|
26
26
|
def find_lints(ruby, source_map)
|
27
27
|
rubocop = ::RuboCop::CLI.new
|
28
28
|
|
29
|
-
filename =
|
29
|
+
filename =
|
30
|
+
if document.file
|
31
|
+
"#{document.file}.rb"
|
32
|
+
else
|
33
|
+
'ruby_script.rb'
|
34
|
+
end
|
30
35
|
|
31
36
|
with_ruby_from_stdin(ruby) do
|
32
37
|
extract_lints_from_offenses(lint_file(rubocop, filename), source_map)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module HamlLint
|
2
|
+
# Detects overly long views.
|
3
|
+
class Linter::ViewLength < Linter
|
4
|
+
include LinterRegistry
|
5
|
+
|
6
|
+
MSG = 'View template is too long [%d/%d]'.freeze
|
7
|
+
|
8
|
+
DummyNode = Struct.new(:line)
|
9
|
+
|
10
|
+
def visit_root(_root)
|
11
|
+
max = config['max']
|
12
|
+
line_count = document.source_lines.count
|
13
|
+
|
14
|
+
if line_count > max
|
15
|
+
record_lint(DummyNode.new(0), format(MSG, line_count, max))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -95,9 +95,15 @@ module HamlLint
|
|
95
95
|
[].tap do |output|
|
96
96
|
output << " # Offense count: #{linters_lint_count[linter]}"
|
97
97
|
output << " #{linter}:"
|
98
|
-
|
99
|
-
files.
|
100
|
-
|
98
|
+
# disable the linter when there are many files with offenses.
|
99
|
+
# exclude the affected files otherwise.
|
100
|
+
if files.count > 15
|
101
|
+
output << ' enabled: false'
|
102
|
+
else
|
103
|
+
output << ' exclude:'
|
104
|
+
files.each do |filename|
|
105
|
+
output << %{ - "#{filename}"}
|
106
|
+
end
|
101
107
|
end
|
102
108
|
end.join("\n")
|
103
109
|
end
|
data/lib/haml_lint/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haml_lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.26.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brigade Engineering
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-06-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: haml
|
@@ -71,14 +71,14 @@ dependencies:
|
|
71
71
|
requirements:
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 0.
|
74
|
+
version: 0.49.0
|
75
75
|
type: :runtime
|
76
76
|
prerelease: false
|
77
77
|
version_requirements: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - ">="
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: 0.
|
81
|
+
version: 0.49.0
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
83
|
name: sysexits
|
84
84
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,6 +150,7 @@ files:
|
|
150
150
|
- lib/haml_lint/linter/trailing_whitespace.rb
|
151
151
|
- lib/haml_lint/linter/unnecessary_interpolation.rb
|
152
152
|
- lib/haml_lint/linter/unnecessary_string_output.rb
|
153
|
+
- lib/haml_lint/linter/view_length.rb
|
153
154
|
- lib/haml_lint/linter_registry.rb
|
154
155
|
- lib/haml_lint/linter_selector.rb
|
155
156
|
- lib/haml_lint/logger.rb
|