Marcin Federowicz
36c2ee2718
code cleanup: replace interface{} with any ( #906 )
2023-09-24 08:44:02 +02:00
chavacava
5ccebe86c2
Code cleaunp ( #905 )
...
* fix minor lint issue
* fix package comments
* fix comments
* removes extra empty lines
* fix import alias name
2023-09-23 10:41:34 +02:00
Denis Voytyuk
50091409c0
feat: add support for enforce-slice-style rule ( #900 )
2023-09-23 09:05:52 +02:00
Denis Voytyuk
356e667369
feat: add support for enforce-map-style rule ( #895 )
...
Co-authored-by: chavacava <salvadorcavadini+github@gmail.com>
2023-09-17 11:22:11 +02:00
chavacava
7dffe3ca48
quit config asap, remove unused pkg info ( #896 )
2023-09-17 11:10:49 +02:00
Dirk Faust
95acb880a1
Add unchecked-type-assertion ( #889 )
...
Co-authored-by: Dirk Faust <d.faust@mittwald.de>
2023-09-17 10:58:45 +02:00
Denis Voytyuk
ca0678cd08
fix: dot-imports does not check test files ( #884 )
2023-08-30 08:06:58 +02:00
Denis Voytyuk
f900b6c2d4
feat: add support for import-alias-naming rule ( #881 )
2023-08-28 15:26:00 +02:00
Oleksandr Redko
0357df7bc0
fix: add missing defer when unlocking mutex ( #879 )
2023-08-25 13:20:27 +02:00
Denis Voytyuk
4ee7542478
fix: false positive in import-shadowing for method names ( #876 )
2023-08-21 23:45:41 +02:00
chavacava
e758901c9a
Revert "fix: unnecesary alert for use-any when comments inside interface{} ( #873 )" ( #874 )
...
This reverts commit 519ffbdd7a
.
2023-08-19 08:07:28 +02:00
chavacava
9acfcc8f86
fix #863:false positive on return statement in a func lit passed to the deferred function ( #870 )
2023-08-18 11:21:42 -07:00
Damián Ferencz
519ffbdd7a
fix: unnecesary alert for use-any when comments inside interface{} ( #873 )
...
* feat: add rule for unused import alias
* fix: rename rule
* fix: rename rule
* fix: use-any skip comments inside interface{}
2023-08-18 11:21:10 -07:00
Martins Irbe
19a95d9a7f
resolve #867 : remove k[A-Z][A-Za-z\d]*$ sub-rule from var-naming
( #871 )
2023-08-16 13:23:29 +02:00
chavacava
16871ed55f
fix #864 : confusing-naming FP on methods of generic types ( #869 )
2023-08-12 10:56:53 +02:00
chavacava
7cb4540a46
fix #846 : time-equal garbled message when time returned from function ( #868 )
2023-08-12 09:05:46 +02:00
fregin
72f9108792
(var-naming) support private uppercase constants #865 ( #866 )
2023-08-12 08:45:42 +02:00
Fagim Sadykov
b31eb18b1f
adds [allowRegex] parameter for unused-parameter
and unused-receiver
rules ( #858 )
2023-08-11 07:35:08 +02:00
Denis Voytyuk
4c84a170af
Allow import-blacklist to run against go test files ( #862 )
2023-08-09 22:37:50 +02:00
Fagim Sadykov
8941d19026
imporve var-naming
- add upperCaseConst option to allow UPPER_CASED constants #851 ( #852 )
...
* imporve `var-naming` - add upperCaseConst option to allow UPPER_CASED constants #851
Co-authored-by: chavacava <salvadorcavadini+github@gmail.com>
2023-07-31 09:09:38 +02:00
Damián Ferencz
7bd666898c
feat: add rule for redundant import alias ( #854 )
2023-07-31 08:22:40 +02:00
Ricardo Martin Marcucci
a155d92342
fix: support method call from structures for string-format ( #840 )
...
* fix: support method call from structures for string-format
* fix: added test for MR
2023-07-29 11:27:07 +02:00
Miles Delahunty
ae07914dc4
ifelse: option to preserve variable scope ( #832 )
...
* ifelse: option to preserve variable scope
2023-05-23 10:10:09 +02:00
chavacava
2a1838f501
adds default config to enable all rules work out of the box ( #830 )
...
* adds default config to enable all rules out of the box
2023-05-20 14:44:34 +02:00
Miles Delahunty
4bb48df5d2
refactor: extract shared code for linting if-else chains ( #821 )
...
* refactor: extract shared code for linting if-else chains
The rules "early-return", "indent-error-flow" and
"superfluous-else" have a similar structure. This
moves the common logic for classifying if-else chains
to a common package.
A few side benefits:
- "early-return" now handles os.Exit/log.Panicf/etc
- "superfluous-else" now handles (builtin) panic
- "superfluous-else" and "indent-error-flow" now handle if/else
chains with 2+ "if" branches
* internal/ifelse: style fixes, renames, spelling
2023-05-17 13:51:35 +02:00
chavacava
81d85b505d
fix #824 ( #829 )
2023-05-16 10:31:25 +02:00
Minko Gechev
ed6d9ce652
Fix prefix trimming in struct-tag ( #827 )
...
Fix #813
2023-05-16 08:09:20 +02:00
Nate Finch
e20c7788f9
add nolint to default list of acceptable comments for comment-spacings ( #822 )
2023-05-09 16:20:58 +02:00
Mario Valderrama
55585666b7
Prevent empty-block when looping over call expr
2023-05-01 10:44:48 +02:00
Abhinav Gupta
b03e54f617
empty-block: Fix false positive on select {} ( #805 )
...
This fixes a false positive reported by revive on the following:
select {}
This is a way to block the program indefinitely.
It is used in cases like:
- Running a long-running server in a background thread
and blocking `main` from exiting until the application dies.
This is something you might do if your process has
multiple servers/listeners in the same process.
```go
go grpcListenAndServe()
go httpListenAndServe()
go logFlusher()
select {}
```
- In programs compiled to WASM to prevent the application from exiting,
so that the Javascript components may interact with it.
```go
func main() {
js.Global().Set("foo", foo)
select {}
}
```
Without this, one may see an error like,
"Error: Go program has already exited"
As a workaround, these programs can block forever
by receiving from a throwaway channel (`<-make(chan struct{})`),
but `select {}` is still a completely valid way of doing this,
so supporting it makes sense.
The issue was previously reported in #698 but was closed
because the author was satisfied with a `//nolint` comment.
Now that this rule is part of the default rule set (#799 )
the case for addressing the false positive is stronger.
Resolves #804
2023-03-16 13:39:52 -07:00
chavacava
6fd2c76c7d
fix issue #520 ( #802 )
2023-03-14 16:16:12 -07:00
cce
d7bedbd946
add golint's package name MixedCaps rule as in 83fdc39ff7/lint.go (L561-L563)
( #797 )
2023-02-27 19:56:30 +01:00
chavacava
10d4f5fb1c
fix issue #792 ( #793 )
2023-02-18 10:57:06 +01:00
Vito (Victor Gama)
b2bc00bd75
refactor: Reduce package-comments output scope ( #791 )
...
This reduces the amount of lines reported by package-comments by only
reporting the `package XXXXXXX' line, instead of the whole file.
2023-02-17 21:39:51 +01:00
Felipe David
8c2cd33315
fixing comment spacings ( #789 )
...
* fixing comments spacing
* Updating comment spacing test cases
* adds test cases for multiline comments
---------
Co-authored-by: chavacava <salvadorcavadini+github@gmail.com>
2023-02-17 21:03:11 +01:00
chavacava
a4f4632a3f
fix #781 ( #782 )
2023-01-26 13:50:35 -08:00
Miles Delahunty
b87d391ee4
Fix early-return false positive and other tweaks ( #776 )
2022-11-27 13:23:51 +01:00
Buyanov Vladimir
7b1458a9cb
fix #754 [rule.unhandled-error] change arguments to regexp ( #757 )
...
* fix #754 [rule.unhandled-error] change arguments to regexp
* Update unhandled-error-w-ignorelist.go
* Update unhandled-error_test.go
* Update unhandled-error-w-ignorelist.go
* adds config backward compatibility test
* fix #754 [rule.unhandled-error] change arguments to regexp
* fix #754 [rule.unhandled-error] change arguments to regexp
* fix #754 [rule.unhandled-error] change arguments to regexp
Co-authored-by: chavacava <salvadorcavadini+github@gmail.com>
2022-11-09 13:13:52 +01:00
Shubh Karman Singh
5f26378cc2
Comment spacing rule ( #761 )
...
* added comment-spacing rule for revive
* added test for comment-spacings rule
* adds comment-spacings rule to the configuration
* renames the source file to match rule name
* adds some tests
* refactor Comment-Spacings Rule to remove whiteList and avoid Panic at empty comment
* refactoring and adds rule configuration
* adds rule documentation
Co-authored-by: chavacava <salvadorcavadini+github@gmail.com>
2022-10-29 19:32:42 +02:00
chavacava
32a0cb8052
Allows inversing the semantics of string-format
rule configurations ( #765 )
...
* allows negating the regexp
* updates rule documentation
* adds mgechev remarks
2022-10-24 20:48:41 +02:00
chavacava
06881a9f54
speedup branch comparison ( #764 )
2022-10-24 17:21:48 +02:00
Buyanov Vladimir
3d83403fb8
fix #751 [rule.add-constant] add ignoreFuncs to exclude constants in … ( #756 )
...
* fix #751 [rule.add-constant] add ignoreFuncs to exclude constants in functions
* Update add-constant.go
* Update add-constant.go
* fix #751 [rule.add-constant] add ignoreFuncs to exclude constants in functions
* add details to regex-related errors
Co-authored-by: chavacava <salvadorcavadini+github@gmail.com>
2022-10-13 13:23:23 +02:00
chavacava
3116818e59
fix bug #736 ( #745 )
2022-09-10 09:08:17 +02:00
chavacava
7c2ebbda24
fix #744 ( #746 )
2022-09-05 11:11:45 +02:00
chavacava
553604eace
fix bug #739 : empty-lines false positive ( #742 )
2022-08-27 13:18:17 +02:00
ccoVeille
fa350e6eb8
fix some typos in repository ( #728 )
2022-08-08 13:48:59 +02:00
Steven L
db56db0b6a
Capture yet more bad defer / recover patterns ( #719 )
...
* Yet more bad defer / recover patterns
`recover()` is an eternal font of excitement.
* demonstrating another flavor of failure
* removing leftover code
* update documentation
* removes test not related to the rule itself
Co-authored-by: chavacava <salvadorcavadini+github@gmail.com>
2022-07-24 09:34:16 +02:00
Abirdcfly
fcc59adb72
add testing.FailNow and related function to unreachable check ( #711 )
...
Signed-off-by: Abirdcfly <fp544037857@gmail.com>
2022-07-20 15:41:31 -07:00
chavacava
60e1ae4a01
adds checks for protobuf struct tags ( #707 )
...
* adds checks for protobuf struct tags
* use actual tag numbers as key instead of strings
removes debug println
2022-07-15 11:15:55 -07:00
chavacava
e9d5b48c19
fix #670 ( #708 )
2022-07-14 15:15:42 +02:00