Skip to content

funlen: ignore-comments setting is reversed #5593

@koki-sato

Description

@koki-sato

Welcome

  • Yes, I'm using a binary release within 2 latest releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've read the typecheck section of the FAQ.
  • Yes, I've tried with the standalone linter if available (e.g., gocritic, go vet, etc.).
  • I agree to follow this project's Code of Conduct

How did you install golangci-lint?

Brew

Description of the problem

funlen's ignore-comments setting is the opposite of what is intended.

cfg.ignoreComments = !settings.IgnoreComments

https://golangci-lint.run/usage/linters/#funlen

linters-settings:
  funlen:
    ...
    # Ignore comments when counting lines.
    # Default false
    ignore-comments: true

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version 1.64.8 built with go1.24.1 from 8b37f14 on 2025-03-17T16:54:02Z

Configuration

linters:
  disable-all: true
  enable:
    - funlen

linters-settings:
  funlen:
    lines: 2
    ignore-comments: true

Go environment

$ go version
go version go1.24.1 darwin/arm64

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run
main.go:3:6: Function 'main' is too long (4 > 2) (funlen)
func main() {
     ^

A minimal reproducible example or link to a public repository

package main

func main() {
	// Comment 1
	// Comment 2
	// Comment 3
	print("Hello, world!")
}

Validation

  • Yes, I've included all information above (version, config, etc.).

Supporter

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions