byrokrat / giroapp

Command line app for managing autogiro donations.
GNU General Public License v3.0
4 stars 2 forks source link

Validation in the XML subpackage #135

Closed hanneskod closed 5 years ago

hanneskod commented 6 years ago

Validation of XML content is missing. Add.

Could also be a good time to rethink validation. Currently its all one big class in Console\Helper\Validators.

Now it's not specifically a console thing, so it should have its own namespace. Validation or similar.

More strict typing with ValidatorInterface and move validator code to one class per ruleset?

hanneskod commented 6 years ago

The current solution is also not very suitable for static analysis. See for example:

https://scrutinizer-ci.com/g/byrokrat/giroapp/issues/master/files/src/Console/AddCommand.php?orderField=path&order=asc&honorSelectedPaths=0

hanneskod commented 6 years ago

As regards the console the Question helper already have support for both normalizing and validating.

https://symfony.com/doc/current/components/console/helpers/questionhelper.html

And as a related comment InputReader::readInput() should of course always return a string!

hanneskod commented 5 years ago

Also the clean validation exceptions are now being exposed to the user, but since they are not giroapp exceptions they are logged with a complete trace. Need a giroapp exception for this. (Also to use for testing in add.feature.) Fix at the same time..