summaryrefslogtreecommitdiff
path: root/lib/tasks/lint.rake
blob: d29956c026376e0432b20aeb6b5394f8d225dc1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# frozen_string_literal: true

namespace :lint do
  begin
    require 'rubocop/rake_task'
    require 'bundler/audit/task'

    RuboCop::RakeTask.new
    Bundler::Audit::Task.new
  rescue LoadError => error
    puts error.message
  end

  desc "run the brakeman vulnerability scanner"
  task :brakeman do
    require 'brakeman'
    Brakeman.run(
      app_path: Rails.root,
      print_report: true,
      pager: false,
      config_file: Rails.root.join("config", "brakeman"),
    )
  end

  desc "run uilinters"
  task(:ui) { sh 'yarn lint' }

  desc "run erb linter"
  task(:erb) { sh 'erblint --lint-all --enable-all-linters' }

  desc "Run linters to check the quality of the code."
  task all: ['bundle:audit', :brakeman, :erb, :rubocop, :ui]
end