Skip to content

Commit 769fd21

Browse files
fix regex
1 parent 7ae55ba commit 769fd21

3 files changed

Lines changed: 7 additions & 13 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ docker run -it -v $srcDir:/src codacy-opengrep:latest
2323

2424
1. Update the version in `.tool_version`
2525

26-
2. Get the latest commit for the `release` branch from the github.com/semgrep/semgrep-rules repo and update it in DocGenerator file `internal/docgen/parsing.go`.
26+
2. Get the latest commit for the `release` branch from the github.com/opengrep/opengrep-rules repo and update it in DocGenerator file `internal/docgen/parsing.go`.
2727

2828
3. Run the DocGenerator:
2929
```bash

docs/codacy-rules.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,9 @@ rules:
322322
languages:
323323
- generic
324324
patterns:
325-
- pattern-either:
326-
- pattern-regex: "(?is)\\bselect\\b(?!(?:[^;]*)\\blanguage\\b)[^;]*\\blookup_type\\b"
327-
- pattern-regex: "(?i)apps\\.fnd_lookup_values"
325+
- pattern-either:
326+
- pattern-regex: "(?i)\\bselect\\b(?!(?:[^;\\n]*\\n)*(?:(?!--)[^;\\n])*\\blanguage\\b)(?:[^;\\n]*\\n)*(?:(?!--)[^;\\n])*\\blookup_type\\b"
327+
- pattern-regex: "(?im)^(?:(?!(?:--|/\\*))[^\\n])*?apps\\.fnd_lookup_values"
328328
paths:
329329
include:
330330
- "*.sql"

internal/docgen/parsing.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,12 @@ type SemgrepRuleMetadata struct {
4646
type SemgrepRules []SemgrepRule
4747

4848
func semgrepRules(destinationDir string) ([]PatternWithExplanation, *ParsedSemgrepRules, error) {
49-
fmt.Println("Getting Semgrep rules...")
49+
fmt.Println("Getting Opengrep rules...")
5050
parsedSemgrepRegistryRules, err := getSemgrepRegistryRules()
5151
if err != nil {
5252
return nil, nil, err
5353
}
5454

55-
// fmt.Println("Getting Semgrep default rules...")
56-
// semgrepRegistryDefaultRules, err := getSemgrepRegistryDefaultRules()
57-
// if err != nil {
58-
// return nil, nil, err
59-
// }
60-
6155
fmt.Println("Getting GitLab rules...")
6256
parsedGitLabRules, err := getGitLabRules()
6357
if err != nil {
@@ -96,8 +90,8 @@ func semgrepRules(destinationDir string) ([]PatternWithExplanation, *ParsedSemgr
9690

9791
func getSemgrepRegistryRules() (*ParsedSemgrepRules, error) {
9892
return getRules(
99-
"https://github.com/semgrep/semgrep-rules",
100-
"4e3b8820d38983199db46cd8551bf51067b7fe16",
93+
"https://github.com/opengrep/opengrep-rules",
94+
"f1d2b562b414783763fd02a6ed2736eaed622efa",
10195
isValidSemgrepRegistryRuleFile,
10296
prefixRuleIDWithPath)
10397
}

0 commit comments

Comments
 (0)