(resp *v1pb.CheckReleaseResponse)
| 177 | } |
| 178 | |
| 179 | func writeAnnotations(resp *v1pb.CheckReleaseResponse) error { |
| 180 | // annotation template |
| 181 | // `::${advice.status} file=${file},line=${advice.line},col=${advice.column},title=${advice.title} (${advice.code})::${advice.content}. Targets: ${targets.join(', ')} https://docs.bytebase.com/sql-review/error-codes#${advice.code}` |
| 182 | for _, result := range resp.Results { |
| 183 | for _, advice := range result.Advices { |
| 184 | var sb strings.Builder |
| 185 | _, _ = sb.WriteString("::") |
| 186 | switch advice.Status { |
| 187 | case v1pb.Advice_WARNING: |
| 188 | _, _ = sb.WriteString("warning ") |
| 189 | case v1pb.Advice_ERROR: |
| 190 | _, _ = sb.WriteString("error ") |
| 191 | default: |
| 192 | continue |
| 193 | } |
| 194 | |
| 195 | _, _ = sb.WriteString(" file=") |
| 196 | _, _ = sb.WriteString(result.File) |
| 197 | _, _ = sb.WriteString(",line=") |
| 198 | _, _ = sb.WriteString(strconv.Itoa(common.ConvertLineToActionLine(int(advice.GetStartPosition().GetLine())))) |
| 199 | _, _ = sb.WriteString(",title=") |
| 200 | _, _ = sb.WriteString(advice.Title) |
| 201 | _, _ = sb.WriteString(" (") |
| 202 | _, _ = sb.WriteString(strconv.Itoa(int(advice.Code))) |
| 203 | _, _ = sb.WriteString(")::") |
| 204 | _, _ = sb.WriteString(advice.Content) |
| 205 | _, _ = sb.WriteString(". Targets: ") |
| 206 | _, _ = sb.WriteString(result.Target) |
| 207 | _, _ = sb.WriteString(" ") |
| 208 | _, _ = sb.WriteString(" https://docs.bytebase.com/sql-review/error-codes#") |
| 209 | _, _ = sb.WriteString(strconv.Itoa(int(advice.Code))) |
| 210 | fmt.Println(sb.String()) |
| 211 | } |
| 212 | } |
| 213 | return nil |
| 214 | } |
| 215 | |
| 216 | func formatRiskLevel(r v1pb.RiskLevel) string { |
| 217 | switch r { |
no test coverage detected