Skip to content

Rename GolangCI GHA Job, add lint target to Makefile#1081

Merged
aknysh merged 3 commits intomainfrom
golangci-make
Feb 20, 2025
Merged

Rename GolangCI GHA Job, add lint target to Makefile#1081
aknysh merged 3 commits intomainfrom
golangci-make

Conversation

@osterman
Copy link
Member

@osterman osterman commented Feb 20, 2025

what

  • Add a lint target to the Makefile
  • Pass GITHUB_SECRET explicitly
  • Only comment on code additions
  • Format job name with [lint] prefix
  • Updated Dockerfile job name too match
  • Set limits for the maximum statements per function and maximum functions per file

why

  • Job name didn't match other linting jobs
  • Make target is easier to run locally
  • Our files are too large, which leads to more and more merge conflicts
  • Our functions are too large, which increases the cognitive load required to understand what's going on

Summary by CodeRabbit

  • Chores
    • Enhanced automated code quality checks for improved clarity and efficiency.
    • Introduced a new command option to verify Go source files tracked in version control.

@osterman osterman requested a review from a team as a code owner February 20, 2025 16:06
@osterman osterman added the no-release Do not create a new release (wait for additional code changes) label Feb 20, 2025
@mergify
Copy link

mergify bot commented Feb 20, 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 Feb 20, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 20, 2025

Warning

Rate limit exceeded

@osterman has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 3 minutes and 59 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between efdedda and b981c4e.

📒 Files selected for processing (1)
  • .golangci.yml (1 hunks)
📝 Walkthrough

Walkthrough

This pull request refines the linting process in two distinct areas. In the GitHub Actions workflow file, the lint job has been renamed to "[lint] golangci" and now includes additional parameters for filtering linted files and GitHub token authentication. Additionally, a new lint target has been introduced in the Makefile to lint only the Go files tracked by Git. These modifications improve clarity and configuration without altering the overall workflow behavior.

Changes

File(s) Change Summary
.github/workflows/test.yml Renamed job from docker to [lint] Dockerfile and from lint-golangci to [lint] golangci. Added parameters: filter_mode: "added" and github_token: ${{ secrets.GITHUB_TOKEN }}.
Makefile Added a new lint target that uses git ls-files '*.go' to lint repository-tracked Go files.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant Repo as GitHub Repository
    participant CI as GitHub Actions
    participant Lint as golangci-lint

    Dev->>Repo: Push commit
    Repo->>CI: Trigger workflow
    CI->>Lint: Execute "[lint] golangci" with filter_mode "added" & GitHub token
    Lint-->>CI: Return lint results
    CI-->>Repo: Report workflow status
Loading
sequenceDiagram
    participant Dev as Developer
    participant Shell as Command Line
    participant Git as Git CLI
    participant Make as Makefile
    participant Lint as golangci-lint

    Dev->>Shell: Run `make lint`
    Shell->>Git: Execute `git ls-files '*.go'`
    Git-->>Shell: Return list of Go files
    Shell->>Make: Extract directories & sort uniques
    Make->>Lint: Run golangci-lint on directories
    Lint-->>Make: Return lint results
Loading

Possibly related PRs

  • Add GolangCI Lint Configuration for Better Code Quality #1078: The changes in the main PR, which involve renaming and adding parameters to the lint-golangci job in the GitHub Actions workflow, are related to the retrieved PR that introduced the lint-golangci job itself, as both modifications pertain to the same job within the same workflow file.
  • Add Windows & macOS Acceptance Tests #875: The changes in the main PR focus on renaming and enhancing linting jobs in the GitHub Actions workflow, while the retrieved PR modifies the same workflow file to implement a matrix strategy for various jobs, including the lint job, indicating a direct relationship in their modifications to the workflow.

Suggested labels

patch, minor

Suggested reviewers

  • aknysh

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 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 (1)
Makefile (1)

24-27: Lint Target Addition: Ensure Robustness in File Handling.
The new lint target is a great addition that leverages Git to limit linting to tracked Go files. One consideration: if any file paths contain spaces, the current pipeline using xargs -n1 dirname might misbehave. You might consider using options like -print0 with xargs -0 or adding quotes to safely handle such cases. Also, if no Go files are found, ensure that golangci-lint isn’t accidentally called with empty input.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 846e2f0 and 797d9f1.

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

481-481: Job Name Update Confirmation.
Renaming the job to [lint] golangci aligns well with the project’s linting conventions and improves clarity.


491-494: Enhanced Lint Job Parameters.
The addition of filter_mode: "added" and the explicit passing of github_token: ${{ secrets.GITHUB_TOKEN }} enhance the linting process by focusing on newly added files and ensuring authenticated API access. Confirm that the token variable matches the rest of the workflow usage for consistency.

coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 20, 2025
aknysh
aknysh previously approved these changes Feb 20, 2025
@osterman osterman dismissed stale reviews from aknysh and coderabbitai[bot] via b981c4e February 20, 2025 16:32
@aknysh aknysh merged commit 4b8c9c2 into main Feb 20, 2025
46 checks passed
@aknysh aknysh deleted the golangci-make branch February 20, 2025 18:46
@mergify mergify bot removed the needs-cloudposse Needs Cloud Posse assistance label Feb 20, 2025
@coderabbitai coderabbitai bot mentioned this pull request Feb 20, 2025
@github-actions
Copy link

These changes were released in v1.163.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-release Do not create a new release (wait for additional code changes)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants