mirror of
https://github.com/alibaba/open-code-review.git
synced 2026-07-09 17:28:58 +00:00
fix: clean up tryReadRuleFile and add missing blank line
- Add blank line between matchProjectRuleEntry and allowedRuleExts (Issue 1) - Remove dead code '|| repoDir == ' in tryReadRuleFile (Issue 2) - Remove unnecessary warning when repoDir is empty but path is absolute (Issue 3)
This commit is contained in:
parent
c44265d63e
commit
eaa8e997f8
1 changed files with 2 additions and 2 deletions
|
|
@ -441,6 +441,7 @@ func matchProjectRuleEntry(pr *ProjectRule, path string) *ProjectRuleEntry {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// allowedRuleExts is the set of file extensions permitted for rule file references.
|
||||
var allowedRuleExts = map[string]bool{".md": true, ".txt": true, ".markdown": true}
|
||||
|
||||
|
|
@ -486,9 +487,8 @@ func tryReadRuleFile(rule string, repoDir string) *string {
|
|||
fmt.Fprintf(os.Stderr, "[ocr] WARNING: cannot resolve relative rule path %q without a repo dir\n", rule)
|
||||
return nil
|
||||
}
|
||||
fmt.Fprintf(os.Stderr, "[ocr] WARNING: repoDir is empty, treating rule as absolute path: %s\n", rule)
|
||||
}
|
||||
if filepath.IsAbs(rule) || repoDir == "" {
|
||||
if filepath.IsAbs(rule) {
|
||||
content, err := readRuleFileSafe(rule)
|
||||
if err == nil {
|
||||
return &content
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue