Skip to content

Idea: support "nolint ranges" #129

Open
@alecthomas

Description

@alecthomas

Revive has the concept of begin/end blocks for nolinting. See here.

This could be useful under some circumstances.

Activity

AlekSi

AlekSi commented on Jul 25, 2018

@AlekSi
Contributor

I would like to see this implemented. My use-case: disable gocyclo for a specific exported method without exposing nolint:gocyclo in the godoc.

added
staleNo recent correspondence or work activity
on Oct 1, 2019
AlekSi

AlekSi commented on Oct 16, 2019

@AlekSi
Contributor

Stale bot went rampant. @jirfag please reopen.

reopened this on Oct 16, 2019
removed
staleNo recent correspondence or work activity
on Oct 16, 2019
stale

stale commented on Apr 13, 2020

@stale

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

added
staleNo recent correspondence or work activity
on Apr 13, 2020
AlekSi

AlekSi commented on Apr 13, 2020

@AlekSi
Contributor

My use-case: disable gocyclo for a specific exported method without exposing nolint:gocyclo in the godoc.

That's still a problem.

removed
staleNo recent correspondence or work activity
on Apr 13, 2020
theckman

theckman commented on May 18, 2020

@theckman
Contributor

@AlekSi is there a reason you're not able to do:

// Save provides a complex save method!
func Save() { // nolint:gocyclo
AlekSi

AlekSi commented on May 18, 2020

@AlekSi
Contributor

A better exemple coud be:

// Save provides a complex save method using third-party library with really long method names.
func Save() {
  ...
  very long line of code //nolint:lll
  ...
  another very long line of code //nolint:lll
  ...
  one more //nolint:lll
  ...
}
theckman

theckman commented on May 18, 2020

@theckman
Contributor

@AlekSi I appreciate that other use cases exist, I was asking if my suggestion works for your specific challenge above.

sanposhiho

sanposhiho commented on May 3, 2021

@sanposhiho
Member

I have just had the experience of ignore lll reports like @AlekSi mentioned, and I've been wanting this feature too.
Can I be the assignee for this Issue?

I'm thinking of doing ignore as follows.

func Save() {
  //nolint-begin:lll
  very long line of code 
  another very long line of code
  one more 
  ...
  //nolint-end:lll
}

Please give your opinions on this idea. (And other opinions are also verrry welcome.)

self-assigned this
on May 9, 2021
stale

stale commented on Jul 10, 2022

@stale

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

added
staleNo recent correspondence or work activity
on Jul 10, 2022
removed
staleNo recent correspondence or work activity
on Jul 10, 2022
added
no decisionNo decision to fix or not
area: nolintRelated to nolint directive and nolintlint
and removed on Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: nolintRelated to nolint directive and nolintlintenhancementNew feature or improvementno decisionNo decision to fix or not

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Participants

    @AlekSi@alecthomas@tpounds@theckman@jirfag

    Issue actions

      Idea: support "nolint ranges" · Issue #129 · golangci/golangci-lint