[go: up one dir, main page]

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

Metadata: reported location is wrong when error encountered in first attribute #6587

Closed
anderseknert opened this issue Feb 12, 2024 · 1 comment · Fixed by #6807
Closed

Comments

@anderseknert
Copy link
Member
# METADATA
# description: `foo` bars
# title: foo
package foo

Backticks are apparently not allowed as the first character of an unquoted YAML string, but that wasn't obvious to me as the error reported is:

{
  "errors": [
    {
      "message": "yaml: found character that cannot start any token",
      "code": "rego_parse_error",
      "location": {
        "file": "p.rego",
        "row": 1,
        "col": 1
      },
      "details": {
        "line": "# METADATA",
        "idx": 0
      }
    }
  ]
}

However, if we move the location of the error to a later line, the location is reported correctly:

# METADATA
# title: foo
# description: `foo` bars
package foo
{
  "errors": [
    {
      "message": "yaml: line 2: found character that cannot start any token",
      "code": "rego_parse_error",
      "location": {
        "file": "p.rego",
        "row": 3,
        "col": 1
      },
      "details": {
        "line": "# description: `foo` bars",
        "idx": 0
      }
    }
  ]
}
Copy link
stale bot commented Mar 14, 2024

This issue has been automatically marked as inactive because it has not had any activity in the last 30 days. Although currently inactive, the issue could still be considered and actively worked on in the future. More details about the use-case this issue attempts to address, the value provided by completing it or possible solutions to resolve it would help to prioritize the issue.

@stale stale bot added the inactive label Mar 14, 2024
anderseknert added a commit to anderseknert/opa that referenced this issue Jun 10, 2024
Fixes open-policy-agent#6587

Signed-off-by: Anders Eknert <anders@styra.com>
anderseknert added a commit to anderseknert/opa that referenced this issue Jun 11, 2024
Fixes open-policy-agent#6587

Signed-off-by: Anders Eknert <anders@styra.com>
anderseknert added a commit to anderseknert/opa that referenced this issue Jun 11, 2024
Fixes open-policy-agent#6587

Signed-off-by: Anders Eknert <anders@styra.com>
anderseknert added a commit that referenced this issue Jun 11, 2024
Fixes #6587

Signed-off-by: Anders Eknert <anders@styra.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant