haml_lint 0.42.0 → 0.44.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: 45d676ecd18fa32156a84c6f6d2c5a062a3a74fc8bacfc5ae6ec9e2b2c5436a7
4
- data.tar.gz: '038b1f81556d35a4c6037b2ec5e08428465f8d09258d3c603a3ee7cbaf4f1f55'
3
+ metadata.gz: bbda72cc37739238b7f8d4add64844eafa34e89381721b94863a55c401d07c3c
4
+ data.tar.gz: 9112d52034c50d6826c7b6574968eff1f09d648cc24618cedcfe83b120c72ea5
5
5
  SHA512:
6
- metadata.gz: e69de9bbae167b9f61818498b008dfb4789a41d7b9753b04035951c544385d160e69ccde08dee04ee2a7a786efc14f4657ed468935056ade34fcf0d185d82167
7
- data.tar.gz: dc2e034a37c3fb7ede287d16d83b1cdbfbc1597ee5ba96c59571b9b975585112d36880a228d9ea35585a958694d7f322e965f4d927d95de167dd5399cf93417c
6
+ metadata.gz: 7725e42e8f37b2b34e41c203b21f88af876b4bacc8a250be12de431dae62ac48dd5192a8280094566bd51c2f5fcb150457c9deaad6203b0cc4b7c0be67da6ece
7
+ data.tar.gz: 13e48778febfc59d2440f95ca4e3793dc0a46fe4a4eb11dab84032d2d17b797d4a84dccbd73c408207bf73d90eaf633b0e57acc4c124bfcc7fac75338bd9916a
@@ -21,7 +21,7 @@ module HamlLint
21
21
  case version
22
22
  when '~> 4.0' then HamlLint::Adapter::Haml4
23
23
  when '~> 5.0', '~> 5.1', '~> 5.2' then HamlLint::Adapter::Haml5
24
- when '~> 6.0', '~> 6.0.a' then HamlLint::Adapter::Haml6
24
+ when '~> 6.0', '~> 6.0.a', '~> 6.1' then HamlLint::Adapter::Haml6
25
25
  else fail HamlLint::Exceptions::UnknownHamlVersion, "Cannot handle Haml version: #{version}"
26
26
  end
27
27
  end
@@ -53,8 +53,13 @@ module HamlLint
53
53
  context[:exclude_files] ||= []
54
54
  config = load_from_file(file)
55
55
 
56
- [default_configuration, resolve_inheritance(config, context), config]
57
- .reduce { |acc, elem| acc.merge(elem) }
56
+ configs = if context[:loaded_files].any?
57
+ [resolve_inheritance(config, context), config]
58
+ else
59
+ [default_configuration, resolve_inheritance(config, context), config]
60
+ end
61
+
62
+ configs.reduce { |acc, elem| acc.merge(elem) }
58
63
  rescue Psych::SyntaxError, Errno::ENOENT => e
59
64
  raise HamlLint::Exceptions::ConfigurationError,
60
65
  "Unable to load configuration from '#{file}': #{e}",
@@ -91,6 +96,18 @@ module HamlLint
91
96
  hash['inherits_from'].concat(Array(hash.delete('inherit_from')))
92
97
  end
93
98
 
99
+ if hash.key?('inherit_gem')
100
+ hash['inherits_from'] ||= []
101
+
102
+ gems = hash.delete('inherit_gem')
103
+ (gems || {}).each_pair.reverse_each do |gem_name, config_path|
104
+ Array(config_path).reverse_each do |path|
105
+ # Put gem configuration first so local configuration overrides it.
106
+ hash['inherits_from'].unshift gem_config_path(gem_name, path)
107
+ end
108
+ end
109
+ end
110
+
94
111
  HamlLint::Configuration.new(hash, file)
95
112
  end
96
113
 
@@ -133,6 +150,24 @@ module HamlLint
133
150
  .compact
134
151
  .reduce { |acc, elem| acc.merge(elem) } || config
135
152
  end
153
+
154
+ # Resolves the config file path relative to a gem
155
+ #
156
+ # @param gem_name [String] name of the gem
157
+ # @param relative_config_path [String] path of the file to resolve, relative to the gem root
158
+ # @return [Stringg]
159
+ def gem_config_path(gem_name, relative_config_path)
160
+ if defined?(Bundler)
161
+ gem = Bundler.load.specs[gem_name].first
162
+ gem_path = gem.full_gem_path if gem
163
+ end
164
+
165
+ gem_path ||= Gem::Specification.find_by_name(gem_name).gem_dir
166
+
167
+ File.join(gem_path, relative_config_path)
168
+ rescue Gem::LoadError => e
169
+ raise Gem::LoadError, "Unable to find gem #{gem_name}; is the gem installed? #{e}"
170
+ end
136
171
  end
137
172
  end
138
173
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the gem version.
4
4
  module HamlLint
5
- VERSION = '0.42.0'
5
+ VERSION = '0.44.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.42.0
4
+ version: 0.44.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-09-27 00:00:00.000000000 Z
11
+ date: 2023-01-27 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: '6.1'
22
+ version: '6.2'
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: '6.1'
32
+ version: '6.2'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: parallel
35
35
  requirement: !ruby/object:Gem::Requirement