rails-quality-assurance 1.7.0 → 1.7.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f52f428147c9b6186b1d4735c142d16d07900a4eb7cf1097aff884e7d4b4e49e
4
- data.tar.gz: 0d62a47056131d8265e883a7a04d94fdaa24fc4f0cd79b46c591831edd2504dc
3
+ metadata.gz: 782a8a0b2a96c1f8f6ca996bb3cc430fd61b7e608ae66048381c7f21061911a2
4
+ data.tar.gz: 9534e6865a81f390402c3a66733de5f1519886e2a37d21a4ee91928c370b46d2
5
5
  SHA512:
6
- metadata.gz: dea1ee0b6979d55237692d7a12bd93d65045fe4c975e4fba754e7cdd134c1d21647e41ce6618c5f76311798507133c5ed71b7b4db97b5300df73662f7d7aedad
7
- data.tar.gz: 6dccf18a6b969790e5939859616e5aedc1b69be0012b26b103bf98a5c15a1e24333e84a6c0f871575d5968948f0f9a0e54f13e39a57418fb19ce6ec08f43b584
6
+ metadata.gz: 5b55b2d169882320d118318d5e119967763e4e0d9c2fa64712e75a8fa414b12570445b313e413206467bb2e1da4c53bf6b36a356ff084a064528a72befea382e
7
+ data.tar.gz: 32a0e9207e7cfd4422080498269269984184733250a04a82a2c69df75f859155efbe532b52f068e743986e989871b10f5607acdd42a06049c5e58a65d8912f38
data/CHANGELOG.md CHANGED
@@ -5,6 +5,26 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.7.2] - 2026-10-03
9
+
10
+ ### Changed
11
+
12
+ - `qa:audit:npm` audits production dependencies only: `npm audit --omit=dev`,
13
+ `yarn audit --groups dependencies`, and `pnpm audit --prod`. Dev-only tooling
14
+ such as markdownlint and stylelint pulls transitive advisories that never
15
+ ship, and some have no available fix (`braces`), so the gate failed CI and
16
+ blocked deploys on vulnerabilities no user could reach. Apps that need dev
17
+ dependencies audited can run the audit command directly.
18
+
19
+ ## [1.7.1] - 2026-10-01
20
+
21
+ ### Fixed
22
+
23
+ - The generated pre-commit hook resolves Reek per project shape: `bin/rails
24
+ qa:reek` for apps, `bundle exec rake -f spec/dummy/Rakefile qa:reek` for gems
25
+ and engines with a dummy app, and `bundle exec reek` for a plain gem with a
26
+ `.reek.yml`. Projects without any of these skip Reek instead of failing.
27
+
8
28
  ## [1.7.0] - 2026-10-01
9
29
 
10
30
  ### Added
data/README.md CHANGED
@@ -24,7 +24,10 @@ Opinionated quality assurance kit for Ruby on Rails applications.
24
24
  otherwise.
25
25
  - **JavaScript Audit**: Vulnerability scanner for npm packages. Resolves the
26
26
  command from the lockfile (`package-lock.json`, `yarn.lock`, or
27
- `pnpm-lock.yaml`) and fails on **high and critical** advisories.
27
+ `pnpm-lock.yaml`) and fails on **high and critical** advisories in
28
+ **production dependencies only**. Dev-only tooling (linters, test runners)
29
+ never ships, and its transitive advisories, some with no available fix, would
30
+ otherwise block CI and deploys.
28
31
 
29
32
  ### 3. Testing & Coverage
30
33
 
@@ -227,6 +230,10 @@ generator aborts instead of installing a hook that would never run.
227
230
  Each check runs only when relevant files are staged (Ruby files for RuboCop and
228
231
  Reek, spec files for RSpec). Bypass a commit with `git commit --no-verify`.
229
232
 
233
+ Reek is resolved per project shape: `bin/rails qa:reek` in an app,
234
+ `bundle exec rake -f spec/dummy/Rakefile qa:reek` in a gem or engine with a
235
+ dummy app, and `bundle exec reek` in a plain gem with a `.reek.yml`.
236
+
230
237
  ### 6. Rake Tasks (Optional)
231
238
 
232
239
  The gem also provides tasks if you prefer `rake`:
@@ -235,7 +242,7 @@ The gem also provides tasks if you prefer `rake`:
235
242
  bin/rails qa:lint # Runs RuboCop, Reek, Flay, Brakeman, bundler-audit, importmap-audit, npm-audit
