Commit Graph

9 Commits

Author SHA1 Message Date
John Mulligan 2256a73262 revive: enable var-naming rule (with exceptions)
Revive's var-naming rule will help us avoid adding future violations
of Go's standard naming convention (camelCase, etc.).
We make exceptions for "Id" and "Uid" as they are treated more like
words than initialisms in this codebase and there are already many many
instances if "Id", etc. that need renaming or exceptions and it's just
not worth it. :-)

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2021-09-13 15:13:53 +00:00
John Mulligan 175cba3388 revive: enable rule to check for unhandled errors
Enable the revive rule to ensure we check the return values of various
function calls. Put common printing functions in the skip list of the
check, because no-one ever checks the error of those. :-)

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-04-09 13:11:05 -04:00
John Mulligan dd46304a07 revive: enable rules to limit argument and return counts
We already have a few functions with unwieldy number of arguments. Cap
the max number of arguments to allow at our current max (7) and cap
the number of return values at 3.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-04-09 13:11:05 -04:00
John Mulligan 9764170d5c revive: enable some additional code quality rules
Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-04-09 13:11:05 -04:00
John Mulligan c9acb56afe revive: enable indent-error-flow check
Now that we have no code that triggers this check, re-enable the
indent-error-flow check in the revive config.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-04-09 13:11:05 -04:00
John Mulligan eb6386e416 testing: set "exported" rule failures back to errors
We had a lot of "exported" badness previously but that either been
resolved or disabled on a case-by-case basis. Make the rule fail the
check so that new cases like this are not brought in.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-03-23 10:09:25 -04:00
John Mulligan 6c949c1954 testing: enable exported vars check as warning
(Re-)enable the revive check for exported vars/functions/etc at the
warning level. We have a lot of pre-existing failures here so we do not
want to fail on these, but we would like a list so we can work on
eliminating them.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2019-12-17 08:30:02 +01:00
John Mulligan e8c0d8f3e3 testing: set revive to treat new check failures as errors
Previously, revive was configured to only warn on detected issues.  We
have eliminated all those issues and so can set revive to error out and
thus the 'make check' rule will fail if new issues are introduced.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2019-12-17 08:30:02 +01:00
John Mulligan 75fdc694be testing: add a project-wide toml config file for revive
Revive is a tool similar to golint but can be configured. Add an initial
configuration for revive.
This configuration reduces the initial issue list to something more
manageable and that can be worked on incrementally rather than trying to
boil to ocean to make the checker happy.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2019-12-12 11:22:11 -05:00