Skip to content

Conversation

skitt
Copy link

@skitt skitt commented Sep 19, 2025

The documentation currently indicates that enable-checks and disabled-checks can't be combined for gocritic. That is however not accurate: as per InferEnabledChecks in the gocritic wrapper,

  • if enable-all is set, all available checks are added to the set of enabled checks
  • otherwise, unless disable-all is set, the default checks are added to the set of enabled checks
  • then the checks corresponding to each enabled tag are added
  • then all enabled checks are added (with a warning if a check is enabled multiple times)
  • then the checks corresponding to each disabled tag are removed
  • finally, all disabled checks are removed (with a warning if a check wasn't enabled)

Using both enabled-checks and disabled-checks is useful when keeping the default set of checks as reference.

This adjusts the documentation to match the implementation.

related to #4458

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link

boring-cyborg bot commented Sep 19, 2025

Hey, thank you for opening your first Pull Request !

@ldez ldez changed the title gocritic enabled-checks and disabled-checks can be combined docs: gocritic enabled-checks and disabled-checks can be combined Sep 19, 2025
@ldez ldez self-requested a review September 19, 2025 14:05
@ldez ldez added area: docs enhancement New feature or improvement labels Sep 19, 2025
The documentation currently indicates that enable-checks and
disabled-checks can't be combined for gocritic. That is however not
accurate: as per InferEnabledChecks in the gocritic wrapper,

* if enable-all is set, all available checks are added to the set of
  enabled checks
* otherwise, unless disable-all is set, the default checks are added
  to the set of enabled checks
* then the checks corresponding to each enabled tag are added
* then all enabled checks are added (with a warning if a check is
  enabled multiple times)
* then the checks corresponding to each disabled tag are removed
* finally, all disabled checks are removed (with a warning if a check
  wasn't enabled)

Using both enabled-checks and disabled-checks is useful when keeping
the default set of checks as reference.

This adjusts the documentation to match the implementation.

Signed-off-by: Stephen Kitt <[email protected]>
@skitt skitt force-pushed the gocritic-combinations branch from 28dd63d to 0d6e043 Compare September 19, 2025 14:07
@ldez
Copy link
Member

ldez commented Sep 19, 2025

Hello @skitt, could you sign the CLA?

@skitt
Copy link
Author

skitt commented Sep 19, 2025

Hello @skitt, could you sign the CLA?

Sorry, I missed that part of the contribution workflow — I’ll have to get approval from our legal department.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: docs enhancement New feature or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants