cyclonedx-php-composer icon indicating copy to clipboard operation
cyclonedx-php-composer copied to clipboard

configuration file

Open jkowalleck opened this issue 3 years ago • 1 comments

benefit: have the config in a file, so no CLI parameters are needed

parameter defaults are read from the config-file, and may override system defaults. parameters can still be overridden via CLI parameters

implementation details: use extra section of the composer file. see https://getcomposer.org/doc/04-schema.md#extra


acc / crit

  • [ ] config overrides system defaults (therefore config file settings = presets)
  • [ ] CLI params override any defaults/presets
  • [ ] parameter type checks are (still) in place
  • [ ] parameter plausibility checks are still in place
  • [ ] config possibility is documented
    (+ docs have hint, that this config can be used with the gh-action -- see https://github.com/CycloneDX/gh-php-composer-generate-sbom/issues/1)

jkowalleck avatar Oct 13 '21 12:10 jkowalleck

implementation idea:

  • Options propertie are the defaults
  • new method Options::setFromPackage() that accpts a RootPackage - settings are read from the extras
  • existing method Options::setFromInput(InputInterface $input) only sets existing values/options by checking via $input->hasArgument()
  • add a new method Options::vlidate() if needed ...

alternative: Options::setFrom...() become factory methods, that each create new objects ....

jkowalleck avatar Oct 15 '21 11:10 jkowalleck