HubSpot / prettier-maven-plugin

Apache License 2.0
116 stars 23 forks source link

Better handling for multiple globs #58

Closed jhaber closed 2 years ago

jhaber commented 2 years ago

Related to #50

Previously we would ignore status code 2 if it was caused by no matching files. However, since we're passing multiple globs, this isn't a reliably strategy. If any glob doesn't match, we'll get status code 2 and the "no matching files" message will print. However, that doesn't tell us anything about the other globs. They could have incorrectly formatted files, parsing errors, or potentially not even have a parser defined at all.

This PR makes it so that if prettier prints an error log, this will flip a boolean (unless it's a "no files matching" message). If prettier returns a non-0 status code and this boolean is flipped, then we'll fail the Maven plugin execution.

@magisyn

jhaber commented 2 years ago

The logic is here is getting pretty gnarly, and trying to ensure it works across versions of prettier is a pain (because output changes between versions, and we rely on parsing output). I need to get integration testing set up with maven-invoker soon