(bundle blastRadiusBundle)
| 1119 | } |
| 1120 | |
| 1121 | func renderBlastRadiusText(bundle blastRadiusBundle) string { |
| 1122 | builder := newBlastOutputBuilder(bundle.Limits.MaxTotalChars) |
| 1123 | |
| 1124 | var summary strings.Builder |
| 1125 | summary.WriteString("CODEMAP BLAST RADIUS\n") |
| 1126 | summary.WriteString(fmt.Sprintf("root=%s\n", bundle.Root)) |
| 1127 | summary.WriteString(fmt.Sprintf("ref=%s\n\n", bundle.Ref)) |
| 1128 | summary.WriteString("[summary]\n") |
| 1129 | summary.WriteString(fmt.Sprintf("changed_files=%d/%d\n", bundle.Summary.ChangedFiles, bundle.Summary.ChangedFilesTotal)) |
| 1130 | summary.WriteString(fmt.Sprintf("files_with_dependents=%d\n", bundle.Summary.FilesWithDependents)) |
| 1131 | summary.WriteString(fmt.Sprintf("impacted_outside_diff=%d/%d\n", bundle.Summary.ImpactedOutsideDiffShown, bundle.Summary.ImpactedOutsideDiffTotal)) |
| 1132 | summary.WriteString(fmt.Sprintf("dependency_context_outside_diff=%d/%d\n", bundle.Summary.DependencyContextOutsideDiffShown, bundle.Summary.DependencyContextOutsideDiffTotal)) |
| 1133 | summary.WriteString(fmt.Sprintf("output_budgets=%d_total,%d_diff,%d_deps,%d_importers\n", bundle.Limits.MaxTotalChars, bundle.Limits.MaxDiffChars, bundle.Limits.MaxDepsChars, bundle.Limits.MaxImportersChars)) |
| 1134 | summary.WriteString(fmt.Sprintf("snippet_limits=%d_total,%d_per_changed,%d_chars\n\n", bundle.Limits.MaxSnippets, bundle.Limits.MaxSnippetsPerChanged, bundle.Limits.MaxSnippetChars)) |
| 1135 | if !builder.Append(summary.String(), "summary") { |
| 1136 | return builder.String() |
| 1137 | } |
| 1138 | |
| 1139 | if bundle.Summary.ChangedFilesTotal == 0 { |
| 1140 | empty := fmt.Sprintf("[no_changes]\nNo files changed vs %s.\nDependency, snippet, and importer sections are omitted.\n", bundle.Ref) |
| 1141 | builder.Append(empty, "no changes") |
| 1142 | return builder.String() |
| 1143 | } |
| 1144 | |
| 1145 | if len(bundle.ImpactedOutsideDiff) > 0 { |
| 1146 | var section strings.Builder |
| 1147 | section.WriteString("[affected_outside_diff]\n") |
| 1148 | for _, item := range bundle.ImpactedOutsideDiff { |
| 1149 | section.WriteString(fmt.Sprintf("%s <= %s\n", item.Path, item.Via)) |
| 1150 | } |
| 1151 | section.WriteString("\n") |
| 1152 | if !builder.Append(section.String(), "affected outside diff") { |
| 1153 | return builder.String() |
| 1154 | } |
| 1155 | } |
| 1156 | |
| 1157 | if len(bundle.DependencyContextOutsideDiff) > 0 { |
| 1158 | var section strings.Builder |
| 1159 | section.WriteString("[dependency_context_outside_diff]\n") |
| 1160 | for _, item := range bundle.DependencyContextOutsideDiff { |
| 1161 | section.WriteString(fmt.Sprintf("%s => %s", item.Via, item.Path)) |
| 1162 | if item.Relation == "shared_hub_dependency" { |
| 1163 | section.WriteString(" [shared hub]") |
| 1164 | } |
| 1165 | section.WriteString("\n") |
| 1166 | } |
| 1167 | section.WriteString("\n") |
| 1168 | if !builder.Append(section.String(), "dependency context") { |
| 1169 | return builder.String() |
| 1170 | } |
| 1171 | } |
| 1172 | |
| 1173 | if len(bundle.Snippets) > 0 { |
| 1174 | var section strings.Builder |
| 1175 | section.WriteString("[impact_snippets]\n") |
| 1176 | for _, snippet := range bundle.Snippets { |
| 1177 | section.WriteString(fmt.Sprintf("\n%s <= %s [%s]\n", snippet.Path, snippet.Via, snippet.MatchedTerm)) |
| 1178 | section.WriteString(snippet.Excerpt) |
no test coverage detected