cjoudrey / graphql-schema-linter

Validate GraphQL schema definitions against a set of rules
MIT License
694 stars 62 forks source link

Add new formatter: compact #209

Closed MatthewRines closed 4 years ago

MatthewRines commented 4 years ago

This formatter outputs the filename inline with the error information. This allows the ouput to be easily parsed by command line utils such emacs, awk, etc.

cjoudrey commented 4 years ago

Good point! I'm leaning towards 'compact'.

On Wed., Jan. 22, 2020, 8:41 a.m. Matthew Rines, notifications@github.com wrote:

@MatthewRines commented on this pull request.

In src/formatters/inline_text_formatter.js https://github.com/cjoudrey/graphql-schema-linter/pull/209#discussion_r369564391 :

  • .join('\n');
  • return errorsText + '\n'; +}
  • +function generateErrorsForFile(file, errors) {

  • const formattedErrors = errors.map(error => {
  • const location = error.locations[0];
  • return {
  • location: ${file}:${location.line}:${location.column},
  • message: error.message,
  • rule: ${error.ruleName},
  • };
  • });
  • const errorsText = columnify(formattedErrors, {

Yes its not necessary to have the nice columns. I'm also thinking about the name and I'm not crazy about it, what do you think about 'parsable' or 'compact' instead?

— You are receiving this because your review was requested. Reply to this email directly, view it on GitHub https://github.com/cjoudrey/graphql-schema-linter/pull/209?email_source=notifications&email_token=AAC6B5V3DIWTCP2QVISN3MDQ7BEI7A5CNFSM4KJLLDLKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCSUJPEA#discussion_r369564391, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAC6B5VWHYN6DIJQHIUH7ZLQ7BEI7ANCNFSM4KJLLDLA .