rails-quality-assurance 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rails_quality_assurance/version.rb +1 -1
- data/lib/tasks/quality_assurance.rake +21 -4
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 963c9015d199d8e42feb0100e909e00c34372522bacf15555bb0ca2e0cbb94ff
|
|
4
|
+
data.tar.gz: 5f16275a84242d955a36f7d46a90b8a0e994cf8ddbf295f0bc28702605087972
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 13a82c4be1539e59dfb28b22797ffbcb196036cb16e1b1b2109753ed51a178a8ea890657a0acf61e18f4ebce124de759efca0e3584ffa312e39103da12217b4a
|
|
7
|
+
data.tar.gz: 5af22e9d215154c17479476f30857a486fb70e77dfe3bf58e0c61a987f3d6d2b6dc35bf0ac1b39702011419b03d8ca6d1213f36effb5aaa708d0c97003a76720
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'json'
|
|
3
4
|
require 'rails_quality_assurance'
|
|
4
5
|
|
|
6
|
+
def npm_script?(name)
|
|
7
|
+
return false unless File.exist?('package.json')
|
|
8
|
+
|
|
9
|
+
JSON.parse(File.read('package.json')).fetch('scripts', {}).key?(name)
|
|
10
|
+
rescue JSON::ParserError
|
|
11
|
+
false
|
|
12
|
+
end
|
|
13
|
+
|
|
5
14
|
namespace :qa do
|
|
6
15
|
desc 'Run all quality assurance checks (RuboCop, Reek, Flay, Brakeman, bundler-audit)'
|
|
7
16
|
task lint: %w[qa:rubocop qa:reek qa:flay qa:brakeman qa:audit]
|
|
@@ -38,14 +47,22 @@ namespace :qa do
|
|
|
38
47
|
namespace :lint do
|
|
39
48
|
desc 'Run BiomeJS on JS/TS/JSON'
|
|
40
49
|
task biome: :environment do
|
|
41
|
-
|
|
42
|
-
|
|
50
|
+
if npm_script?('biome')
|
|
51
|
+
sh 'npm run biome'
|
|
52
|
+
else
|
|
53
|
+
config = File.exist?('biome.json') ? '' : "--config-path #{RailsQualityAssurance.biome_config_path}"
|
|
54
|
+
sh "npx --no-install @biomejs/biome check #{config}"
|
|
55
|
+
end
|
|
43
56
|
end
|
|
44
57
|
|
|
45
58
|
desc 'Run Stylelint on CSS'
|
|
46
59
|
task stylelint: :environment do
|
|
47
|
-
|
|
48
|
-
|
|
60
|
+
if npm_script?('stylelint')
|
|
61
|
+
sh 'npm run stylelint'
|
|
62
|
+
else
|
|
63
|
+
config = File.exist?('.stylelintrc.json') ? '' : "--config #{RailsQualityAssurance.stylelint_config_path}"
|
|
64
|
+
sh "npx --no-install stylelint #{config} \"**/*.css\""
|
|
65
|
+
end
|
|
49
66
|
end
|
|
50
67
|
end
|
|
51
68
|
|