Class: RailsLint
- Inherits:
-
Object
- Object
- RailsLint
- Defined in:
- lib/rails-lint/rails_lint.rb
Instance Method Summary collapse
Instance Method Details
#lint ⇒ Object
2 3 4 5 |
# File 'lib/rails-lint/rails_lint.rb', line 2 def lint lint_ruby lint_erb end |
#lint_erb(autocorrect: false) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rails-lint/rails_lint.rb', line 17 def lint_erb(autocorrect: false) require "erb_lint/cli" cli = ERBLint::CLI.new spec = Gem::Specification.find_by_name("rails-lint") puts "Linting ERB templates..." args = ["--lint-all", "--enable-all-linters", "--allow-no-files", "--config=#{File.(".erb-lint.yml", spec.gem_dir)}"] args << "--autocorrect" if autocorrect cli.run(args) end |
#lint_ruby(autocorrect: false) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/rails-lint/rails_lint.rb', line 7 def lint_ruby(autocorrect: false) require "rubocop" cli = RuboCop::CLI.new puts "Linting Ruby..." spec = Gem::Specification.find_by_name("rails-lint") args = ["--config=#{File.(".rubocop.yml", spec.gem_dir)}", "--display-cop-names", "--force-exclusion"] args << "--autocorrect-all" if autocorrect cli.run(args) end |