Repository navigation
[#412] Added the '--source' option and deprecated '--src' as its alias. - #417
Conversation
'--src' keeps working and prints a deprecation notice that is also recorded in the '--log' report. Passing both '--source' and '--src' fails, since the run cannot tell which one was meant. '--cleanup-pattern' keeps its singular name: a repeatable option names 1 occurrence, while '$cleanupPatterns' holds the collected list.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (1)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Team Run ID: 📒 Files selected for processing (5)
Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour. 📝 WalkthroughWalkthroughThe command now uses ChangesSource option
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Feature Merge Risk: ⚪ Minimal · up to No actionable issue remains for this change; it is mergeable after normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 4 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #417 +/- ##
==========================================
+ Coverage 97.70% 97.74% +0.04%
==========================================
Files 6 6
Lines 522 533 +11
==========================================
+ Hits 510 521 +11
Misses 12 12 ☔ View full report in Codecov by Harness. |
Closes #412
Summary
git-artifactnow takes the source repository directory through--source, and--srcbecomes a deprecated alias of it.ArtifactCommand::configure()insrc/Commands/ArtifactCommand.phpregisters both options, and the newresolveSourceDir()turns whichever one is set into the absolute path thatresolveOptions()stores in$sourceDir. Using--srcprints a deprecation notice, and passing--sourceand--srctogether stops the run with an error.--srcwas the only abbreviated name among the command's options (--branch,--message,--gitignore,--show-changesand the rest are spelled out), and--sourcedidn't exist. The inline check that picked the directory had a gap too:empty($options['src'])isTRUEfor the string0, so--src=0was dropped and the tool used the root directory instead of a directory named0.resolveSourceDir()counts a value as set when it's a non-empty string, so a directory named0now works through both options.After merge,
--source=<dir>packages<dir>, and--src=<dir>does the same and printsThe --src option is deprecated and will be removed in a future major release. Use --source instead.once at normal verbosity. The notice is also logged atnoticelevel, so it lands in the--logfile, and at-vand above the logger's console copy shows it again. This doesn't touch--cleanup-pattern, which keeps its singular name because each occurrence names 1 pattern, and it doesn't change the default: with neither option, the root directory is still the source.Before / After
What each invocation uses as the source directory.
<root>is the--rootvalue, or the current directory when--rootisn't set.Changes
Option
src/Commands/ArtifactCommand.php:configure()registers--sourcewith the description--srchad, and registers--srcas a separate option described asDeprecated alias of --source. Will be removed in a future major release.Symfony Console 7.4 has no long-option aliases and no hidden or deprecated flag for options, so--srcstays listed in--help.resolveOptions()calls the newresolveSourceDir()in place of the inlineempty($options['src'])check.resolveSourceDir(array $options): stringis aprotectedmethod that returns the absolute path of the source repository. A value counts as set only when it's a non-empty string, so--source=0and--src=0name a directory called0. With both options set it throws aRuntimeExceptionwithThe --source and --src options cannot be used together., even when the values match. With--srcit writesThe --src option is deprecated and will be removed in a future major release. Use --source instead.to the console as a<comment>line, logs the same text atnoticelevel and carries on with the--srcvalue. With neither option it returnsfsGetRootDir(), and otherwisefsGetAbsolutePath()of the value.Docs
README.md: the options table gains a--sourcerow, and the--srcrow now describes it as a deprecated alias of--source.Tests
tests/Unit/Commands/ArtifactCommandTest.php:testResolveSourceDir()runs 11 cases fromdataProviderResolveSourceDir(): no options, unset values, an emptysource, relative and absolutesourceandsrcvalues, asourceand asrcnamed0, and an emptysrcnext tosourceand the reverse. Each case asserts the resolved path, the exact console output and the exact logged messages, so the notice shows up only for a non-emptysrc.testResolveSourceDirConflict()covers 3 cases: different values, identical values and asrcnamed0. A newcreateSourceCommand()helper wires the root directory, an output buffer and a MonologTestHandler.tests/Functional/GeneralTest.php:testSrcDefault()is renamedtestSourceDefault().testSrcDeprecated()pushes an artifact through--srcand asserts the notice appears exactly once in the output.testSourceSrcConflict()asserts the failure message when both options are passed.testHelp()asserts that--source=SOURCEand the--srcdescription appear in--help.tests/Functional/FunctionalTestCase.php:runArtifactCommand()passes--sourceinstead of--src, so every functional test goes through the new option.Migration
--srcwith--source. The value and its meaning stay the same.--srckeeps working and prints a deprecation notice until a future major release removes it.--sourceand--srctogether fails, even when both carry the same value.--cleanup-patternkeeps its name. A repeatable option names 1 occurrence (like--excludeorgit log --author), while$cleanupPatternsholds the collected list.--srcin.vortex/tooling/src/vortex-deploy-artifactand pins git-artifact by version and SHA256 checksum, so it keeps running unchanged until it bumps to a release that includes this change. After the bump it should pass--source. ItsVORTEX_DEPLOY_ARTIFACT_CLEANUP_PATTERNvariable mirrors the singular--cleanup-patternand needs no change.Summary by CodeRabbit
--sourceas the preferred option for specifying the source repository directory. If omitted, the root directory is used.--srcoption remains available with a deprecation notice. Supplying nonempty values for both options now results in an error.--source, its default, and the deprecated--srcalias.