haml_lint 0.40.1 → 0.41.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1655e5263c92bb0a391c1e56aea103792409f17a72deafb16818844fd5f6d7c8
4
- data.tar.gz: 65d4539637d4caf656940041040ad33227a0d89eb923207fb5fedafcf357f0bd
3
+ metadata.gz: 50f707542a5125e9d359aec64947951bc3ec4dc27b4d96995320c8f2253e6f1a
4
+ data.tar.gz: b39a5f05253172bf897eb608bc7ccc4445d8fd76b84d38616c7ad53cacc5a276
5
5
  SHA512:
6
- metadata.gz: 1f08f1952a5a9ab8adc6b5c6730ec0a441ccdc10ac1a59922f77bc54c74fc95db3b49e732400aef960c4bae7581950fb21874e78d3b516e22d5cc61dc914da72
7
- data.tar.gz: 91af5862db990bc021c1088b0de462f5f3a84ad7509cc62498ee4ac70a11f05b423d7778deead53da353253f38d76d5c84cde5417d1da3ac43bccc23f16a4753
6
+ metadata.gz: fa4d026d1b5ee13a4cb3e98dcff7117cba888a84684404166e5df193355978e2514d581ad6d92d7d92f65dfc2f00fc76fe16067ed2d223366b6e64d440ca6788
7
+ data.tar.gz: b46c4532c31cbd25e57b863b16775bdc496a1e2abad2ef5683dc75ad44f7d8ad13348ed8587e9209896226eea7e36f09c108c41b0da223381cddf9a565a46982
data/config/default.yml CHANGED
@@ -97,6 +97,7 @@ linters:
97
97
  - Layout/CaseIndentation
98
98
  - Layout/ElseAlignment
99
99
  - Layout/EndOfLine
100
+ - Layout/FirstHashElementIndentation
100
101
  - Layout/HashAlignment
101
102
  - Layout/IndentationWidth
102
103
  - Layout/LineLength # renamed from Metrics/LineLength in rubocop 0.79.0
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HamlLint
4
+ class Adapter
5
+ # Adapts the Haml::Parser from Haml 5 for use in HamlLint
6
+ # :reek:UncommunicativeModuleName
7
+ class Haml6 < Adapter
8
+ # Parses the specified Haml code into an abstract syntax tree
9
+ #
10
+ # @example
11
+ # HamlLint::Adapter::Haml6.new('%div')
12
+ #
13
+ # @api public
14
+ # @param source [String] Haml code to parse
15
+ # @param options [private Haml::Parser::ParserOptions]
16
+ def initialize(source, options = {})
17
+ @source = source
18
+ @parser = Haml::Parser.new(options)
19
+ end
20
+
21
+ # Parses the source code into an abstract syntax tree
22
+ #
23
+ # @example
24
+ # HamlLint::Adapter::Haml6.new('%div').parse
25
+ #
26
+ # @api public
27
+ # @return [Haml::Parser::ParseNode]
28
+ # @raise [Haml::Error]
29
+ def parse
30
+ parser.call(source)
31
+ end
32
+
33
+ private
34
+
35
+ # The Haml parser to adapt for HamlLint
36
+ #
37
+ # @api private
38
+ # @return [Haml::Parser] the Haml 4 parser
39
+ attr_reader :parser
40
+
41
+ # The Haml code to parse
42
+ #
43
+ # @api private
44
+ # @return [String] Haml code to parse
45
+ attr_reader :source
46
+ end
47
+ end
48
+ end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'haml_lint/adapter/haml_4'
4
4
  require 'haml_lint/adapter/haml_5'
5
+ require 'haml_lint/adapter/haml_6'
5
6
  require 'haml_lint/exceptions'
6
7
 
7
8
  module HamlLint
@@ -20,6 +21,7 @@ module HamlLint
20
21
  case version
21
22
  when '~> 4.0' then HamlLint::Adapter::Haml4
22
23
  when '~> 5.0', '~> 5.1', '~> 5.2' then HamlLint::Adapter::Haml5
24
+ when '~> 6.0', '~> 6.0.a' then HamlLint::Adapter::Haml6
23
25
  else fail HamlLint::Exceptions::UnknownHamlVersion, "Cannot handle Haml version: #{version}"
24
26
  end
25
27
  end
@@ -69,12 +69,12 @@ module HamlLint
69
69
  # variable" lints)
70
70
  additional_attributes.each do |attributes_code|
71
71
  # Normalize by removing excess whitespace to avoid format lints
72
- attributes_code = attributes_code.gsub(/\s*\n\s*/, ' ').strip
72
+ attributes_code = attributes_code.gsub(/\s*\n\s*/, "\n").strip
73
73
 
74
74
  # Attributes can either be a method call or a literal hash, so wrap it
75
75
  # in a method call itself in order to avoid having to differentiate the
76
76
  # two.
77
- add_line("{}.merge(#{attributes_code.strip})", node)
77
+ add_line("{}.merge(#{attributes_code})", node)
78
78
  end
79
79
 
80
80
  check_tag_static_hash_source(node)
@@ -94,6 +94,7 @@ module HamlLint
94
94
 
95
95
  def visit_script(node)
96
96
  code = node.text
97
+
97
98
  add_line(code.strip, node)
98
99
 
99
100
  start_block = anonymous_block?(code) || start_block_keyword?(code)
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  module HamlLint
5
- VERSION = '0.40.1'
5
+ VERSION = '0.41.0'
6
6
  end
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.40.1
4
+ version: 0.41.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: 2022-08-20 00:00:00.000000000 Z
11
+ date: 2022-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: haml
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '4.0'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '5.3'
22
+ version: '6.1'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '4.0'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '5.3'
32
+ version: '6.1'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: parallel
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -100,6 +100,7 @@ files:
100
100
  - lib/haml_lint/adapter.rb
101
101
  - lib/haml_lint/adapter/haml_4.rb
102
102
  - lib/haml_lint/adapter/haml_5.rb
103
+ - lib/haml_lint/adapter/haml_6.rb
103
104
  - lib/haml_lint/cli.rb
104
105
  - lib/haml_lint/comment_configuration.rb
105
106
  - lib/haml_lint/configuration.rb