236
243
  bin/rails qa:audit # Runs bundler-audit
237
244
  bin/rails qa:audit:importmap # Runs the importmap audit when config/importmap.rb exists
238
- bin/rails qa:audit:npm # Runs npm/yarn/pnpm audit for the lockfile in use, failing on high and critical
245
+ bin/rails qa:audit:npm # Runs npm/yarn/pnpm audit on production dependencies, failing on high and critical
239
246
  bin/rails qa:frontend # Runs Biome and Stylelint
240
247
  bin/rails spec:parallel # Runs RSpec in parallel with system specs isolated
241
248
  ```
@@ -14,6 +14,7 @@ module RailsQualityAssurance
14
14
  def install_hook
15
15
  guard_hooks_path
16
16
 
17
+ @reek_command = reek_command
17
18
  template 'pre_commit.erb', '.githooks/pre-commit'
18
19
  chmod '.githooks/pre-commit', 0o755
19
20
  install_launcher
@@ -21,6 +22,22 @@ module RailsQualityAssurance
21
22
 
22
23
  private
23
24
 
25
+ # Reek runs through the gem's Rake task. Apps expose it via `bin/rails`;
26
+ # gems and engines expose it through their dummy app's Rakefile. A plain
27
+ # gem with its own `.reek.yml` falls back to bare Reek; otherwise the
28
+ # check is skipped rather than failing on a missing task.
29
+ def reek_command
30
+ return 'bin/rails qa:reek' if exist?('bin/rails')
31
+ return 'bundle exec rake -f spec/dummy/Rakefile qa:reek' if exist?('spec/dummy/Rakefile')
32
+ return 'bundle exec reek' if exist?('.reek.yml')
33
+
34
+ nil
35
+ end
36
+
37
+ def exist?(path)
38
+ File.exist?(File.join(destination_root, path))
39
+ end
40
+
24
41
  # Git ignores `.git/hooks` entirely when `core.hooksPath` is set, so the
25
42
  # launcher would never run. Fail loudly instead of installing a no-op.
26
43
  def guard_hooks_path
@@ -23,11 +23,13 @@ if [ -n "$(staged '*.rb' '*.rake' '*.gemspec' 'Gemfile' 'Rakefile' 'config.ru' '
23
23
  if ! bundle exec rubocop; then
24
24
  fail 'RuboCop offenses detected' 'Fix the offenses before committing, or run: bundle exec rubocop -A'
25
25
  fi
26
+ <%- if @reek_command -%>
26
27
 
27
28
  echo 'Checking Reek...'
28
- if ! bin/rails qa:reek; then
29
+ if ! <%= @reek_command %>; then
29
30
  fail 'Reek code smells detected' 'Fix the code smells before committing.'
30
31
  fi
32
+ <%- end -%>
31
33
  fi
32
34
 
33
35
  if [ -n "$(staged 'spec/**/*_spec.rb' 'spec/**/*.rb')" ]; then
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsQualityAssurance
4
- VERSION = '1.7.0'
4
+ VERSION = '1.7.2'
5
5
  end
@@ -37,16 +37,19 @@ module RailsQualityAssurance
37
37
  end
38
38
 
39
39
  # Resolves the JavaScript security audit command from the lockfile in use,
40
- # gating on high and critical advisories. Returns nil when none is present.
40
+ # gating on high and critical advisories. Audits production dependencies only:
41
+ # dev tooling carries advisories that never ship, and blocking a deploy on
42
+ # them is noise. Returns nil when the app has no lockfile.
41
43
  def self.npm_audit_command
42
44
  if File.exist?('package-lock.json')
43
- 'npm audit --audit-level=high'
45
+ 'npm audit --audit-level=high --omit=dev'
44
46
  elsif File.exist?('yarn.lock')
45
47
  # Yarn 1 ignores --level for its exit code and returns a severity bitmask
46
48
  # (info 1, low 2, moderate 4, high 8, critical 16), so mask high|critical.
47
- 'yarn audit; status=$?; [ $((status & 24)) -eq 0 ]'
49
+ # --groups dependencies limits the audit to production dependencies.
50
+ 'yarn audit --groups dependencies; status=$?; [ $((status & 24)) -eq 0 ]'
48
51
  elsif File.exist?('pnpm-lock.yaml')
49
- 'pnpm audit --audit-level high'
52
+ 'pnpm audit --audit-level high --prod'
50
53
  end
51
54
  end
52
55
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-quality-assurance
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mauricio Zaffari