Skip to content

Commit 2dc17f0

Browse files
Add parameter validation for registry and skip_push
- Validate registry parameter accepts only: 'verdaccio', 'npm', or empty string - Validate skip_push parameter accepts only: 'skip_push' or empty string - Raise ArgumentError with clear message for invalid values - Prevents silent failures from typos or incorrect usage Examples of errors: rake release[16.2.0,false,foo] → ArgumentError: Invalid registry value 'foo' rake release[16.2.0,false,npm,skip] → ArgumentError: Invalid skip_push value 'skip' 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 604b823 commit 2dc17f0

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

rakelib/release.rake

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,23 @@ task :release, %i[gem_version dry_run registry skip_push] do |_t, args|
4545
args_hash = args.to_hash
4646

4747
is_dry_run = ReactOnRails::Utils.object_to_boolean(args_hash[:dry_run])
48-
use_verdaccio = args_hash.fetch(:registry, "") == "verdaccio"
49-
skip_push = args_hash.fetch(:skip_push, "") == "skip_push"
48+
49+
# Validate registry parameter
50+
registry_value = args_hash.fetch(:registry, "")
51+
unless registry_value.empty? || registry_value == "verdaccio" || registry_value == "npm"
52+
raise ArgumentError,
53+
"Invalid registry value '#{registry_value}'. Valid values are: 'verdaccio', 'npm', or empty string"
54+
end
55+
56+
use_verdaccio = registry_value == "verdaccio"
57+
58+
# Validate skip_push parameter
59+
skip_push_value = args_hash.fetch(:skip_push, "")
60+
unless skip_push_value.empty? || skip_push_value == "skip_push"
61+
raise ArgumentError, "Invalid skip_push value '#{skip_push_value}'. Valid values are: 'skip_push' or empty string"
62+
end
63+
64+
skip_push = skip_push_value == "skip_push"
5065

5166
gem_version = args_hash.fetch(:gem_version, "")
5267

0 commit comments

Comments
 (0)