(lines []string)
| 224 | } |
| 225 | |
| 226 | func removeEmptyEngineEnvBlock(lines []string) []string { |
| 227 | result := make([]string, 0, len(lines)) |
| 228 | for i := range lines { |
| 229 | line := lines[i] |
| 230 | trimmed := strings.TrimSpace(line) |
| 231 | if trimmed == "env:" { |
| 232 | envIndent := getIndentation(line) |
| 233 | hasValues := false |
| 234 | j := i + 1 |
| 235 | for ; j < len(lines); j++ { |
| 236 | t := strings.TrimSpace(lines[j]) |
| 237 | if t == "" { |
| 238 | continue |
| 239 | } |
| 240 | if len(getIndentation(lines[j])) <= len(envIndent) { |
| 241 | break |
| 242 | } |
| 243 | hasValues = true |
| 244 | break |
| 245 | } |
| 246 | if !hasValues { |
| 247 | continue |
| 248 | } |
| 249 | } |
| 250 | result = append(result, line) |
| 251 | } |
| 252 | return result |
| 253 | } |
| 254 | |
| 255 | // getTopLevelEnvSecretsGuidedErrorCodemod creates a codemod that emits a guided error |
| 256 | // when secrets are detected in the top-level env: block. Unlike the engine.env codemod |
no test coverage detected