haml_lint 0.48.0 → 0.49.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 +3 -0
- data/lib/haml_lint/linter/trailing_empty_lines.rb +22 -0
- data/lib/haml_lint/ruby_parser.rb +11 -1
- data/lib/haml_lint/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0411721c82b95f3662c12b9bb3eeff8013a81dbef095d1b5756baf529f121fd9
|
4
|
+
data.tar.gz: 2ab1affd25ac7b27278a35bc56a883aeb8626573e082b3ac4a2e725bdff1a90f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 431cc4b6f6dec7e6d910e7406a76fa58a9224fd689446636e02a7cb895137c33090a3fd845ffbeda941650549da069b8ce056eb979494d6442b348939da32ba5
|
7
|
+
data.tar.gz: 9c491a34546d7b437ee53ba5ec4059f8019bcd45dae564c90d230d8faaf69c7e4ec5f07585afc61bd5e0f903b1678567b727d9d82b3a30723e0aa1c8767923a6
|
data/config/default.yml
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module HamlLint
|
4
|
+
# Checks for trailing empty lines.
|
5
|
+
class Linter::TrailingEmptyLines < Linter
|
6
|
+
include LinterRegistry
|
7
|
+
|
8
|
+
DummyNode = Struct.new(:line)
|
9
|
+
|
10
|
+
def visit_root(root)
|
11
|
+
return if document.source.empty?
|
12
|
+
line_number = document.last_non_empty_line
|
13
|
+
|
14
|
+
node = root.node_for_line(line_number)
|
15
|
+
return if node.disabled?(self)
|
16
|
+
|
17
|
+
return unless document.source.end_with?("\n\n")
|
18
|
+
|
19
|
+
record_lint(line_number, 'Files should not end with trailing empty lines')
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
require 'rubocop'
|
4
4
|
require 'rubocop/ast/builder'
|
5
|
-
require 'parser/current'
|
6
5
|
|
7
6
|
module HamlLint
|
8
7
|
# Parser for the Ruby language.
|
@@ -14,10 +13,21 @@ module HamlLint
|
|
14
13
|
class RubyParser
|
15
14
|
# Creates a reusable parser.
|
16
15
|
def initialize
|
16
|
+
require_parser
|
17
17
|
@builder = ::RuboCop::AST::Builder.new
|
18
18
|
@parser = ::Parser::CurrentRuby.new(@builder)
|
19
19
|
end
|
20
20
|
|
21
|
+
# Require the current parser version while suppressing the
|
22
|
+
# compliancy warning for minor version differences.
|
23
|
+
def require_parser
|
24
|
+
prev = $VERBOSE
|
25
|
+
$VERBOSE = nil
|
26
|
+
require 'parser/current'
|
27
|
+
ensure
|
28
|
+
$VERBOSE = prev
|
29
|
+
end
|
30
|
+
|
21
31
|
# Parse the given Ruby source into an abstract syntax tree.
|
22
32
|
#
|
23
33
|
# @param source [String] Ruby source code
|
data/lib/haml_lint/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haml_lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.49.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: 2023-07-
|
11
|
+
date: 2023-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: haml
|
@@ -143,6 +143,7 @@ files:
|
|
143
143
|
- lib/haml_lint/linter/space_inside_hash_attributes.rb
|
144
144
|
- lib/haml_lint/linter/syntax.rb
|
145
145
|
- lib/haml_lint/linter/tag_name.rb
|
146
|
+
- lib/haml_lint/linter/trailing_empty_lines.rb
|
146
147
|
- lib/haml_lint/linter/trailing_whitespace.rb
|
147
148
|
- lib/haml_lint/linter/unnecessary_interpolation.rb
|
148
149
|
- lib/haml_lint/linter/unnecessary_string_output.rb
|
@@ -220,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
220
221
|
- !ruby/object:Gem::Version
|
221
222
|
version: '0'
|
222
223
|
requirements: []
|
223
|
-
rubygems_version: 3.1
|
224
|
+
rubygems_version: 3.0.3.1
|
224
225
|
signing_key:
|
225
226
|
specification_version: 4
|
226
227
|
summary: HAML lint tool
|