Skip to content

Commit

Permalink
fix error message when invalid escape is found in glob
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed May 14, 2024
1 parent ff2558b commit 235dfcd
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ test.yaml:3:5: unexpected key "branch" for "push" section. expected one of "bran
|
3 | branch: main
| ^~~~~~~
test.yaml:5:11: character '\' is invalid for branch and tag names. only special characters [, ?, +, *, \ ! can be escaped with \. see `man git-check-ref-format` for more details. note that regular expression is unavailable. note: filter pattern syntax is explained at https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet [glob]
test.yaml:5:11: character '\' is invalid for branch and tag names. only special characters [, ?, +, *, \, ! can be escaped with \. see `man git-check-ref-format` for more details. note that regular expression is unavailable. note: filter pattern syntax is explained at https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet [glob]
|
5 | - 'v\d+'
| ^~~~
Expand Down
2 changes: 1 addition & 1 deletion glob.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (v *globValidator) validateNext() bool {
default:
// file path can contain '\' (`mkdir 'foo\bar'` works)
if v.isRef {
v.invalidRefChar('\\', "only special characters [, ?, +, *, \\ ! can be escaped with \\")
v.invalidRefChar('\\', "only special characters [, ?, +, *, \\, ! can be escaped with \\")
c = v.scan.Next()
}
}
Expand Down
12 changes: 6 additions & 6 deletions glob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ func TestValidateGlobGitRefNameInvalidCharacter(t *testing.T) {
{
what: "escaped non-special character",
input: `\d`,
expected: "only special characters [, ?, +, *, \\ ! can be escaped with \\",
expected: "only special characters [, ?, +, *, \\, ! can be escaped with \\",
},
{
what: "prohibited characters for ref names",
Expand All @@ -314,11 +314,11 @@ func TestValidateGlobGitRefNameInvalidCharacter(t *testing.T) {
expectedAll: []string{
"ref name must not start with /",
"ref name cannot contain spaces, ~, ^, :, [, ?, *",
"only special characters [, ?, +, *, \\ ! can be escaped with \\",
"only special characters [, ?, +, *, \\ ! can be escaped with \\",
"only special characters [, ?, +, *, \\ ! can be escaped with \\",
"only special characters [, ?, +, *, \\ ! can be escaped with \\",
"only special characters [, ?, +, *, \\ ! can be escaped with \\",
"only special characters [, ?, +, *, \\, ! can be escaped with \\",
"only special characters [, ?, +, *, \\, ! can be escaped with \\",
"only special characters [, ?, +, *, \\, ! can be escaped with \\",
"only special characters [, ?, +, *, \\, ! can be escaped with \\",
"only special characters [, ?, +, *, \\, ! can be escaped with \\",
"ref name must not end with / and .",
},
},
Expand Down
2 changes: 1 addition & 1 deletion testdata/err/glob_more.out
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
test.yaml:6:12: invalid glob pattern. unexpected character ']' while checking character match []. character match with single character is useless. simply use x instead of [x]. note: filter pattern syntax is explained at https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet [glob]
test.yaml:7:10: character ' ' is invalid for branch and tag names. ref name cannot contain spaces, ~, ^, :, [, ?, *. see `man git-check-ref-format` for more details. note that regular expression is unavailable. note: filter pattern syntax is explained at https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet [glob]
test.yaml:10:9: character '/' is invalid for branch and tag names. ref name must not start with /. see `man git-check-ref-format` for more details. note that regular expression is unavailable. note: filter pattern syntax is explained at https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet [glob]
test.yaml:10:11: character '\' is invalid for branch and tag names. only special characters [, ?, +, *, \ ! can be escaped with \. see `man git-check-ref-format` for more details. note that regular expression is unavailable. note: filter pattern syntax is explained at https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet [glob]
test.yaml:10:11: character '\' is invalid for branch and tag names. only special characters [, ?, +, *, \, ! can be escaped with \. see `man git-check-ref-format` for more details. note that regular expression is unavailable. note: filter pattern syntax is explained at https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet [glob]
test.yaml:10:14: character '/' is invalid for branch and tag names. ref name must not end with / and .. see `man git-check-ref-format` for more details. note that regular expression is unavailable. note: filter pattern syntax is explained at https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet [glob]
test.yaml:11:12: invalid glob pattern. unexpected EOF while checking end of character match []. missing ]. note: filter pattern syntax is explained at https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet [glob]
test.yaml:12:13: invalid glob pattern. unexpected character '0' while checking character range in []. start of range '9' (57) is larger than end of range '0' (48). note: filter pattern syntax is explained at https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet [glob]
Expand Down
2 changes: 1 addition & 1 deletion testdata/examples/main.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
test.yaml:3:5: unexpected key "branch" for "push" section. expected one of "branches", "branches-ignore", "paths", "paths-ignore", "tags", "tags-ignore", "types", "workflows" [syntax-check]
test.yaml:5:11: character '\' is invalid for branch and tag names. only special characters [, ?, +, *, \ ! can be escaped with \. see `man git-check-ref-format` for more details. note that regular expression is unavailable. note: filter pattern syntax is explained at https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet [glob]
test.yaml:5:11: character '\' is invalid for branch and tag names. only special characters [, ?, +, *, \, ! can be escaped with \. see `man git-check-ref-format` for more details. note that regular expression is unavailable. note: filter pattern syntax is explained at https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet [glob]
/test\.yaml:10:28: label "linux-latest" is unknown\. available labels are .+\. if it is a custom label for self-hosted runner, set list of labels in actionlint\.yaml config file \[runner-label\]/
test.yaml:13:41: "github.event.head_commit.message" is potentially untrusted. avoid using it directly in inline scripts. instead, pass it through an environment variable. see https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions for more details [expression]
test.yaml:17:11: input "node_version" is not defined in action "actions/setup-node@v3". available inputs are "always-auth", "architecture", "cache", "cache-dependency-path", "check-latest", "node-version", "node-version-file", "registry-url", "scope", "token" [action]
Expand Down

0 comments on commit 235dfcd

Please sign in to comment.