-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix #751 [rule.add-constant] add ignoreFuncs to exclude constants in … #756
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've left some comments
Please fill the PR description by using the PR description template
In general I think regexps are too powerful (or complicated?) to be used without the risk of ignoring things you don't know you are ignoring. For example, the regexp .Println
used in the tests will not ignore just "methods named Println
of any package" but also any method or function named such as Println
is a suffix of the name (myPrintln
, ThisIsAnotherPrintln
, dPrintlln
, ...)
…nts in functions
The problem is out of thin air🙃 We face the regexp if not every day, but commonly and there is nothing "overcomplicated" with it, it is just a right tool for such situation, most of existing linters included in golangcilint uses regexp. Example you've given easily solvable by reading the docs and acknowledging that it is a regexp and then heading to regexp101. And easily avoidable by gicing some defauls and\or examples in docs. Anyways having regexes is much better and easier option that needing to exclude separately all 36 argument methods having defaults from flag package, and same for pflag. |
My point is that RE are very error prone (at the point that your own test case |
It was my fault, i had to write regexp |
@chavacava Ok, thanks, i will create new PR for this changes |
Closes #751