Repository navigation
Add ability to setup basepath via --basepath / -d in CLI - #496
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
@gsteel the new feature ready :), tested and verified on
I will merge it tomorrow and then create StructArmed 0.19.0 release, just let me know if there is something you concern ;) /cc @froschdesign |
|
I think it's more common to consider this a "Working Directory", i.e. where you do the work. A common switch is So, if I run On the other hand, if I cd tools/structarmed
vendor/bin/structarmed -d ../../to do the same thing, i.e. detect config in either CWD, or Working Dir and composer.json in working dir. Hope I'm making sense! |
|
Nice! Thanks @samsonasik - I should have read the initial patch more thoroughly! |
|
Thank you @gsteel @froschdesign for the review. It just merged and released 0.19.0 for it https://github.com/boundwize/structarmed/releases/tag/0.19.0 |


Per @gsteel at
This PR adds ability to setup base path via
--basepathin cli, eg:that mean, if we have project directory, eg:
src/ test composer.json ├── tools │ ├── structarmed │ │ ├── composer.json │ │ ├── composer.lock │ │ ├── structarmed.php │ │ └── vendorand then, I want to run
cd tools/structarmed vendor/bin/structarmed analyze --basepath=../../eg, when the rule is instanceof ComposerJsonRuleInterface, it will scan
../../composer.jsonthen by definiton of autoload/autoload-dev, it can read defined../../composer.jsondefinition, eg:srcunder autoload, and test under autoload in../../composer.jsonThis also ensure, eg layer:
that
src/ConfigProvider.phpis../../src/ConfigProvideras new basepath is../../per cli command.