1
0
mirror of https://github.com/mgechev/revive.git synced 2024-11-30 08:57:07 +02:00
revive/rule
Jameel Al-Aziz 17a0393326
enforce-slice-style: Support nil declaration enforcement (#974)
* enforce-slice-style: Support nil declaration enforcement

Add support for enforcing nil slice declarations as recommended by both
the Go Code Review and Uber style guides.

This initial version is quite strict in that it also prevents using
empty literal and make-style slices in struct assignments and as
function arguments.

* Add more tests

* docs
2024-02-26 11:58:31 +01:00
..
add-constant.go refactor: rename blacklist to blocklist and whitelist to allowlist (#946) 2024-01-15 12:16:00 +01:00
argument-limit.go adds default config to enable all rules work out of the box (#830) 2023-05-20 14:44:34 +02:00
atomic.go Lint cleanup (#679) 2022-04-10 11:55:13 +02:00
banned-characters.go adds default config to enable all rules work out of the box (#830) 2023-05-20 14:44:34 +02:00
bare-return.go Lint cleanup (#679) 2022-04-10 11:55:13 +02:00
blank-imports.go Lint cleanup (#679) 2022-04-10 11:55:13 +02:00
bool-literal-in-expr.go Lint cleanup (#679) 2022-04-10 11:55:13 +02:00
call-to-gc.go Lint cleanup (#679) 2022-04-10 11:55:13 +02:00
cognitive-complexity.go adds default config to enable all rules work out of the box (#830) 2023-05-20 14:44:34 +02:00
comment-spacings.go Code cleaunp (#905) 2023-09-23 10:41:34 +02:00
confusing-naming.go refactor: rename blacklist to blocklist and whitelist to allowlist (#946) 2024-01-15 12:16:00 +01:00
confusing-results.go Lint cleanup (#679) 2022-04-10 11:55:13 +02:00
constant-logical-expr.go cleanup: removes or names unused parameters and receivers to _ (#907) 2023-09-24 08:55:14 +02:00
context-as-argument.go code cleanup: replace interface{} with any (#906) 2023-09-24 08:44:02 +02:00
context-keys-type.go Lint cleanup (#679) 2022-04-10 11:55:13 +02:00
cyclomatic.go adds default config to enable all rules work out of the box (#830) 2023-05-20 14:44:34 +02:00
datarace.go refactor: remove unused parameter from pick function (#932) 2023-11-06 11:01:38 +01:00
deep-exit.go Lint cleanup (#679) 2022-04-10 11:55:13 +02:00
defer.go code cleanup: replace interface{} with any (#906) 2023-09-24 08:44:02 +02:00
doc.go Code cleaunp (#905) 2023-09-23 10:41:34 +02:00
dot-imports.go [dot-imports] support allow list of packages (#939) 2023-11-26 10:07:12 +01:00
duplicated-imports.go Lint cleanup (#679) 2022-04-10 11:55:13 +02:00
early-return.go cleanup: removes or names unused parameters and receivers to _ (#907) 2023-09-24 08:55:14 +02:00
empty-block.go Prevent empty-block when looping over call expr 2023-05-01 10:44:48 +02:00
empty-lines.go fix bug #739: empty-lines false positive (#742) 2022-08-27 13:18:17 +02:00
enforce-map-style.go cleanup: removes or names unused parameters and receivers to _ (#907) 2023-09-24 08:55:14 +02:00
enforce-repeated-arg-type-style.go feat: add support for enforce-repeated-arg-type-style rule (#953) 2023-12-27 10:30:09 +01:00
enforce-slice-style.go enforce-slice-style: Support nil declaration enforcement (#974) 2024-02-26 11:58:31 +01:00
error-naming.go Lint cleanup (#679) 2022-04-10 11:55:13 +02:00
error-return.go Lint cleanup (#679) 2022-04-10 11:55:13 +02:00
error-strings.go Allow to customize user functions in rule error-strings (#703) 2022-07-05 21:51:50 +02:00
errorf.go Lint cleanup (#679) 2022-04-10 11:55:13 +02:00
exported.go fix issue #691 (#700) 2022-06-28 18:14:26 +03:00
file-header.go adds default config to enable all rules work out of the box (#830) 2023-05-20 14:44:34 +02:00
flag-param.go refactor: remove unused parameter from pick function (#932) 2023-11-06 11:01:38 +01:00
function-length.go code cleanup: replace interface{} with any (#906) 2023-09-24 08:44:02 +02:00
function-result-limit.go adds default config to enable all rules work out of the box (#830) 2023-05-20 14:44:34 +02:00
get-return.go Lint cleanup (#679) 2022-04-10 11:55:13 +02:00
identical-branches.go speedup branch comparison (#764) 2022-10-24 17:21:48 +02:00
if-return.go Lint cleanup (#679) 2022-04-10 11:55:13 +02:00
import-alias-naming.go fix: ignore dot import aliases in import-alias-naming rule (#938) 2023-11-26 08:57:34 +01:00
import-shadowing.go fix: false positive in import-shadowing for method names (#876) 2023-08-21 23:45:41 +02:00
imports-blocklist.go refactor: rename blacklist to blocklist and whitelist to allowlist (#946) 2024-01-15 12:16:00 +01:00
increment-decrement.go Lint cleanup (#679) 2022-04-10 11:55:13 +02:00
indent-error-flow.go cleanup: removes or names unused parameters and receivers to _ (#907) 2023-09-24 08:55:14 +02:00
line-length-limit.go adds default config to enable all rules work out of the box (#830) 2023-05-20 14:44:34 +02:00
max-control-nesting.go Adds rule max-control-nesting (#967) 2024-01-28 12:22:41 +01:00
max-public-structs.go adds default config to enable all rules work out of the box (#830) 2023-05-20 14:44:34 +02:00
modifies-param.go Lint cleanup (#679) 2022-04-10 11:55:13 +02:00
modifies-value-receiver.go modifies-value-receiver: warn on slice or map (#943) 2023-11-28 15:45:52 +01:00
nested-structs.go fix #824 (#829) 2023-05-16 10:31:25 +02:00
optimize-operands-order.go refactor: remove unused parameter from pick function (#932) 2023-11-06 11:01:38 +01:00
package-comments.go refactor: Reduce package-comments output scope (#791) 2023-02-17 21:39:51 +01:00
range-val-address.go Lint cleanup (#679) 2022-04-10 11:55:13 +02:00
range-val-in-closure.go Lint cleanup (#679) 2022-04-10 11:55:13 +02:00
range.go Lint cleanup (#679) 2022-04-10 11:55:13 +02:00
receiver-naming.go fix(receiver-naming): distinguish types with parameters (#692) 2022-06-18 18:47:53 +02:00
redefines-builtin-id.go fix issue #792 (#793) 2023-02-18 10:57:06 +01:00
redundant-import-alias.go feat: add rule for redundant import alias (#854) 2023-07-31 08:22:40 +02:00
string-format.go code cleanup: replace interface{} with any (#906) 2023-09-24 08:44:02 +02:00
string-of-int.go Lint cleanup (#679) 2022-04-10 11:55:13 +02:00
struct-tag.go Code cleaunp (#905) 2023-09-23 10:41:34 +02:00
superfluous-else.go cleanup: removes or names unused parameters and receivers to _ (#907) 2023-09-24 08:55:14 +02:00
time-equal.go fix #846: time-equal garbled message when time returned from function (#868) 2023-08-12 09:05:46 +02:00
time-naming.go Lint cleanup (#679) 2022-04-10 11:55:13 +02:00
unchecked-type-assertion.go quit config asap, remove unused pkg info (#896) 2023-09-17 11:10:49 +02:00
unconditional-recursion.go refactor: remove unused parameter from pick function (#932) 2023-11-06 11:01:38 +01:00
unexported-naming.go Lint cleanup (#679) 2022-04-10 11:55:13 +02:00
unexported-return.go fix(receiver-naming): distinguish types with parameters (#692) 2022-06-18 18:47:53 +02:00
unhandled-error.go unhandled-error: use full function name in error message (#962) 2024-01-08 09:36:30 -08:00
unnecessary-stmt.go Lint cleanup (#679) 2022-04-10 11:55:13 +02:00
unreachable-code.go add testing.FailNow and related function to unreachable check (#711) 2022-07-20 15:41:31 -07:00
unused-param.go Check function literals in unused-param (#966) 2024-01-27 13:39:55 +01:00
unused-receiver.go refactor: remove unused parameter from pick function (#932) 2023-11-06 11:01:38 +01:00
use-any.go Revert "fix: unnecesary alert for use-any when comments inside interface{} (#873)" (#874) 2023-08-19 08:07:28 +02:00
useless-break.go Lint cleanup (#679) 2022-04-10 11:55:13 +02:00
utils.go refactor: remove unused parameter from pick function (#932) 2023-11-06 11:01:38 +01:00
var-declarations.go Lint cleanup (#679) 2022-04-10 11:55:13 +02:00
var-naming.go fix 968 by removing references to black and white lists (#969) 2024-02-03 18:36:44 +01:00
waitgroup-by-value.go Lint cleanup (#679) 2022-04-10 11:55:13 +02:00