Skip to content

docs: remove examples with camelCase and lowercase options and keep only kebab-cased #1626

@alexandear

Description

@alexandear

In v1.8.0 (PR #1272), we allowed kebab-cased options. Kebab-case is now preferred for option naming because it's common across linters. For example, we use max-lit-count instead of camelCased maxLitCount.

In Golangci-lint, the vast majority of linters use kebab-case. See .golangci.reference.yml.

I propose simplifying RULES_DESCRIPTIONS.md by deleting examples that show lowercased and camelCased options. This would slightly simplify the documentation and make it more consistent.

What to do

  1. Remove camelCased and lowerCased options from the documentation (RULES_DESCRIPTIONS.md, README.md etc.).
  2. Add a section explaining that camelCased and lowerCased options are still supported for all rules, but are deprecated and should be avoided.
  3. Do not touch code or tests for now. In the future, we plan to stop supporting camelCase completely, but for now it should remain supported.

Example

The documentation for the add-constant rule should be as follows:

Details

add-constant

Description: Suggests using constant for magic numbers
and string literals.

Configuration:

  • max-lit-count: (string) maximum number of instances of a string literal that are tolerated before warn.
  • allow-strs: (string) comma-separated list of allowed string literals
  • allow-ints: (string) comma-separated list of allowed integers
  • allow-floats: (string) comma-separated list of allowed floats
  • ignore-funcs: (string) comma-separated list of function names regexp patterns to exclude

Configuration examples:

[rule.add-constant]
arguments = [
  { max-lit-count = "3", allow-strs = "\"\"", allow-ints = "0,1,2", allow-floats = "0.0,0.,1.0,1.,2.0,2.", ignore-funcs = "os\\.*,fmt\\.Println,make" },
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions