Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add --format flag and *ErrorsFormatter classes #482

Merged
merged 2 commits into from
Feb 1, 2024

Conversation

NiumXp
Copy link
Contributor

@NiumXp NiumXp commented Jan 24, 2024

I'm adding a rich way of handling errors to format it as "short" (currently), "verbose" (with highlights and hints, like GCC does on errors/warnings), or others like JSON (#448).

Example of errors in JSON format:

norminette test.c --format=json
{
  "files": [
    {
      "path": "/home/nium/OpenSource/norminette/test.c",
      "status": "Error",
      "errors": [
        {
          "name": "INVALID_HEADER",
          "text": "Missing or invalid 42 header",
          "level": "Error",
          "highlights": [{"lineno": 1, "column": 1, "length": null, "hint": null}]
        },
        {
          "name": "SPACE_AFTER_KW",
          "text": "Missing space after keyword",
          "level": "Error",
          "highlights": [{"lineno": 3, "column": 5, "length": null, "hint": null}]
        }
      ]
    }
  ]
}

Some considerations (just for now):

  • length and hint is always null
  • highlights always contains just one element

@matthieu42Network matthieu42Network merged commit beaffaf into 42School:master Feb 1, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants