zen_apropos 0.2.0 → 0.3.0

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: 63464f8005004d28dee7b44cd5851420b6d4e1ca757639e1b0576f0d59ec772b
4
- data.tar.gz: 5626472b4d781eb408335060267ed96c1a5de249301ab5e007f10c87f2adfe02
3
+ metadata.gz: 5896b8d2d49ec9bde7aec69b620fb5ea883bac8bb635576e1f42c78b352fa9ea
4
+ data.tar.gz: 5899c5f0fbe3c2ad09069e388fa7734cc1ee7de8632f8336ef47ecec11ca1af2
5
5
  SHA512:
6
- metadata.gz: 884a57e12504d4df0f7e414c950ce50d28f51c6f025c5cca99f02ac1ad80157498ebd3aad50db029efb9bfd7bec9848e063308555070860ca47f5454e008cd36
7
- data.tar.gz: 0c2a616987e6b4fbe517d9e59c9fa8b025a8688c0ffa8939a47e7b15185cc45d5f5e9cb545601646e9fe61811e8112fe2fca3a4603d20e7038c6ecb38aaf7542
6
+ metadata.gz: b2f803ed1e87165e09e03c172acbb1b83455db5f3c5b9d2dec7f29c1b82427654289fde7eb0726ffde952f389e7482c927b4b88cae96fe725033ca498b265534
7
+ data.tar.gz: f66cb715e43a450a195aedd94052b3d08a529524774c5e59557d1e459c613c8e77aadefa1fc4d48185131bed5f33ceffac467ae8c84752c12caecff5fc63cd49
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Bug Fixes
6
+
7
+ - **Fixed `--changed-only` diffing against wrong files in CI.** The linter hardcoded `HEAD~1` as the diff base, which in Jenkins PreBuildMerge environments resolved to the PR branch tip — causing the linter to check files from master instead of PR changes.
8
+
9
+ ### New Features
10
+
11
+ - **`--base REF` flag for the linter.** Allows specifying the git ref to diff against (e.g., `--base origin/master` for CI, `--base --staged` for pre-commit hooks). Defaults to `HEAD~1` for backward compatibility.
12
+
3
13
  ## 0.2.0
4
14
 
5
15
  ### Breaking Changes
data/bin/zen_apropos CHANGED
@@ -77,6 +77,14 @@ def run_search(args)
77
77
  end
78
78
  end
79
79
 
80
+ def extract_base!(args)
81
+ index = args.index('--base')
82
+ return nil unless index
83
+
84
+ args.delete_at(index) # remove --base
85
+ args.delete_at(index) # remove the value
86
+ end
87
+
80
88
  def run_lint(args)
81
89
  if args.include?('--help') || args.include?('-h')
82
90
  tag = ZenApropos.configuration.tag
@@ -89,6 +97,7 @@ def run_lint(args)
89
97
  Usage:
90
98
  zen_apropos lint # Check all rake files
91
99
  zen_apropos lint --changed-only # Check only files changed in current branch
100
+ zen_apropos lint --base REF # Use REF as the base for diff (default: HEAD~1)
92
101
  zen_apropos lint --tag myapp # Use a custom annotation tag
93
102
 
94
103
  Exit codes:
@@ -100,8 +109,9 @@ def run_lint(args)
100
109
  end
101
110
 
102
111
  apply_tag!(args)
112
+ base = extract_base!(args)
103
113
  changed_only = args.include?('--changed-only')
104
- exit ZenApropos::Linter.new(changed_only: changed_only).run
114
+ exit ZenApropos::Linter.new(changed_only: changed_only, base: base).run
105
115
  end
106
116
 
107
117
  def run_init(args)
@@ -7,8 +7,9 @@ module ZenApropos
7
7
  class Linter
8
8
  attr_reader :warnings
9
9
 
10
- def initialize(changed_only: false)
10
+ def initialize(changed_only: false, base: nil)
11
11
  @changed_only = changed_only
12
+ @base = base
12
13
  @warnings = []
13
14
  end
14
15
 
@@ -27,7 +28,8 @@ module ZenApropos
27
28
 
28
29
  def rake_files
29
30
  if @changed_only
30
- changed = `git diff --name-only --diff-filter=ACMR HEAD~1 2>/dev/null`.strip.split("\n")
31
+ reference = @base || 'HEAD~1'
32
+ changed = `git diff --name-only --diff-filter=ACMR #{reference} 2>/dev/null`.strip.split("\n")
31
33
  changed.select { |f| f.end_with?('.rake') && File.exist?(f) }
32
34
  else
33
35
  patterns = ZenApropos.configuration.glob_patterns || Sources::RakeSource::DEFAULT_PATHS
@@ -1,3 +1,3 @@
1
1
  module ZenApropos
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zen_apropos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ahmad Keewan
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2026-02-25 00:00:00.000000000 Z
12
+ date: 2026-03-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest