haml_lint 0.59.0 → 0.60.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: 15d3baf951722e2a699bc903a0848affa4a05b38939c67554e0410dfb9b817bb
4
- data.tar.gz: d143ca9d7330ff3f4d7e32fa306be4a520258627f34b0ddd7536964ebdd45c05
3
+ metadata.gz: 8bf4b2b435129bea13f5c1b32aabf202f5e8731264df179e3e7a9c16017b8654
4
+ data.tar.gz: 34a95aa1ac68c54a513d9431be449f5a53963d77e7d451cfa532c60ff08fe08f
5
5
  SHA512:
6
- metadata.gz: 85296a42fbb76f5033401ecd2825efafe5efad954ec2e312af2133a468afe1b92f1c95269a571cbfe9cc9366ecc244a257d7e3e4b756911c921820f7d181beb1
7
- data.tar.gz: 90309db3dbfa97deb00561fd6479d82e14519fe3ba59bcc80da456731ab3c830afe389bd958df382748b3d0906fdde4a3c7abe110b99151d1be797e4e1cde63f
6
+ metadata.gz: a65d869de4f21555cc165baccae390ae09202de3d6aea707404806d0ee40bdd1d5916d7ab3ae9a7b4a0d35c1a4a5a8c89da3cb317389877460e03f48b5577c54
7
+ data.tar.gz: 84ccd1349eb889e3b516f42e4919eb0003566f01ba62a01b05cce28aeb801138c6f725eac054c23073997f0e67e452765ac78c03bfe710639c9742828b85521d
@@ -45,6 +45,18 @@ Layout/EndAlignment:
45
45
  Layout/EndOfLine:
46
46
  Enabled: false
47
47
 
48
+ # Complying with this lint requires the use of pipes which causes a conflict with MultilinePipe.
49
+ Layout/FirstArrayElementLineBreak:
50
+ Enabled: false
51
+
52
+ # Complying with this lint requires the use of pipes which causes a conflict with MultilinePipe.
53
+ Layout/FirstHashElementLineBreak:
54
+ Enabled: false
55
+
56
+ # Complying with this lint requires the use of pipes which causes a conflict with MultilinePipe.
57
+ Layout/FirstMethodArgumentLineBreak:
58
+ Enabled: false
59
+
48
60
  # Turning this cop on can turn
49
61
  # = content_tag(:span) do
50
62
  # - foo
@@ -21,7 +21,7 @@ module HamlLint
21
21
  return unless enabled?
22
22
 
23
23
  if node.parsed_script.contains_instance_variables?
24
- record_lint(node, "Avoid using instance variables in #{file_types} views")
24
+ record_lint(node, failure_message)
25
25
  end
26
26
  end
27
27
 
@@ -41,10 +41,27 @@ module HamlLint
41
41
 
42
42
  visit_script(node) ||
43
43
  if node.parsed_attributes.contains_instance_variables?
44
- record_lint(node, "Avoid using instance variables in #{file_types} views")
44
+ record_lint(node, failure_message)
45
45
  end
46
46
  end
47
47
 
48
+ # Checks for instance variables in :ruby filters when the linter is enabled.
49
+ #
50
+ # @param [HamlLint::Tree::FilterNode]
51
+ # @return [void]
52
+ def visit_filter(node)
53
+ return unless enabled?
54
+ return unless node.filter_type == 'ruby'
55
+ return unless ast = parse_ruby(node.text)
56
+
57
+ ast.each_node do |i|
58
+ if i.type == :ivar
59
+ record_lint(node, failure_message)
60
+ break
61
+ end
62
+ end
63
+ end
64
+
48
65
  private
49
66
 
50
67
  # Tracks whether the linter is enabled for the file.
@@ -75,5 +92,13 @@ module HamlLint
75
92
  def matcher
76
93
  @matcher ||= Regexp.new(config['matchers'][file_types] || '\A_.*\.haml\z')
77
94
  end
95
+
96
+ # The error message when an ivar is found
97
+ #
98
+ # @api private
99
+ # @return [String]
100
+ def failure_message
101
+ "Avoid using instance variables in #{file_types} views"
102
+ end
78
103
  end
79
104
  end
@@ -10,7 +10,7 @@ module HamlLint
10
10
  # @param args [Array<String>] arguments passed via the command line
11
11
  # @return [Hash] parsed options
12
12
  def parse(args)
13
- @options = {}
13
+ @options = default_options
14
14
 
15
15
  OptionParser.new do |parser|
16
16
  parser.banner = "Usage: #{APP_NAME} [options] [file1, file2, ...]"
@@ -32,6 +32,10 @@ module HamlLint
32
32
 
33
33
  private
34
34
 
35
+ def default_options
36
+ { parallel: true }
37
+ end
38
+
35
39
  def add_linter_options(parser) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
36
40
  parser.on('--auto-gen-config', 'Generate a configuration file acting as a TODO list') do
37
41
  @options[:auto_gen_config] = true
@@ -56,6 +60,10 @@ module HamlLint
56
60
  @options[:parallel] = true
57
61
  end
58
62
 
63
+ parser.on('--no-parallel', 'Disable parallel linter runs') do
64
+ @options[:parallel] = false
65
+ end
66
+
59
67
  parser.on('-a', '--auto-correct', 'Auto-correct offenses (only when it’s safe)') do
60
68
  @options[:autocorrect] = :safe
61
69
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  module HamlLint
5
- VERSION = '0.59.0'
5
+ VERSION = '0.60.0'
6
6
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml_lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.59.0
4
+ version: 0.60.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane da Silva
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-09-28 00:00:00.000000000 Z
10
+ date: 2025-01-30 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: haml
@@ -201,7 +200,6 @@ homepage: https://github.com/sds/haml-lint
201
200
  licenses:
202
201
  - MIT
203
202
  metadata: {}
204
- post_install_message:
205
203
  rdoc_options: []
206
204
  require_paths:
207
205
  - lib
@@ -216,8 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
216
214
  - !ruby/object:Gem::Version
217
215
  version: '0'
218
216
  requirements: []
219
- rubygems_version: 3.5.9
220
- signing_key:
217
+ rubygems_version: 3.6.2
221
218
  specification_version: 4
222
219
  summary: HAML lint tool
223
220
  test_files: []