michaelherold / codeclimate-haml-lint Goto Github PK
View Code? Open in Web Editor NEWLint your Haml files in the Code Climate Platform
License: MIT License
Lint your Haml files in the Code Climate Platform
License: MIT License
I got an email from Code Climate with an alarming title: 1 new severe issue found
So I opened it:
Inconsistent indentation: 2 spaces used for indentation
๐
I see the current mapping is:
HAML_LINT_TO_CODE_CLIMATE = {
error: "critical",
warning: "normal",
}
As haml-lint doesn't deal with security issues, I think it's difficult to justify anything being at the "critical" or "blocker" level. Even "major" seems too strong.
How about this:
HAML_LINT_TO_CODE_CLIMATE = {
error: "minor",
warning: "info",
}
(Sidenote: Is "normal" valid? It's not listed in the spec)
% codeclimate analyze -e haml_lint --dev
Starting analysis
Running haml_lint: Done!
error: (CC::Analyzer::Engine::EngineFailure) engine haml_lint:stable failed with status 1 and stderr
/usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:in `require': cannot load such file -- rubocop-rspec (LoadError)
from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:in `require'
from /usr/local/bundle/gems/rubocop-0.47.1/lib/rubocop/config_loader_resolver.rb:15:in `block in resolve_requires'
from /usr/local/bundle/gems/rubocop-0.47.1/lib/rubocop/config_loader_resolver.rb:11:in `each'
from /usr/local/bundle/gems/rubocop-0.47.1/lib/rubocop/config_loader_resolver.rb:11:in `resolve_requires'
from /usr/local/bundle/gems/rubocop-0.47.1/lib/rubocop/config_loader.rb:37:in `load_file'
from /usr/local/bundle/gems/rubocop-0.47.1/lib/rubocop/config_loader.rb:107:in `configuration_from_file'
from /usr/local/bundle/gems/rubocop-0.47.1/lib/rubocop/config_store.rb:44:in `for'
from /usr/local/bundle/gems/rubocop-0.47.1/lib/rubocop/runner.rb:163:in `cached_run?'
from /usr/local/bundle/gems/rubocop-0.47.1/lib/rubocop/runner.rb:59:in `ensure in inspect_files'
from /usr/local/bundle/gems/rubocop-0.47.1/lib/rubocop/runner.rb:61:in `inspect_files'
from /usr/local/bundle/gems/rubocop-0.47.1/lib/rubocop/runner.rb:36:in `run'
from /usr/local/bundle/gems/rubocop-0.47.1/lib/rubocop/cli.rb:72:in `execute_runner'
from /usr/local/bundle/gems/rubocop-0.47.1/lib/rubocop/cli.rb:27:in `run'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/linter/rubocop.rb:42:in `lint_file'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/linter/rubocop.rb:32:in `block in find_lints'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/linter/rubocop.rb:81:in `with_ruby_from_stdin'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/linter/rubocop.rb:31:in `find_lints'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/linter/rubocop.rb:15:in `visit_root'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/haml_visitor.rb:40:in `safe_send'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/haml_visitor.rb:19:in `visit'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/linter.rb:28:in `run'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/runner.rb:84:in `block in collect_lints'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/runner.rb:83:in `map'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/runner.rb:83:in `collect_lints'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/runner.rb:119:in `process_file'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/runner.rb:108:in `block in process_files'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/runner.rb:107:in `each'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/runner.rb:107:in `process_files'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/runner.rb:132:in `report'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/runner.rb:23:in `run'
from /usr/src/app/lib/cc/engine/source_file.rb:64:in `process'
from /usr/src/app/lib/cc/engine/haml_lint.rb:54:in `block in run'
from /usr/src/app/lib/cc/engine/haml_lint.rb:48:in `run'
from /usr/src/app/bin/codeclimate-haml_lint:10:in `<main>'
My .rubocop.yml
has this on the first line:
require: rubocop-rspec
In RuboCop 0.68, the performance cops were moved out to a separate gem, so to use them I have added this to my RuboCop config:
require: rubocop-performance
This fails because the rubocop-performance gem is not part of the engine.
I recently discovered Mry, a tool that migrates your Rubocop config between versions. I noticed that the Rubocop engine uses a freedom patch to integrate Mry with Rubocop's configuration runner.
I think it would be best to do the same in this engine since there is so much churn in Rubocop's cop configuration.
Thanks for the fix in #1. Re-running, I ran into this:
/usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/linter/multiline_pipe.rb:42:in `check': undefined method `match' for nil:NilClass (NoMethodError)
Did you mean? catch
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/linter/multiline_pipe.rb:20:in `visit_silent_script'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/haml_visitor.rb:40:in `safe_send'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/haml_visitor.rb:19:in `visit'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/haml_visitor.rb:30:in `block in visit_children'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/haml_visitor.rb:30:in `each'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/haml_visitor.rb:30:in `visit_children'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/haml_visitor.rb:24:in `visit'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/linter.rb:28:in `run'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/runner.rb:84:in `block in collect_lints'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/runner.rb:83:in `map'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/runner.rb:83:in `collect_lints'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/runner.rb:119:in `process_file'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/runner.rb:108:in `block in process_files'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/runner.rb:107:in `each'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/runner.rb:107:in `process_files'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/runner.rb:132:in `report'
from /usr/local/bundle/gems/haml_lint-0.23.1/lib/haml_lint/runner.rb:23:in `run'
from /usr/src/app/lib/cc/engine/source_file.rb:64:in `process'
from /usr/src/app/lib/cc/engine/haml_lint.rb:54:in `block in run'
from /usr/src/app/lib/cc/engine/haml_lint.rb:48:in `run'
from /usr/src/app/bin/codeclimate-haml_lint:10:in `<main>'
Let me know there any other information I can provide which might help.
I get an error when TargetRubyVersion
is set to 2.5 in the Rubocop config.
In .rubocop.yml
:
AllCops:
TargetRubyVersion: 2.5
Output from engine run in debug mode:
D, [2018-06-29T19:05:57.382790 #1] DEBUG -- : engine stderr: Error: Unknown Ruby version 2.5 found in `TargetRubyVersion` parameter (in .rubocop.yml).
D, [2018-06-29T19:05:57.382922 #1] DEBUG -- : engine stderr: Supported versions: 2.1, 2.2, 2.3, 2.4
I assume this has something to do with the hard-coded Ruby version in the Dockerfile. Would it be possible to upgrade or make this configurable?
Thanks for your work on this engine! It will be very useful to our team once we are able to run it on our project.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.