Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions pkg/cli/codemod_checkout_persist_credentials_false.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func transformSectionCheckoutPersistCredentials(lines []string, sectionName stri
sectionEnd := len(lines) - 1
for i := sectionStart + 1; i < len(lines); i++ {
trimmed := strings.TrimSpace(lines[i])
if len(trimmed) == 0 || strings.HasPrefix(trimmed, "#") {
if trimmed == "" || strings.HasPrefix(trimmed, "#") {
continue
}
if len(getIndentation(lines[i])) <= len(sectionIndent) {
Expand Down Expand Up @@ -135,7 +135,7 @@ func transformAgentJobCheckoutPersistCredentials(lines []string, sectionNames []
jobsEnd := len(lines) - 1
for i := jobsStart + 1; i < len(lines); i++ {
trimmed := strings.TrimSpace(lines[i])
if len(trimmed) == 0 || strings.HasPrefix(trimmed, "#") {
if trimmed == "" || strings.HasPrefix(trimmed, "#") {
continue
}
if len(getIndentation(lines[i])) <= len(jobsIndent) {
Expand Down Expand Up @@ -168,7 +168,7 @@ func transformAgentJobCheckoutPersistCredentials(lines []string, sectionNames []
agentEnd := len(jobsLines) - 1
for i := agentStart + 1; i < len(jobsLines); i++ {
trimmed := strings.TrimSpace(jobsLines[i])
if len(trimmed) == 0 || strings.HasPrefix(trimmed, "#") {
if trimmed == "" || strings.HasPrefix(trimmed, "#") {
continue
}
if len(getIndentation(jobsLines[i])) <= len(agentIndent) {
Expand Down Expand Up @@ -224,7 +224,7 @@ func transformNestedSectionCheckoutPersistCredentials(lines []string, sectionNam
sectionEnd := len(lines) - 1
for i := sectionStart + 1; i < len(lines); i++ {
trimmed := strings.TrimSpace(lines[i])
if len(trimmed) == 0 || strings.HasPrefix(trimmed, "#") {
if trimmed == "" || strings.HasPrefix(trimmed, "#") {
continue
}
if len(getIndentation(lines[i])) <= len(sectionIndent) {
Expand Down Expand Up @@ -252,7 +252,7 @@ func transformNestedSectionCheckoutPersistCredentials(lines []string, sectionNam
func findDirectChildIndentLen(lines []string, parentStart int, parentIndentLen int) (int, bool) {
for i := parentStart + 1; i < len(lines); i++ {
trimmed := strings.TrimSpace(lines[i])
if len(trimmed) == 0 || strings.HasPrefix(trimmed, "#") {
if trimmed == "" || strings.HasPrefix(trimmed, "#") {
continue
}
indentLen := len(getIndentation(lines[i]))
Expand Down Expand Up @@ -280,7 +280,7 @@ func transformCheckoutWithinSection(sectionLines []string, sectionIndent string)
stepEnd := len(sectionLines) - 1
for j := i + 1; j < len(sectionLines); j++ {
t := strings.TrimSpace(sectionLines[j])
if len(t) == 0 {
if t == "" {
continue
}
jIndent := getIndentation(sectionLines[j])
Expand Down Expand Up @@ -343,7 +343,7 @@ func ensureStepCheckoutPersistCredentials(stepLines []string, stepIndent string)
withKeyIndentLen := currentWithKeyIndentLen
for j := i + 1; j < len(stepLines); j++ {
t := strings.TrimSpace(stepLines[j])
if len(t) == 0 {
if t == "" {
withEnd = j
continue
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/codemod_discussion_flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func getDiscussionFlagRemovalCodemod() Codemod {
// Skip any nested content under the discussion field (shouldn't be any, but for completeness)
if inDiscussionField {
// Empty lines within the field block should be removed
if len(trimmedLine) == 0 {
if trimmedLine == "" {
continue
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/cli/codemod_engine_env_secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func removeUnsafeEngineEnvKeys(lines []string, unsafeKeys map[string]bool) ([]st
}

if inEnv && removingKey {
if len(trimmed) == 0 {
if trimmed == "" {
continue
}
if strings.HasPrefix(trimmed, "#") && len(indent) > len(removingKeyIndent) {
Expand Down Expand Up @@ -222,7 +222,7 @@ func removeEmptyEngineEnvBlock(lines []string) []string {
j := i + 1
for ; j < len(lines); j++ {
t := strings.TrimSpace(lines[j])
if len(t) == 0 {
if t == "" {
continue
}
if len(getIndentation(lines[j])) <= len(envIndent) {
Expand Down
8 changes: 4 additions & 4 deletions pkg/cli/codemod_engine_steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func getEngineStepsToTopLevelCodemod() Codemod {
line := frontmatterLines[j]
trimmed := strings.TrimSpace(line)

if len(trimmed) == 0 {
if trimmed == "" {
continue
}

Expand Down Expand Up @@ -128,7 +128,7 @@ func getEngineStepsToTopLevelCodemod() Codemod {
for j := i + 1; j < len(frontmatterLines); j++ {
l := frontmatterLines[j]
t := strings.TrimSpace(l)
if len(t) == 0 {
if t == "" {
continue
}
if len(getIndentation(l)) > len(topStepsIndent) {
Expand Down Expand Up @@ -171,7 +171,7 @@ func getEngineStepsToTopLevelCodemod() Codemod {
continue
}
if inEngine {
if len(trimmed) == 0 {
if trimmed == "" {
continue
}
lineIndentLen := len(getIndentation(line))
Expand Down Expand Up @@ -205,7 +205,7 @@ func getEngineStepsToTopLevelCodemod() Codemod {
continue
}
if inEngine {
if len(trimmed) == 0 {
if trimmed == "" {
continue
}
if len(getIndentation(line)) <= engineIndentLen {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/codemod_github_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func renameAppToGitHubApp(lines []string) ([]string, bool) {
trimmed := strings.TrimSpace(line)

// Skip empty lines without resetting state
if len(trimmed) == 0 {
if trimmed == "" {
result = append(result, line)
continue
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/codemod_github_app_client_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func renameGitHubAppIDToClientID(lines []string) ([]string, bool) {
for i, line := range lines {
trimmed := strings.TrimSpace(line)

if len(trimmed) == 0 {
if trimmed == "" {
result = append(result, line)
continue
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/codemod_github_repos.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func renameGitHubReposToAllowedRepos(lines []string) ([]string, bool) {
trimmed := strings.TrimSpace(line)

// Skip empty lines without resetting state
if len(trimmed) == 0 {
if trimmed == "" {
result = append(result, line)
continue
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/cli/codemod_mcp_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func removeFieldFromMCPServer(lines []string, serverName string, fieldName strin
// Skip nested properties under the field
if inFieldBlock {
// Empty lines within the field block should be removed
if len(trimmedLine) == 0 {
if trimmedLine == "" {
continue
}

Expand Down Expand Up @@ -252,7 +252,7 @@ func addTopLevelNetwork(lines []string, domains []string) []string {
for j := i + 1; j < len(lines); j++ {
nextLine := lines[j]
nextTrimmed := strings.TrimSpace(nextLine)
if len(nextTrimmed) == 0 {
if nextTrimmed == "" {
continue
}
if hasExitedBlock(nextLine, onIndent) {
Expand Down Expand Up @@ -328,7 +328,7 @@ func updateNetworkAllowed(lines []string, domains []string) []string {
currentIndent := getIndentation(line)

// Empty lines - skip
if len(trimmedLine) == 0 {
if trimmedLine == "" {
continue
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/codemod_mount_as_clis.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func renameMountAsCLIsToCLIProxy(lines []string) ([]string, bool) {
for i, line := range lines {
trimmed := strings.TrimSpace(line)

if len(trimmed) == 0 {
if trimmed == "" {
result = append(result, line)
continue
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/codemod_playwright_domains.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func removeFieldFromPlaywright(lines []string, fieldName string) ([]string, bool

// Skip nested properties under the removed field
if inFieldBlock {
if len(trimmed) == 0 {
if trimmed == "" {
continue
}
currentIndent := getIndentation(line)
Expand Down
8 changes: 4 additions & 4 deletions pkg/cli/codemod_steps_run_secrets_env.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func transformSectionStepsRunSecrets(lines []string, sectionName string) ([]stri
sectionEnd := len(lines) - 1
for i := sectionStart + 1; i < len(lines); i++ {
trimmed := strings.TrimSpace(lines[i])
if len(trimmed) == 0 || strings.HasPrefix(trimmed, "#") {
if trimmed == "" || strings.HasPrefix(trimmed, "#") {
continue
}
if len(getIndentation(lines[i])) <= len(sectionIndent) {
Expand Down Expand Up @@ -125,7 +125,7 @@ func transformStepsWithinSection(sectionLines []string, sectionIndent string) ([
stepEnd := len(sectionLines) - 1
for j := i + 1; j < len(sectionLines); j++ {
t := strings.TrimSpace(sectionLines[j])
if len(t) == 0 {
if t == "" {
continue
}
jIndent := getIndentation(sectionLines[j])
Expand Down Expand Up @@ -199,7 +199,7 @@ func rewriteStepRunSecretsToEnv(stepLines []string, stepIndent string) ([]string
envEnd = i
for j := i + 1; j < len(stepLines); j++ {
t := strings.TrimSpace(stepLines[j])
if len(t) == 0 {
if t == "" {
envEnd = j
continue
}
Expand All @@ -225,7 +225,7 @@ func rewriteStepRunSecretsToEnv(stepLines []string, stepIndent string) ([]string
if runValue == "|" || runValue == "|-" || runValue == ">" || runValue == ">-" {
for j := i + 1; j < len(stepLines); j++ {
t := strings.TrimSpace(stepLines[j])
if len(t) == 0 {
if t == "" {
continue
}
if effectiveStepLineIndentLen(t, getIndentation(stepLines[j]), stepIndent) <= runKeyIndentLen {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/codemod_user_rate_limit.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func renameRateLimitToUserRateLimit(lines []string) ([]string, bool) {
for i, line := range lines {
trimmed := strings.TrimSpace(line)

if len(trimmed) == 0 {
if trimmed == "" {
result = append(result, line)
continue
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/mcp_tools_readonly.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ Returns JSON array with validation results for each workflow:
if err != nil {
mcpLog.Printf("Compile command exited with error: %v (output length: %d)", err, len(outputStr))
// If we have no output, this is a real execution failure
if len(outputStr) == 0 {
if outputStr == "" {
// Try to get stderr for error details
var stderr string
var exitErr *exec.ExitError
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/project_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ func validateOwner(ctx context.Context, ownerType, owner string, verbose bool) e

// capitalizeFirst capitalizes the first letter of a string
func capitalizeFirst(s string) string {
if len(s) == 0 {
if s == "" {
return s
}
return strings.ToUpper(s[:1]) + s[1:]
Expand Down
4 changes: 2 additions & 2 deletions pkg/cli/remove_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ func findIncludesInContent(content string) ([]string, error) {
// Section references (e.g. file.md#Section) are stripped from the returned path.
func parseIncludePath(line string) string {
trimmed := strings.TrimSpace(line)
if len(trimmed) == 0 {
if trimmed == "" {
return ""
}

Expand Down Expand Up @@ -471,7 +471,7 @@ func parseIncludePath(line string) string {
rest = rest[1:]
}
// Require at least one whitespace character after the directive keyword
if len(rest) == 0 || (rest[0] != ' ' && rest[0] != '\t') {
if rest == "" || (rest[0] != ' ' && rest[0] != '\t') {
return ""
}
path := strings.TrimSpace(rest)
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/run_push.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ func pushWorkflowFiles(workflowName string, files []string, refOverride string,
runPushLog.Printf("Git status output: %s", string(statusOutput))

// Check if there are no staged changes (nothing to commit)
if len(strings.TrimSpace(string(statusOutput))) == 0 {
if strings.TrimSpace(string(statusOutput)) == "" {
runPushLog.Printf("No staged changes detected")
if verbose {
fmt.Fprintln(os.Stderr, console.FormatInfoMessage("No changes to commit"))
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/run_workflow_execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func RunWorkflowOnGitHub(ctx context.Context, workflowIdOrName string, opts RunO
}
// Check that key (before '=') is not empty
parts := strings.SplitN(input, "=", 2)
if len(parts[0]) == 0 {
if parts[0] == "" {
return fmt.Errorf("invalid input format '%s': key cannot be empty", input)
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/trial_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ func copyTrialResultsToHostRepo(tempDir, dateTimeID string, workflowNames []stri
}

// If no changes, skip commit and push
if len(strings.TrimSpace(string(statusOutput))) == 0 {
if strings.TrimSpace(string(statusOutput)) == "" {
trialLog.Print("No new trial results to commit, skipping push")
if verbose {
fmt.Fprintln(os.Stderr, console.FormatInfoMessage("No new trial results to commit"))
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/trial_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ func commitAndPushWorkflow(tempDir, workflowName string, verbose bool) error {
}

// If no changes, skip commit and push
if len(strings.TrimSpace(string(statusOutput))) == 0 {
if strings.TrimSpace(string(statusOutput)) == "" {
if verbose {
fmt.Fprintln(os.Stderr, console.FormatInfoMessage("No changes detected, skipping commit"))
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func ValidateWorkflowName(s string) error {
func ValidateWorkflowIntent(s string) error {
validatorsLog.Printf("Validating workflow intent: length=%d", len(s))
trimmed := strings.TrimSpace(s)
if len(trimmed) == 0 {
if trimmed == "" {
validatorsLog.Print("Workflow intent validation failed: empty content")
return errors.New("workflow instructions cannot be empty")
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/cli/yaml_frontmatter_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ func getIndentation(line string) string {
// isTopLevelKey checks if a line is a top-level YAML key (no indentation, contains colon, not a comment)
func isTopLevelKey(line string) bool {
trimmed := strings.TrimSpace(line)
if len(trimmed) == 0 || strings.HasPrefix(trimmed, "#") {
if trimmed == "" || strings.HasPrefix(trimmed, "#") {
return false
}
indent := getIndentation(line)
return len(indent) == 0 && strings.Contains(line, ":")
return indent == "" && strings.Contains(line, ":")
}

// isNestedUnder checks if currentLine is nested under (has more indentation than) parentIndent
Expand All @@ -68,7 +68,7 @@ func isNestedUnder(currentLine, parentIndent string) bool {
// hasExitedBlock checks if we've left a YAML block (found a line with same or less indentation that's a key)
func hasExitedBlock(line, blockIndent string) bool {
trimmed := strings.TrimSpace(line)
if len(trimmed) == 0 {
if trimmed == "" {
return false
}

Expand Down Expand Up @@ -206,7 +206,7 @@ func removeFieldFromBlock(lines []string, fieldName string, parentBlock string)
// Skip nested properties under the field (lines with greater indentation)
if inFieldBlock {
// Empty lines within the field block should be removed
if len(trimmedLine) == 0 {
if trimmedLine == "" {
continue
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/console/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func PromptSecretInput(title, description string) (string, error) {
Description(description).
EchoMode(huh.EchoModePassword). // Masks input for security
Validate(func(s string) error {
if len(s) == 0 {
if s == "" {
return errors.New("value cannot be empty")
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/gitutil/gitutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func IsAuthError(errMsg string) bool {
// IsHexString checks if a string contains only hexadecimal characters.
// This is used to validate Git commit SHAs and other hexadecimal identifiers.
func IsHexString(s string) bool {
if len(s) == 0 {
if s == "" {
return false
}
for _, c := range s {
Expand Down
2 changes: 1 addition & 1 deletion pkg/parser/github_urls.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ const (
func isValidGitHubNameWithMaxLength(s string, maxLength int) bool {
// GitHub identifiers can contain alphanumeric characters, hyphens, and underscores.
// They cannot start or end with a hyphen.
if len(s) == 0 || len(s) > maxLength {
if s == "" || len(s) > maxLength {
return false
}
if s[0] == '-' || s[len(s)-1] == '-' {
Expand Down
2 changes: 1 addition & 1 deletion pkg/parser/import_directive.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func ParseImportDirective(line string) *ImportDirectiveMatch {
trimmedLine := strings.TrimSpace(line)

// Fast-path: import directives must start with '@' or '{'; skip the regex for all other lines.
if len(trimmedLine) == 0 || (trimmedLine[0] != '@' && trimmedLine[0] != '{') {
if trimmedLine == "" || (trimmedLine[0] != '@' && trimmedLine[0] != '{') {
return nil
}

Expand Down
Loading
Loading