Skip to content

Commit

Permalink
Merge pull request #1131 from cloudflare/err
Browse files Browse the repository at this point in the history
Remove line number from the message
  • Loading branch information
prymitive authored Oct 2, 2024
2 parents e10fa37 + b7288ed commit 0a704f7
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cmd/pint/tests/0004_fail_invalid_yaml.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cmp stderr stderr.txt
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=WARN msg="Failed to parse file content" err="error at line 4: did not find expected key" path=rules/bad.yaml lines=1-7
rules/bad.yaml:4 Fatal: error at line 4: did not find expected key (yaml/parse)
rules/bad.yaml:4 Fatal: did not find expected key (yaml/parse)
4 |

rules/ok.yml:5 Fatal: Prometheus failed to parse the query with this PromQL error: unclosed left bracket. (promql/syntax)
Expand Down
2 changes: 1 addition & 1 deletion cmd/pint/tests/0010_syntax_check.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cmp stderr stderr.txt
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=WARN msg="Failed to parse file content" err="error at line 6: did not find expected '-' indicator" path=rules/1.yaml lines=1-12
rules/1.yaml:6 Fatal: error at line 6: did not find expected '-' indicator (yaml/parse)
rules/1.yaml:6 Fatal: did not find expected '-' indicator (yaml/parse)
6 |

level=INFO msg="Problems found" Fatal=1
Expand Down
2 changes: 1 addition & 1 deletion cmd/pint/tests/0067_relaxed.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cmp stderr stderr.txt
level=INFO msg="Loading configuration file" path=.pint.hcl
level=INFO msg="Finding all rules to check" paths=["rules"]
level=WARN msg="Failed to parse file content" err="error at line 2: top level field must be a groups key, got list" path=rules/strict.yml lines=1-4
rules/strict.yml:2 Fatal: error at line 2: top level field must be a groups key, got list (yaml/parse)
rules/strict.yml:2 Fatal: top level field must be a groups key, got list (yaml/parse)
2 | - alert: No Owner

level=INFO msg="Problems found" Fatal=1
Expand Down
2 changes: 1 addition & 1 deletion cmd/pint/tests/0074_strict_error.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cmp stderr stderr.txt
-- stderr.txt --
level=INFO msg="Finding all rules to check" paths=["rules"]
level=WARN msg="Failed to parse file content" err="error at line 2: invalid group key alert" path=rules/strict.yml lines=1-9
rules/strict.yml:2 Fatal: error at line 2: invalid group key alert (yaml/parse)
rules/strict.yml:2 Fatal: invalid group key alert (yaml/parse)
2 | - alert: Conntrack_Table_Almost_Full

level=INFO msg="Problems found" Fatal=1
Expand Down
2 changes: 1 addition & 1 deletion cmd/pint/tests/0078_repeated_group.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cmp stderr stderr.txt
-- stderr.txt --
level=INFO msg="Finding all rules to check" paths=["rules"]
level=WARN msg="Failed to parse file content" err="error at line 4: duplicated group name" path=rules/strict.yml lines=1-5
rules/strict.yml:4 Fatal: error at line 4: duplicated group name (yaml/parse)
rules/strict.yml:4 Fatal: duplicated group name (yaml/parse)
4 | - name: foo

level=INFO msg="Problems found" Fatal=1
Expand Down
2 changes: 1 addition & 1 deletion internal/checks/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func parseRuleError(rule parser.Rule, err error) Problem {
Last: parseErr.Line,
},
Reporter: yamlParseReporter,
Text: parseErr.Error(),
Text: parseErr.Err.Error(),
Details: `pint cannot read this file because YAML parser returned an error.
This usually means that you have an indention error or the file doesn't have the YAML structure required by Prometheus for [recording](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/) and [alerting](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/) rules.
If this file is a template that will be rendered into valid YAML then you can instruct pint to ignore some lines using comments, see [pint docs](https://cloudflare.github.io/pint/ignoring.html).
Expand Down

0 comments on commit 0a704f7

Please sign in to comment.