Skip to content

[meshkit] fix lint#921

Merged
leecalcote merged 3 commits intomeshery:masterfrom
Amr-Shams:bug/nightbird/915
Mar 12, 2026
Merged

[meshkit] fix lint#921
leecalcote merged 3 commits intomeshery:masterfrom
Amr-Shams:bug/nightbird/915

Conversation

@Amr-Shams
Copy link
Contributor

Description
This PR fixes #915.

Lint checks

  • make check passed (golangci-lint -c .golangci.yml)
  • Enabled linters: cyclop, goconst, govet, staticcheck, unused
  • cyclop max complexity: 45
  • goconst: min-len=3, min-occurrences=10
  • staticcheck: all except ST1005, ST1000, ST1003, ST1016, ST1020, ST1021, ST1022
  • Issue caps respected: max-issues-per-linter=30, max-same-issues=5

Notes for Reviewers
N/A

Signed commits

  • Yes, I signed my commits.

@welcome
Copy link

welcome bot commented Mar 2, 2026

Yay, your first pull request! 👍 A contributor will be by to give feedback soon. In the meantime, you can find updates in the #github-notifications channel in the community Slack.
Be sure to double-check that you have signed your commits. Here are instructions for making signing an implicit activity while performing a commit.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the project's linting setup by overhauling the .golangci.yml configuration. The primary goal is to enhance code quality and consistency by activating a broader range of linters and customizing their rules. This change ensures that the codebase adheres to more rigorous standards, catching potential issues earlier in the development cycle without introducing excessive noise from non-essential files.

Highlights

  • Linter Configuration Update: The .golangci.yml configuration has been significantly updated to enable a more comprehensive set of linters and fine-tune their behavior.
  • Enabled New Linters: The cyclop, goconst, govet, staticcheck, and unused linters have been explicitly enabled to enforce stricter code quality standards.
  • Linter Specific Settings: Detailed settings have been applied for cyclop (max complexity), goconst (min length and occurrences), staticcheck (expanded checks and exclusions), and unused (exported fields handling).
  • Issue Thresholds Defined: Global issue thresholds max-issues-per-linter and max-same-issues have been set to manage the volume of reported linting issues.
  • Path Exclusions Added: Specific directories like vendor, bundle, config, hack, helpers, and img have been excluded from linting checks to focus on relevant source code.
Changelog
  • .golangci.yml
    • Added tests: false to the run section to prevent linting of test files.
    • Replaced the linters-settings block with a more structured linters section.
    • Enabled cyclop, goconst, govet, staticcheck, and unused linters.
    • Disabled the wsl linter.
    • Introduced exclusions for various paths, including vendor and hack directories.
    • Configured cyclop with max-complexity: 45.
    • Set goconst with min-len: 3 and min-occurrences: 10.
    • Expanded staticcheck checks to include all while excluding specific ST codes.
    • Configured unused to set exported-fields-are-used: false.
    • Updated the issues section to include max-issues-per-linter: 30 and max-same-issues: 5.
Activity
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the .golangci.yml configuration to be more explicit and structured. The changes are mostly good, but there's a misconfiguration in how directories are excluded from linting. I've added a comment with a suggestion to correct the configuration file structure.

Comment on lines +5 to +24
tests: false

linters-settings:
staticcheck:
go: "1.25"
checks: ["all", "-ST1005"]
linters:
default: none
enable:
- cyclop
- goconst
- govet
- staticcheck
- unused
disable:
- wsl
exclusions:
paths:
- vendor
- bundle
- config
- hack
- helpers
- img
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The exclusions key is not a valid configuration option under the linters section in golangci-lint. To exclude directories from being linted, you should use the skip-dirs key under the run section. The current configuration will not exclude the specified directories, which may lead to unexpected linting errors.

  tests: false
  skip-dirs:
    - vendor
    - bundle
    - config
    - hack
    - helpers
    - img

linters:
  default: none
  enable:
    - cyclop
    - goconst
    - govet
    - staticcheck
    - unused
  disable:
    - wsl

@leecalcote
Copy link
Member

Thank you, @Amr-Shams. 👍

@leecalcote
Copy link
Member

@Amr-Shams, there are a couple of lint checks failing - https://github.com/meshery/meshkit/actions/runs/22575597871/job/65455626794?pr=921. I think these were failing previously. Before we make changes to add more lint checks, let's ensure that we have the current set in a passing state. There is an open PR on this that you can review - #922

Copy link
Member

@leecalcote leecalcote left a comment

Choose a reason for hiding this comment

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

Pending #922

Signed-off-by: Amr-Shams <amr.shams2015.as@gmail.com>
@Amr-Shams Amr-Shams force-pushed the bug/nightbird/915 branch from ae5213e to c2fb80b Compare March 3, 2026 13:16
@Amr-Shams
Copy link
Contributor Author

Amr-Shams commented Mar 3, 2026

Pending #922

Thanks @leecalcote! I see that #922 has been merged. I will pull the latest changes from master, resolve the merge conflicts in .golangci.yml

Amr-Shams and others added 2 commits March 3, 2026 21:47
Signed-off-by: Mericio <218162243+simihablo@users.noreply.github.com>
@leecalcote leecalcote merged commit c1541a6 into meshery:master Mar 12, 2026
1 check passed
@welcome
Copy link

welcome bot commented Mar 12, 2026

Thanks for your contribution to Meshery! 🎉

Meshery Logo
        Join the community, if you haven't yet and please leave a ⭐ star on the project. 😄

@leecalcote
Copy link
Member

Thanks, @Amr-Shams! 💯

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.

golangci linter is failing

3 participants