Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: format code by gofumpt #982

Closed

Conversation

suzuki-shunsuke
Copy link
Collaborator

@suzuki-shunsuke suzuki-shunsuke commented Jan 29, 2025

what

https://github.com/mvdan/gofumpt

$ gofumpt --version
v0.7.0 (go1.23.0)
git ls-files | grep -E "\.go$" |
  xargs gofumpt -l -s -w

why

references

Summary by CodeRabbit

Release Notes

  • New Features

    • Added a new GitHub Actions job to check code formatting.
    • Introduced Aqua configuration for CLI tool version management.
  • Improvements

    • Updated file permission syntax across multiple files using 0o prefix.
    • Simplified variable declarations using shorthand := syntax.
    • Enhanced error handling in various components.
    • Improved documentation for CLI commands.
  • Code Maintenance

    • Refactored error handling in multiple functions.
    • Reorganized import statements.
    • Updated syntax for octal literals.
    • Removed unnecessary comments and blank lines.
  • Testing

    • Added new test coverage for code formatting.
    • Updated test utilities and configurations.

These changes focus on improving code quality, maintainability, and developer experience without introducing significant functional changes.

Unverified

This user has not yet uploaded their public signing key.
https://github.com/mvdan/gofumpt

```sh
git ls-files | grep -E "\.go$" |
  xargs gofumpt -l -s -w
```
@suzuki-shunsuke suzuki-shunsuke requested a review from a team as a code owner January 29, 2025 11:41
@mergify mergify bot added the triage Needs triage label Jan 29, 2025
Copy link
Contributor

coderabbitai bot commented Jan 29, 2025

📝 Walkthrough

Pull Request Analysis

Walkthrough

This pull request encompasses a comprehensive set of changes across multiple files in the Atmos project, focusing primarily on syntactical improvements, variable declaration refinements, and minor error handling modifications. The changes span various packages and include updates to file permission representations, import statements, and code organization. The modifications are predominantly stylistic and do not significantly alter the core functionality of the codebase.

Changes

File/Path Change Summary
cmd/* Updated variable declarations from var to := syntax for conciseness and readability.
internal/exec/* Removed error handling lines, updated file permission syntax to use 0o prefix for octal literals.
pkg/* Refined variable declarations, updated octal permission literals to the new syntax.
.github/workflows/test.yml Added new fmt job for code formatting checks using gofumpt.
aqua.yaml New configuration file for Aqua, defining CLI version management.
Makefile Introduced a new target fmt for formatting Go source files.

Possibly related PRs

Suggested Labels

patch, minor, no-release

Suggested Reviewers

  • osterman
  • aknysh

With these changes, we march towards a more polished and consistent codebase! 🛡️ While not a monumental shift, these updates enhance our syntax and organization, making our code easier to read and maintain. Let's keep the momentum going! 💪


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5e01f55 and 18b3f31.

📒 Files selected for processing (1)
  • .github/workflows/test.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/test.yml
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Summary

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary or @auto-summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @auto-title anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

coderabbitai bot commented Jan 29, 2025

📝 Walkthrough

Walkthrough

This pull request encompasses a comprehensive set of changes across multiple files in the Atmos project, focusing primarily on code style improvements, syntax modernization, and minor refactoring. The modifications span variable declarations, error handling, file permission representations, and import statement organization. The changes do not introduce significant functional alterations but aim to enhance code readability, consistency, and align with modern Go coding practices.

Changes

File/Path Change Summary
cmd/ files Standardized variable declarations using := syntax, grouped variable declarations, and enhanced command descriptions
internal/exec/ files Updated file permission modes from 0644 to 0o644, simplified error handling, and removed redundant code blocks
pkg/ files Modernized octal literal syntax, reorganized import statements, and streamlined variable declarations
go.mod Added golang.org/x/sync v0.10.0 dependency

Possibly related PRs

Suggested Labels

no-release

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary or @auto-summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @auto-title anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Sorry, something went wrong.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
internal/exec/terraform_clean.go (2)

Line range hint 231-252: Consider making theme colors configurable.

The hardcoded colors (#FFFDF5, #5B00FF) might not be optimal for all terminal themes and color schemes. Consider extracting these into theme configuration variables.

-    cream := lipgloss.AdaptiveColor{Light: "#FFFDF5", Dark: "#FFFDF5"}
-    purple := lipgloss.AdaptiveColor{Light: "#5B00FF", Dark: "#5B00FF"}
+    cream := theme.Colors.Cream
+    purple := theme.Colors.Purple

Line range hint 381-476: Consider breaking down this function for better maintainability.

The function is handling multiple responsibilities:

  1. Path validation and preparation
  2. File collection
  3. User confirmation
  4. Deletion execution

Consider extracting these into separate functions for better maintainability and testability.

Example refactoring structure:

func handleCleanSubCommand(info schema.ConfigAndStacksInfo, componentPath string, atmosConfig schema.AtmosConfiguration) error {
    if info.SubCommand != "clean" {
        return nil
    }
    
    cleanPath, relativePath, err := prepareCleanPaths(info, componentPath, atmosConfig)
    if err != nil {
        return err
    }
    
    folders, err := collectFilesToDelete(info, cleanPath, atmosConfig)
    if err != nil {
        return err
    }
    
    if err := handleUserConfirmation(info, folders, atmosConfig); err != nil {
        return err
    }
    
    return executeDelete(folders, relativePath, atmosConfig)
}
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 255a05a and 9638fae.

📒 Files selected for processing (71)
  • cmd/cmd_utils.go (6 hunks)
  • cmd/colored/colored.go (0 hunks)
  • cmd/describe_config.go (0 hunks)
  • cmd/describe_stacks.go (0 hunks)
  • cmd/helmfile_apply.go (1 hunks)
  • cmd/helmfile_destroy.go (1 hunks)
  • cmd/helmfile_diff.go (1 hunks)
  • cmd/helmfile_sync.go (1 hunks)
  • cmd/root.go (0 hunks)
  • cmd/validate_editorconfig.go (1 hunks)
  • go.mod (1 hunks)
  • internal/exec/atlantis_generate_repo_config.go (1 hunks)
  • internal/exec/atlantis_utils.go (0 hunks)
  • internal/exec/config_sources_utils.go (0 hunks)
  • internal/exec/describe_affected_utils.go (0 hunks)
  • internal/exec/describe_dependents.go (1 hunks)
  • internal/exec/describe_stacks.go (0 hunks)
  • internal/exec/describe_workflows.go (1 hunks)
  • internal/exec/file_utils.go (2 hunks)
  • internal/exec/helmfile.go (1 hunks)
  • internal/exec/helmfile_generate_varfile.go (1 hunks)
  • internal/exec/pro.go (0 hunks)
  • internal/exec/shell_utils.go (2 hunks)
  • internal/exec/spacelift_utils.go (0 hunks)
  • internal/exec/stack_processor_utils.go (2 hunks)
  • internal/exec/stack_utils.go (0 hunks)
  • internal/exec/template_funcs_component.go (1 hunks)
  • internal/exec/template_funcs_gomplate_datasource.go (1 hunks)
  • internal/exec/terraform.go (3 hunks)
  • internal/exec/terraform_clean.go (3 hunks)
  • internal/exec/terraform_generate_backend.go (2 hunks)
  • internal/exec/terraform_generate_backends.go (2 hunks)
  • internal/exec/terraform_generate_varfile.go (1 hunks)
  • internal/exec/terraform_generate_varfiles.go (1 hunks)
  • internal/exec/terraform_outputs.go (3 hunks)
  • internal/exec/utils.go (26 hunks)
  • internal/exec/validate_stacks.go (1 hunks)
  • internal/exec/validate_utils.go (0 hunks)
  • internal/exec/vendor.go (1 hunks)
  • internal/exec/vendor_model.go (1 hunks)
  • internal/exec/vendor_model_component.go (1 hunks)
  • internal/exec/vendor_utils.go (0 hunks)
  • internal/exec/workflow_utils.go (4 hunks)
  • internal/exec/yaml_func_exec.go (0 hunks)
  • internal/exec/yaml_func_store.go (0 hunks)
  • internal/exec/yaml_func_template.go (0 hunks)
  • internal/exec/yaml_func_utils.go (0 hunks)
  • pkg/aws/aws_eks_update_kubeconfig.go (0 hunks)
  • pkg/component/component_processor.go (0 hunks)
  • pkg/config/cache.go (1 hunks)
  • pkg/config/config.go (0 hunks)
  • pkg/config/utils.go (1 hunks)
  • pkg/describe/describe_stacks.go (0 hunks)
  • pkg/hooks/store.go (0 hunks)
  • pkg/list/list_workflows_test.go (6 hunks)
  • pkg/logger/logger.go (1 hunks)
  • pkg/pro/api_client.go (0 hunks)
  • pkg/spacelift/spacelift_stack_processor.go (0 hunks)
  • pkg/spacelift/spacelift_stack_processor_test.go (2 hunks)
  • pkg/stack/stack_processor_test.go (1 hunks)
  • pkg/store/artifactory_store.go (0 hunks)
  • pkg/store/artifactory_store_test.go (1 hunks)
  • pkg/store/aws_ssm_param_store.go (0 hunks)
  • pkg/utils/glob_utils.go (1 hunks)
  • pkg/utils/hcl_utils.go (1 hunks)
  • pkg/utils/highlight_utils.go (1 hunks)
  • pkg/utils/log_utils.go (1 hunks)
  • pkg/utils/version_utils.go (1 hunks)
  • pkg/utils/yaml_utils.go (1 hunks)
  • pkg/vender/vendor_config_test.go (4 hunks)
  • tests/cli_test.go (2 hunks)
💤 Files with no reviewable changes (26)
  • pkg/hooks/store.go
  • pkg/aws/aws_eks_update_kubeconfig.go
  • internal/exec/atlantis_utils.go
  • internal/exec/yaml_func_template.go
  • internal/exec/yaml_func_store.go
  • internal/exec/yaml_func_utils.go
  • pkg/pro/api_client.go
  • pkg/config/config.go
  • internal/exec/yaml_func_exec.go
  • pkg/store/artifactory_store.go
  • internal/exec/validate_utils.go
  • internal/exec/spacelift_utils.go
  • cmd/describe_stacks.go
  • pkg/store/aws_ssm_param_store.go
  • internal/exec/pro.go
  • internal/exec/config_sources_utils.go
  • cmd/root.go
  • pkg/describe/describe_stacks.go
  • internal/exec/stack_utils.go
  • pkg/component/component_processor.go
  • pkg/spacelift/spacelift_stack_processor.go
  • cmd/describe_config.go
  • internal/exec/vendor_utils.go
  • cmd/colored/colored.go
  • internal/exec/describe_stacks.go
  • internal/exec/describe_affected_utils.go
✅ Files skipped from review due to trivial changes (32)
  • internal/exec/vendor_model.go
  • pkg/utils/log_utils.go
  • internal/exec/template_funcs_component.go
  • pkg/logger/logger.go
  • internal/exec/terraform_generate_varfile.go
  • pkg/config/cache.go
  • internal/exec/helmfile_generate_varfile.go
  • pkg/utils/hcl_utils.go
  • internal/exec/validate_stacks.go
  • pkg/utils/glob_utils.go
  • internal/exec/describe_dependents.go
  • cmd/validate_editorconfig.go
  • internal/exec/template_funcs_gomplate_datasource.go
  • internal/exec/terraform_generate_varfiles.go
  • internal/exec/vendor.go
  • pkg/utils/yaml_utils.go
  • internal/exec/terraform_generate_backends.go
  • pkg/utils/highlight_utils.go
  • internal/exec/vendor_model_component.go
  • internal/exec/atlantis_generate_repo_config.go
  • internal/exec/helmfile.go
  • internal/exec/terraform.go
  • internal/exec/terraform_outputs.go
  • tests/cli_test.go
  • pkg/list/list_workflows_test.go
  • internal/exec/terraform_generate_backend.go
  • cmd/helmfile_destroy.go
  • pkg/spacelift/spacelift_stack_processor_test.go
  • pkg/vender/vendor_config_test.go
  • internal/exec/shell_utils.go
  • pkg/config/utils.go
  • internal/exec/utils.go
🧰 Additional context used
📓 Learnings (2)
cmd/cmd_utils.go (2)
Learnt from: samtholiya
PR: cloudposse/atmos#914
File: cmd/root.go:172-178
Timestamp: 2025-01-18T15:18:35.475Z
Learning: The `showUsageAndExit` function in `cmd/cmd_utils.go` provides user feedback by showing error messages, command suggestions, and valid subcommands before terminating the program with `os.Exit(1)`. It never returns to the caller, making error handling unnecessary for calls to this function.
Learnt from: samtholiya
PR: cloudposse/atmos#914
File: cmd/root.go:172-178
Timestamp: 2025-01-18T15:18:35.475Z
Learning: The `showUsageAndExit` function in `cmd/cmd_utils.go` terminates the program with `os.Exit(1)` and never returns to the caller, making error handling unnecessary for calls to this function.
internal/exec/terraform_clean.go (1)
Learnt from: haitham911
PR: cloudposse/atmos#727
File: internal/exec/terraform_clean.go:215-223
Timestamp: 2024-11-12T05:52:05.088Z
Learning: In `internal/exec/terraform_clean.go`, the function `determineCleanPath` is necessary and should not be removed.
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Summary
🔇 Additional comments (18)
pkg/store/artifactory_store_test.go (2)

44-44: LGTM! Modern octal syntax for directory permissions.

The update to 0o755 follows modern Go conventions for octal literals while maintaining the standard Unix directory permissions (rwxr-xr-x).


50-50: LGTM! Modern octal syntax for file permissions.

The update to 0o644 follows modern Go conventions for octal literals while maintaining the standard Unix file permissions (rw-r--r--).

internal/exec/file_utils.go (1)

45-45: LGTM! Clean modernization of octal permission notation.

The update from 0644 to 0o644 follows modern Go conventions for explicit octal notation. This change improves code clarity while maintaining identical functionality. Keep up the good work, warrior! 💪

Also applies to: 58-58

cmd/helmfile_diff.go (1)

8-16: Clean and idiomatic variable grouping!

The grouping of related variables within a single var block follows Go best practices and improves code organization. The documentation strings are well-formatted and provide clear examples.

cmd/helmfile_apply.go (1)

8-16: Consistent formatting maintained!

The variable grouping and documentation format mirror the changes in helmfile_diff.go, maintaining consistency across the codebase.

cmd/helmfile_sync.go (1)

6-14: Well-structured variable declarations!

The formatting changes maintain consistency with other command files, following the same clean pattern of grouped variable declarations.

internal/exec/workflow_utils.go (1)

29-29: Streamlined variable declarations!

The switch to := operator for variable declarations makes the code more concise and idiomatic. The changes maintain functionality while improving readability.

Also applies to: 64-65, 80-82, 211-211

pkg/stack/stack_processor_test.go (1)

41-41: LGTM! Clean variable declaration.

The change to use := instead of var makes the code more concise while maintaining readability.

cmd/cmd_utils.go (3)

65-65: LGTM! Clean variable declaration.

The change to use := for customCommand improves code conciseness.


135-135: LGTM! Clean variable declaration.

The change to use := for aliasCommand enhances readability.


Line range hint 173-196: LGTM! Clean argument validation logic.

The argument validation logic is well-structured with clear error messages.

pkg/utils/version_utils.go (1)

21-22: LGTM! Improved readability.

Breaking down the links slice initialization into multiple lines enhances code readability.

go.mod (1)

58-58: LGTM! Explicit dependency declaration.

Making golang.org/x/sync a direct dependency improves dependency management clarity.

internal/exec/stack_processor_utils.go (2)

1640-1641: Function signature update looks consistent.

Passing componentStackMap here is helpful. Verify if all callers account for this new parameter.


1675-1676: Function signature update checks out.

Adding stackImports as a parameter is logical. Ensure all call sites have been updated.

internal/exec/describe_workflows.go (1)

5-5: Import statement reintroduction is fine.

The import u "github.com/cloudposse/atmos/pkg/utils" is beneficial for evaluating queries. Good addition!

internal/exec/terraform_clean.go (2)

Line range hint 346-364: LGTM! Clean and well-structured implementation.

The function effectively handles different scenarios and follows Go best practices.


Line range hint 365-380: LGTM! Robust security checks implemented.

The function implements essential security validations:

  • Prevents root directory deletion
  • Blocks paths with relative components
  • Validates empty values

This helps prevent accidental or malicious deletions.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
internal/exec/stack_processor_utils.go (2)

1640-1641: Add doc references for new parameter
These lines add a new parameter but lack documentation updates. A brief explanation in the function comment about componentStackMap would improve clarity.

You can update the doc as follows:

-// FindComponentStacks finds all infrastructure stack manifests where the component or the base component is defined
+// FindComponentStacks finds all infrastructure stack manifests where the component or the base component is defined.
// componentStackMap provides a lookup of known stacks for each component type.
 func FindComponentStacks(
 	componentType string,
 	component string,
 	baseComponent string,
 	componentStackMap map[string]map[string][]string,
 ) ([]string, error) {

1675-1676: Extend doc for new parameter
These lines introduce a new parameter stackImports that is not mentioned in the function comment. Expand the doc to mention its purpose.

Proposed update:

-// FindComponentDependenciesLegacy finds all imports where the component or the base component(s) are defined
+// FindComponentDependenciesLegacy finds all imports where the component or the base component(s) are defined.
// stackImports holds the imported stack configurations used for determining dependencies.
 func FindComponentDependenciesLegacy(
 	stack string,
 	componentType string,
 	component string,
 	baseComponents []string,
 	stackImports map[string]map[string]any,
 ) ([]string, error) {
internal/exec/terraform_clean.go (1)

Line range hint 365-379: LGTM! Robust security checks for data directory.

Essential security validations:

  • Prevents root directory deletion
  • Blocks path traversal attacks
  • Validates environment variable

Consider adding these additional security checks:

  1. Check for symbolic links that might point to sensitive locations
  2. Validate absolute path doesn't contain sensitive system directories
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 255a05a and 9638fae.

📒 Files selected for processing (71)
  • cmd/cmd_utils.go (6 hunks)
  • cmd/colored/colored.go (0 hunks)
  • cmd/describe_config.go (0 hunks)
  • cmd/describe_stacks.go (0 hunks)
  • cmd/helmfile_apply.go (1 hunks)
  • cmd/helmfile_destroy.go (1 hunks)
  • cmd/helmfile_diff.go (1 hunks)
  • cmd/helmfile_sync.go (1 hunks)
  • cmd/root.go (0 hunks)
  • cmd/validate_editorconfig.go (1 hunks)
  • go.mod (1 hunks)
  • internal/exec/atlantis_generate_repo_config.go (1 hunks)
  • internal/exec/atlantis_utils.go (0 hunks)
  • internal/exec/config_sources_utils.go (0 hunks)
  • internal/exec/describe_affected_utils.go (0 hunks)
  • internal/exec/describe_dependents.go (1 hunks)
  • internal/exec/describe_stacks.go (0 hunks)
  • internal/exec/describe_workflows.go (1 hunks)
  • internal/exec/file_utils.go (2 hunks)
  • internal/exec/helmfile.go (1 hunks)
  • internal/exec/helmfile_generate_varfile.go (1 hunks)
  • internal/exec/pro.go (0 hunks)
  • internal/exec/shell_utils.go (2 hunks)
  • internal/exec/spacelift_utils.go (0 hunks)
  • internal/exec/stack_processor_utils.go (2 hunks)
  • internal/exec/stack_utils.go (0 hunks)
  • internal/exec/template_funcs_component.go (1 hunks)
  • internal/exec/template_funcs_gomplate_datasource.go (1 hunks)
  • internal/exec/terraform.go (3 hunks)
  • internal/exec/terraform_clean.go (3 hunks)
  • internal/exec/terraform_generate_backend.go (2 hunks)
  • internal/exec/terraform_generate_backends.go (2 hunks)
  • internal/exec/terraform_generate_varfile.go (1 hunks)
  • internal/exec/terraform_generate_varfiles.go (1 hunks)
  • internal/exec/terraform_outputs.go (3 hunks)
  • internal/exec/utils.go (26 hunks)
  • internal/exec/validate_stacks.go (1 hunks)
  • internal/exec/validate_utils.go (0 hunks)
  • internal/exec/vendor.go (1 hunks)
  • internal/exec/vendor_model.go (1 hunks)
  • internal/exec/vendor_model_component.go (1 hunks)
  • internal/exec/vendor_utils.go (0 hunks)
  • internal/exec/workflow_utils.go (4 hunks)
  • internal/exec/yaml_func_exec.go (0 hunks)
  • internal/exec/yaml_func_store.go (0 hunks)
  • internal/exec/yaml_func_template.go (0 hunks)
  • internal/exec/yaml_func_utils.go (0 hunks)
  • pkg/aws/aws_eks_update_kubeconfig.go (0 hunks)
  • pkg/component/component_processor.go (0 hunks)
  • pkg/config/cache.go (1 hunks)
  • pkg/config/config.go (0 hunks)
  • pkg/config/utils.go (1 hunks)
  • pkg/describe/describe_stacks.go (0 hunks)
  • pkg/hooks/store.go (0 hunks)
  • pkg/list/list_workflows_test.go (6 hunks)
  • pkg/logger/logger.go (1 hunks)
  • pkg/pro/api_client.go (0 hunks)
  • pkg/spacelift/spacelift_stack_processor.go (0 hunks)
  • pkg/spacelift/spacelift_stack_processor_test.go (2 hunks)
  • pkg/stack/stack_processor_test.go (1 hunks)
  • pkg/store/artifactory_store.go (0 hunks)
  • pkg/store/artifactory_store_test.go (1 hunks)
  • pkg/store/aws_ssm_param_store.go (0 hunks)
  • pkg/utils/glob_utils.go (1 hunks)
  • pkg/utils/hcl_utils.go (1 hunks)
  • pkg/utils/highlight_utils.go (1 hunks)
  • pkg/utils/log_utils.go (1 hunks)
  • pkg/utils/version_utils.go (1 hunks)
  • pkg/utils/yaml_utils.go (1 hunks)
  • pkg/vender/vendor_config_test.go (4 hunks)
  • tests/cli_test.go (2 hunks)
💤 Files with no reviewable changes (26)
  • pkg/hooks/store.go
  • pkg/describe/describe_stacks.go
  • cmd/root.go
  • internal/exec/yaml_func_template.go
  • pkg/aws/aws_eks_update_kubeconfig.go
  • internal/exec/yaml_func_store.go
  • internal/exec/yaml_func_utils.go
  • internal/exec/pro.go
  • cmd/describe_config.go
  • pkg/component/component_processor.go
  • pkg/store/artifactory_store.go
  • pkg/pro/api_client.go
  • internal/exec/yaml_func_exec.go
  • internal/exec/atlantis_utils.go
  • cmd/describe_stacks.go
  • pkg/config/config.go
  • internal/exec/spacelift_utils.go
  • pkg/store/aws_ssm_param_store.go
  • internal/exec/vendor_utils.go
  • pkg/spacelift/spacelift_stack_processor.go
  • internal/exec/describe_affected_utils.go
  • cmd/colored/colored.go
  • internal/exec/validate_utils.go
  • internal/exec/stack_utils.go
  • internal/exec/config_sources_utils.go
  • internal/exec/describe_stacks.go
✅ Files skipped from review due to trivial changes (31)
  • internal/exec/vendor_model.go
  • internal/exec/validate_stacks.go
  • internal/exec/file_utils.go
  • internal/exec/helmfile_generate_varfile.go
  • pkg/logger/logger.go
  • pkg/utils/highlight_utils.go
  • internal/exec/template_funcs_gomplate_datasource.go
  • pkg/utils/hcl_utils.go
  • internal/exec/vendor.go
  • internal/exec/terraform_outputs.go
  • pkg/utils/yaml_utils.go
  • internal/exec/terraform.go
  • internal/exec/atlantis_generate_repo_config.go
  • cmd/validate_editorconfig.go
  • pkg/utils/glob_utils.go
  • internal/exec/workflow_utils.go
  • pkg/list/list_workflows_test.go
  • internal/exec/describe_dependents.go
  • internal/exec/terraform_generate_varfiles.go
  • internal/exec/helmfile.go
  • cmd/helmfile_destroy.go
  • internal/exec/template_funcs_component.go
  • internal/exec/terraform_generate_varfile.go
  • pkg/utils/log_utils.go
  • pkg/config/cache.go
  • pkg/vender/vendor_config_test.go
  • internal/exec/terraform_generate_backends.go
  • internal/exec/vendor_model_component.go
  • internal/exec/shell_utils.go
  • pkg/spacelift/spacelift_stack_processor_test.go
  • internal/exec/utils.go
🧰 Additional context used
📓 Learnings (2)
cmd/cmd_utils.go (2)
Learnt from: samtholiya
PR: cloudposse/atmos#914
File: cmd/root.go:172-178
Timestamp: 2025-01-18T15:18:35.475Z
Learning: The `showUsageAndExit` function in `cmd/cmd_utils.go` provides user feedback by showing error messages, command suggestions, and valid subcommands before terminating the program with `os.Exit(1)`. It never returns to the caller, making error handling unnecessary for calls to this function.
Learnt from: samtholiya
PR: cloudposse/atmos#914
File: cmd/root.go:172-178
Timestamp: 2025-01-18T15:18:35.475Z
Learning: The `showUsageAndExit` function in `cmd/cmd_utils.go` terminates the program with `os.Exit(1)` and never returns to the caller, making error handling unnecessary for calls to this function.
internal/exec/terraform_clean.go (1)
Learnt from: haitham911
PR: cloudposse/atmos#727
File: internal/exec/terraform_clean.go:215-223
Timestamp: 2024-11-12T05:52:05.088Z
Learning: In `internal/exec/terraform_clean.go`, the function `determineCleanPath` is necessary and should not be removed.
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Summary
🔇 Additional comments (16)
pkg/store/artifactory_store_test.go (2)

44-44: LGTM! Modern octal notation for directory permissions.

The update to 0o755 follows current Go best practices for representing octal literals. This makes the code more explicit and readable while maintaining the same Unix-style directory permissions (rwxr-xr-x).


50-50: LGTM! Modern octal notation for file permissions.

The update to 0o644 aligns with Go's modern syntax for octal literals. This maintains the same Unix-style file permissions (rw-r--r--) while improving code clarity.

pkg/utils/version_utils.go (1)

21-22: Nice improvement to the upgrade message!

The addition of the installation link alongside the releases link provides better guidance for users looking to upgrade.

tests/cli_test.go (2)

29-33: Clean variable grouping!

The grouped variable declarations improve code organization and readability.


566-570: Good use of explicit octal notation!

The update to use 0o prefix for file permissions follows modern Go conventions and makes the code more explicit.

cmd/helmfile_diff.go (1)

8-16: Well done on improving the documentation and code organization!

The grouping of related variable declarations in a var block follows Go best practices, and the added example usage in the documentation makes it more user-friendly.

cmd/helmfile_apply.go (1)

8-16: Excellent consistency in documentation and formatting!

The changes maintain the same high-quality pattern seen in helmfile_diff.go, with clear examples and well-organized variable declarations.

cmd/helmfile_sync.go (1)

6-14: Great job emphasizing the safety aspects in documentation!

The changes maintain consistency with other files while adding crucial information about the non-destructive nature of the sync command. This helps prevent potential user mistakes.

internal/exec/describe_workflows.go (1)

5-6: Clean import organization!

The blank line separation and aliased import follow Go's standard formatting practices.

internal/exec/terraform_generate_backend.go (2)

Line range hint 78-83: LGTM! Idiomatic variable declaration.

The change to use := for variable declaration is more idiomatic Go and makes the code more concise.


90-90: LGTM! Modern octal notation.

The change to use 0o644 instead of 0644 for file permissions is more explicit and follows modern Go conventions.

pkg/stack/stack_processor_test.go (1)

Line range hint 41-50: LGTM! Idiomatic variable declaration in test.

The change to use := for multiple variable declaration is more idiomatic Go and improves readability.

internal/exec/terraform_clean.go (2)

Line range hint 231-252: LGTM! Well-implemented user confirmation dialog.

The function provides a good user experience with:

  • Clear confirmation message
  • Custom styling using Charm UI
  • Proper error handling for user abort

Line range hint 346-364: LGTM! Clean file selection logic.

Good separation of concerns with:

  • Clear conditional logic for different scenarios
  • Proper handling of flags
  • Consistent file patterns
cmd/cmd_utils.go (1)

65-65: LGTM! Consistent variable declaration style.

The changes to use := for variable declarations are:

  • More idiomatic Go
  • Consistent with other files
  • Improve code readability

Also applies to: 135-135, 313-313

pkg/config/utils.go (1)

27-27: LGTM! Clean variable declaration.

The change from var to := follows idiomatic Go style and improves readability.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 29, 2025
@mergify mergify bot removed the triage Needs triage label Jan 29, 2025

Unverified

This user has not yet uploaded their public signing key.
coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 29, 2025
@osterman
Copy link
Member

This is great! All for standardizing formatting.

To maintain it, though probably need an a CI validation.

Maybe something like this?

https://github.com/samlinville/vault/blob/4df5979116b3231157234c3a1eaed89d78028a7a/.circleci/config/jobs/fmt.yml#L3

Like we do with tidy:
https://github.com/cloudposse/atmos/blob/main/.github/workflows/test.yml#L75

Copy link

mergify bot commented Jan 29, 2025

Important

Cloud Posse Engineering Team Review Required

This pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes.

To expedite this process, reach out to us on Slack in the #pr-reviews channel.

@mergify mergify bot added the needs-cloudposse Needs Cloud Posse assistance label Jan 29, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
aqua.yaml (1)

1-9: Consider enabling checksum verification for better security.

The checksum configuration is currently commented out. Enabling it would add an extra layer of security by verifying package integrity.

-# checksum:
-#   enabled: true
-#   require_checksum: true
-#   supported_envs:
-#   - all
+checksum:
+  enabled: true
+  require_checksum: true
+  supported_envs:
+  - all
.github/workflows/test.yml (1)

79-87: Consider verifying the aqua installation.

While the installation steps are correct, adding a verification step would ensure aqua is properly installed.

      - name: Install gofumpt
        run: |
+         aqua -v
          gofumpt -version
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9638fae and dabf540.

📒 Files selected for processing (2)
  • .github/workflows/test.yml (1 hunks)
  • aqua.yaml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Build (windows-latest, windows)
  • GitHub Check: Build (ubuntu-latest, linux)
  • GitHub Check: Analyze (go)
  • GitHub Check: Summary
🔇 Additional comments (4)
aqua.yaml (2)

10-12: LGTM! Registry configuration is properly set up.

The standard registry is configured with a specific version, and the Renovate comment is correctly placed for automated updates.


13-14: LGTM! Package version matches PR requirements.

The gofumpt version (v0.7.0) is correctly specified and matches the PR description.

.github/workflows/test.yml (2)

75-78: LGTM! Job configuration is well structured.

The fmt job is properly configured to run on ubuntu-latest, which is appropriate for this task.


88-94: LGTM! Formatting check is robust and matches PR requirements.

The implementation:

  • Uses the exact command from PR description
  • Properly checks for formatting differences
  • Provides clear error message

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 29, 2025
@mergify mergify bot removed the triage Needs triage label Jan 29, 2025
@suzuki-shunsuke
Copy link
Collaborator Author

dabf540 Check if code is formatted using gofumpt via CI
5e01f55 Add a make task to format code using gofumpt

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 30, 2025
@osterman
Copy link
Member

So we have a lot of open PRs inflight. My concern is if we do this now, it will maybe a painful rebase?

Since this is largely an automated PR (meaning low human effort), I am inclined that we first merge some large PRs that are almost ready; or we only do the fmt job as part of this PR and restrict to files modified, and slowly start requiring modified files to be updated.

I could be overlooking something here... so leaning on your experience

@osterman
Copy link
Member

Also, what do you think about adding a fmt target in the 'Makefile` so we can simplify the instructions to developers on test failure? I looks like there are a number of arguments passed to the command.

@suzuki-shunsuke
Copy link
Collaborator Author

So we have a lot of open PRs inflight. My concern is if we do this now, it will maybe a painful rebase?

Since this is largely an automated PR (meaning low human effort), I am inclined that we first merge some large PRs that are almost ready; or we only do the fmt job as part of this PR and restrict to files modified, and slowly start requiring modified files to be updated.

I could be overlooking something here... so leaning on your experience

Good point! Thank you for your review.
I wrote a proposal about this.

Copy link

mergify bot commented Jan 30, 2025

💥 This pull request now has conflicts. Could you fix it @suzuki-shunsuke? 🙏

@mergify mergify bot added the conflict This PR has conflicts label Jan 30, 2025
Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]>
@suzuki-shunsuke
Copy link
Collaborator Author

We can close this pull request if we can merge #991 .

@mergify mergify bot removed conflict This PR has conflicts needs-cloudposse Needs Cloud Posse assistance labels Jan 31, 2025
@suzuki-shunsuke suzuki-shunsuke deleted the style-gofumpt branch January 31, 2025 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants