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

Error message when pattern name contains invalid characters is confusing #134

Closed
ivangreene opened this issue Apr 2, 2024 · 1 comment · Fixed by #151
Closed

Error message when pattern name contains invalid characters is confusing #134

ivangreene opened this issue Apr 2, 2024 · 1 comment · Fixed by #151
Labels
bug Something isn't working

Comments

@ivangreene
Copy link

The error message that comes out when a pattern name contains a - is confusing and not helpful

Reproducer:
grit.yaml

patterns:
  - name: use-winston
    level: error
    body: |
      `console.log($msg)` => `winston.log($msg)` where {
        $msg <: not within or { `it($_, $_)`, `test($_, $_)`, `describe($_, $_)` }
      }

Run:

$ grit apply use-winston
Your working tree currently has untracked changes and Grit will rewrite files in place. Do you want to proceed? yes
ERROR (code: 299) - Pattern syntax error at 1:1. If you hit this error while running grit apply on a pattern from the Grit standard library, try running grit init. If you are running a custom pattern, check out the docs at https://docs.grit.io/ for help with writing patterns.
@morgante morgante added the bug Something isn't working label Apr 3, 2024
@morgante
Copy link
Contributor

morgante commented Apr 3, 2024

Yes, we can definitely improve this. Something like this would be much better:

Pattern use-winston at 2:1 contains invalid character "-".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants