(lines []string)
| 56 | } |
| 57 | |
| 58 | func renameGitHubAppIDToClientID(lines []string) ([]string, bool) { |
| 59 | result := make([]string, 0, len(lines)) |
| 60 | modified := false |
| 61 | |
| 62 | inGitHubApp := false |
| 63 | var githubAppIndent string |
| 64 | |
| 65 | for i, line := range lines { |
| 66 | trimmed := strings.TrimSpace(line) |
| 67 | |
| 68 | if trimmed == "" { |
| 69 | result = append(result, line) |
| 70 | continue |
| 71 | } |
| 72 | |
| 73 | if !strings.HasPrefix(trimmed, "#") && inGitHubApp && hasExitedBlock(line, githubAppIndent) { |
| 74 | inGitHubApp = false |
| 75 | } |
| 76 | |
| 77 | if strings.HasPrefix(trimmed, "github-app:") { |
| 78 | inGitHubApp = true |
| 79 | githubAppIndent = getIndentation(line) |
| 80 | result = append(result, line) |
| 81 | continue |
| 82 | } |
| 83 | |
| 84 | if inGitHubApp { |
| 85 | lineIndent := getIndentation(line) |
| 86 | if isDescendant(lineIndent, githubAppIndent) && strings.HasPrefix(trimmed, "app-id:") { |
| 87 | newLine, replaced := findAndReplaceInLine(line, "app-id", "client-id") |
| 88 | if replaced { |
| 89 | result = append(result, newLine) |
| 90 | modified = true |
| 91 | githubAppClientIDCodemodLog.Printf("Renamed github-app app-id on line %d", i+1) |
| 92 | continue |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | result = append(result, line) |
| 98 | } |
| 99 | |
| 100 | return result, modified |
| 101 | } |
nothing calls this directly
no test coverage detected