-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- replace placeholders in action.yml - add sgconfig.yml and teatdata - add to-rdjsonl.jq and fix script.sh Signed-off-by: Rintaro Okamura <[email protected]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ruleDirs: | ||
- ./testdata/rules |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
) | ||
|
||
func main() { | ||
_ = context.TODO() | ||
Check failure Code scanning / ast-grep Do not use context.TODO in production code (Note: context.TODO() is just a temporary thing) Error test
Do not use context.TODO in production code (Note: context.TODO() is just a temporary thing)
Check failure on line 9 in testdata/main.go GitHub Actions / ast-grep[ast-grep] testdata/main.go#L9 <no-context-todo>(https://github.com/ast-grep/ast-grep)
Raw output
|
||
|
||
fmt.Println("hello world") | ||
} | ||
|
||
// Deprecated: deprecated function | ||
Check warning Code scanning / ast-grep Avoid to use deprecated function Warning test
Avoid to use deprecated function
Check warning on line 14 in testdata/main.go GitHub Actions / ast-grep[ast-grep] testdata/main.go#L14 <avoid-use-deprecated-function>(https://github.com/ast-grep/ast-grep)
Raw output
|
||
func New() { | ||
// FIXME: implement me | ||
Check warning Code scanning / ast-grep Do not leave fixme comment Warning test
Do not leave fixme comment
Check notice on line 16 in testdata/main.go GitHub Actions / ast-grep[ast-grep] testdata/main.go#L16 <no-fixme-comment>(https://github.com/ast-grep/ast-grep)
Raw output
|
||
fmt.Println("new function") | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/ast-grep/ast-grep/main/schemas/rule.json | ||
|
||
id: avoid-use-deprecated-function | ||
message: Avoid to use deprecated function | ||
severity: warning # error, warning, info, hint | ||
language: Go | ||
rule: | ||
kind: comment | ||
regex: "//\\s*[dD]eprecated:.*" | ||
# utils: Extract repeated rule as local utility here. | ||
# note: Add detailed explanation for the rule. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/ast-grep/ast-grep/main/schemas/rule.json | ||
|
||
id: no-context-todo | ||
message: Do not use context.TODO in production code | ||
severity: error # error, warning, info, hint | ||
language: Go | ||
rule: | ||
pattern: context.TODO() | ||
# utils: Extract repeated rule as local utility here. | ||
note: context.TODO() is just a temporary thing | ||
fix: context.Background() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/ast-grep/ast-grep/main/schemas/rule.json | ||
|
||
id: no-fixme-comment | ||
message: Do not leave fixme comment | ||
severity: info | ||
language: Go | ||
rule: | ||
kind: comment | ||
regex: "//\\s*FIXME:.*" | ||
# utils: Extract repeated rule as local utility here. | ||
# note: Add detailed explanation for the rule. |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
.[] | | ||
. as $item | | ||
{ | ||
"message": (if .note then (.message + " (Note: " + .note + ")") else .message end), | ||
"severity": .severity | ascii_upcase, | ||
"location": { | ||
"path": .file, | ||
"range": { | ||
"start": { | ||
"line": (.range.start.line + 1), | ||
"column": (.range.start.column + 1) | ||
}, | ||
"end": { | ||
"line": (.range.end.line + 1), | ||
"column": (.range.end.column + 1) | ||
} | ||
} | ||
}, | ||
"code": { | ||
"value": .ruleId, | ||
"url": "https://github.com/ast-grep/ast-grep" | ||
}, | ||
"source": { | ||
"name": "ast-grep", | ||
"url": "https://github.com/ast-grep/ast-grep" | ||
}, | ||
"original_output": . | tostring | ||
} + if .replacement then | ||
{ | ||
"suggestions": [ | ||
{ | ||
"range": { | ||
"start": { | ||
"line": (.range.start.line + 1), | ||
"column": (.range.start.column + 1) | ||
}, | ||
"end": { | ||
"line": (.range.end.line + 1), | ||
"column": (.range.end.column + 1) | ||
} | ||
}, | ||
"text": .replacement | ||
} | ||
] | ||
} | ||
else {} end |