computeScope determines whether the task touches one file, one package, or crosses packages.
(files []string)
| 149 | |
| 150 | // computeScope determines whether the task touches one file, one package, or crosses packages. |
| 151 | func computeScope(files []string) string { |
| 152 | if len(files) == 0 { |
| 153 | return "unknown" |
| 154 | } |
| 155 | if len(files) == 1 { |
| 156 | return "single-file" |
| 157 | } |
| 158 | |
| 159 | packages := make(map[string]struct{}) |
| 160 | for _, f := range files { |
| 161 | packages[filepath.Dir(f)] = struct{}{} |
| 162 | } |
| 163 | |
| 164 | if len(packages) <= 1 { |
| 165 | return "package" |
| 166 | } |
| 167 | return "cross-cutting" |
| 168 | } |
| 169 | |
| 170 | // analyzeRisk evaluates hub involvement and generates context suggestions. |
| 171 | func analyzeRisk(files []string, info *hubInfo, category string) (string, []ContextSuggestion) { |
no outgoing calls