haml:lint InlineJavaScript linter only runs if spring is enabled
Summary
The InlineJavaScript
linter for haml:lint
stopped running due to a linter registration error, because
the linter registry was being reinitialized in gitlab/lib/tasks/haml-lint.rake. This error
was probably introduced in the following commit:
27381e22
But, it didn't show up until we re-enabled spring for the rake binstub, which for some reason fixed the registration error, but then all the previously uncaught linter warnings started failing the static analysis job.
This is reproducible by running the linter with spring enabled:
ENABLE_SPRING=1 bin/spring rake lint:haml
We need to fix the problem with the registration when spring is not enabled.
Steps to reproduce
- Remove
-# haml-lint:disable InlineJavaScript
from some file to ensure there is an error to find - Run
ENABLE_SPRING=1 bin/spring rake lint:haml
Note: To make it faster to reproduce, you can hack it locally to run on only a single file:
lib/tasks/haml-lint.rake
:
HamlLint::RakeTask.new do |t|
t.files = %w[app/views/**/*/_authenticate.html.haml]
end
Possible fixes
Review changes in 27381e22 and see if any of them caused this.
Possible change the location or way we are requiring the linter file.