2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-03-03 22:05:52 +08:00
discourse/bin/rake
Sam bb8ed7d6f9
DEV: fix linter and linting config (#36815)
This amends lefthook to use the more reliable doublestar globber:
https://github.com/evilmartians/lefthook/blob/master/docs/mdbook/configuration/glob_matcher.md
it also cleans up the config so we can properly run and filter.

Notably ember linter explodes if you pass it files your are not meant to
lint.

The current fix has bin/lint read the config from lefthook and filter
out the files that need no linting. `--file` overrides the glob so we
can not pass in files unfiltered.

This also simplifies some of the linters internals for easier
maintenance
2025-12-22 07:23:19 +11:00

13 lines
425 B
Ruby
Executable file

#!/usr/bin/env ruby
# frozen_string_literal: true
if ENV["RAILS_ENV"] == "test" && ENV["LOAD_PLUGINS"].nil?
if ARGV.include?("db:migrate") || ARGV.include?("parallel:migrate")
STDERR.puts "You are attempting to run migrations in your test environment and are not loading plugins, setting LOAD_PLUGINS to 1"
ENV["LOAD_PLUGINS"] = "1"
end
end
require_relative "../config/boot"
require "rake"
Rake.application.run