loadRulesFromFile 从文件加载规则
(filePath string, scope Scope)
| 165 | |
| 166 | // loadRulesFromFile 从文件加载规则 |
| 167 | func (m *Manager) loadRulesFromFile(filePath string, scope Scope) ([]*Rule, error) { |
| 168 | content, err := os.ReadFile(filePath) |
| 169 | if err != nil { |
| 170 | return nil, err |
| 171 | } |
| 172 | |
| 173 | return m.parseMarkdownRules(string(content), filePath, scope) |
| 174 | } |
| 175 | |
| 176 | // parseMarkdownRules 解析 Markdown 格式的规则 |
| 177 | func (m *Manager) parseMarkdownRules(content, sourcePath string, scope Scope) ([]*Rule, error) { |
no test coverage detected