-
Notifications
You must be signed in to change notification settings - Fork 5
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
Rules definitions #39
Comments
Please remember that we have to maximize compatibility with existing rules: perfsprint:
# Optimizes even if it requires an int or uint type cast.
# Default: true
int-conversion: false
# Optimizes into `err.Error()` even if it is only equivalent for non-nil errors.
# Default: false
err-error: true
# Optimizes `fmt.Errorf`.
# Default: true
errorf: false
# Optimizes `fmt.Sprintf` with only one argument.
# Default: true
sprintf1: false
# Optimizes into strings concatenation.
# Default: true
strconcat: false Maybe it is better to add simply only one |
Let's name it hex-format ? |
I was more likely to report them the way @alexandear suggested. So hex would be reported as string-format But, then the logic of having a way to configure what linter is enabled, it won't be easy. Does it mean that it would be reported as |
Another distinct question, the related configuration would be something I try to think about the configuration at the same time as the way we report them |
I guess you need some rules like One thing to emphasize about current option is that there are some that do behavior changes :
|
The Christmas break is now over. Let's regroup and start to think about it again |
Happy new year @ccoVeille Do you expect something from me here ? |
Maybe yes, from you or from @mmorel-35 or @alexandear It would be helpful if someone could list the option the linter should have and how to group them Here is an example
Did I forgot something? Assuming that if you disable string-format you disable everything, same for others. Existing conf value will be supported, and mapped to new one. Matthieu provided some guidance by creating a well documented issues. But everyone feedback made it difficult to follow. It's something like that I would like to get from you @catenacyber About possible breaking change with the reporting: we could add a setting that will allow to report the rules. This would allow us to provide rules name (like string-format.bool) in the reported error message, something @mmorel-35 tried to add I think.
|
So, I see (adding current options that were not here)
(We format into strings different objects) |
Thanks Is this post OK for you @alexandear @mmorel-35 ? I'm asking before anyone start to consider working on this |
It seems good to me. |
Looks good to me, also. |
Fixed by #42 right ? |
The actual rules needs to clearly explicit to be easily understood and used by the users. This is a first draft that needs to be challenged to then enable the separation of concerns in the tool.
error-format
with:
error-format.err-error
option equivalent toerr-error
to useerr.Error()
even if it is only equivalent for non-nil errorsstring-format
with
string-format.concat
option equivalent tostrconcat
to enable strings concatenationbool-format
hash-format
integer-format
with
integer-format.cast
option equivalent toint-conversion
to enable int or uint type castThe text was updated successfully, but these errors were encountered: