1
0
mirror of https://github.com/mgechev/revive.git synced 2025-11-23 22:04:49 +02:00
Commit Graph

128 Commits

Author SHA1 Message Date
Marcin Federowicz
d76ffb98f6 update testdata: var case (#1055) 2024-10-02 12:20:39 +02:00
Marcin Federowicz
ff7b0adb4c rule.exported: add feature to disable checking on const,method,function, variable (#1047)
Co-authored-by: chavacava <salvadorcavadini+github@gmail.com>
2024-10-02 10:46:52 +02:00
chavacava
798ce21849 makes exported rule behave as golint (#1051)
Co-authored-by: chavacava <salvador.cavadini@gmail.com>
2024-09-29 22:50:49 +02:00
chavacava
4c3641ebc3 fix #1032 by comparing string representations of types (#1049) 2024-09-24 11:29:20 +02:00
chavacava
53a111d36e adds check for receiver names length (#1048)
Co-authored-by: chavacava <salvador.cavadini@gmail.com>
Co-authored-by: yuta nishiyama <57400690+ytnsym@users.noreply.github.com>
2024-09-23 12:38:39 +02:00
chavacava
a65fb8d1b5 adds tests for specific go versions (#1043)
Co-authored-by: chavacava <salvador.cavadini@gmail.com>
2024-09-20 16:09:24 +02:00
Oleksandr Redko
8bea739f45 docs: fix typo in comments (#1037) 2024-09-14 21:38:06 +02:00
chavacava
6a139caf92 fix #1029 (#1030) 2024-08-21 10:38:34 +02:00
Shoichi Kaji
05c4801f9b check param, result, type param of function in redefines-builtin-id rule (#1023)
* check param, result, type param of function in redefines-builtin-id rule

* combine the if statements

* tiny refactoring to make it more Go idiomatic

---------

Co-authored-by: chavacava <salvadorcavadini+github@gmail.com>
2024-08-15 13:29:11 +02:00
Shoichi Kaji
e54773e4b9 check clear/max/min in redefines-builtin-id rule on go1.21+ (#1024)
* check clear/max/min in redefines-builtin-id rule on go1.21+

* Update rule/redefines-builtin-id.go

Co-authored-by: Denis Voytyuk <5462781+denisvmedia@users.noreply.github.com>

---------

Co-authored-by: Denis Voytyuk <5462781+denisvmedia@users.noreply.github.com>
2024-08-15 13:14:16 +02:00
Fagim Sadykov
8f9edc9fe7 #1002 - add "checkPublicInterface" option to "exported" rule to allow check documentation on public methods on public interfaces (#1003)
* [var-naming] handle private uppercased const

* FEATURE #1002 - "checkPublicInterface" option for "exported" rule - to check public interface method comments

* fix exported #1002 for ast.Ident

* fix exported #1002 for ast.Ident 2

* go fmt applyed

* #1002 update documentation on `exported` rule

* refactor `exported` rule configuration logic

* test and review fixes

---------

Co-authored-by: fregin <freginpanklinshtern@gmail.com>
2024-07-30 10:36:03 +02:00
Songlin Yang
7ef710a0c2 fix(1007): return Sel.Name as FuncName when selector is an CallExpr (#1012)
Signed-off-by: lsytj0413 <511121939@qq.com>
2024-07-19 10:33:27 +02:00
Kostas Stamatakis
689291fbcb rule optimize-operands-order: do not consider built-in len as a caller (#1005) 2024-07-02 08:22:13 +02:00
chavacava
5bf08fcd40 Fix 922 (#989)
* removes spurious warning on package comments starting with spaces

* skips directive comments when linting package comments

---------

Co-authored-by: chavacava <salvador.cavadini@gmail.com>
2024-05-13 14:23:02 +02:00
Entuazism
993c9f68a9 fix #982 2024-05-11 19:50:30 +02:00
chavacava
2d3426f777 more precise regular expression for directive comments (#988)
Co-authored-by: chavacava <salvador.cavadini@gmail.com>
2024-05-11 19:19:09 +02:00
chavacava
85333f8533 Fix #808 (#986)
fix #808 by using the official regexp for directives
---------

Co-authored-by: chavacava <salvador.cavadini@gmail.com>
2024-05-10 12:11:05 +02:00
chavacava
9b297848d9 adds comments-density rule (#979) 2024-04-20 10:20:56 +02:00
Gustavo Alves
0a77458f89 remove colon suffix in comment-spacings rule (#981) 2024-04-19 16:39:59 +02:00
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
chavacava
ef34f92cef fix 968 by removing references to black and white lists (#969) 2024-02-03 18:36:44 +01:00
chavacava
3a62091839 Adds rule max-control-nesting (#967) 2024-01-28 12:22:41 +01:00
Stephen Buttolph
f547cb594e Check function literals in unused-param (#966) 2024-01-27 13:39:55 +01:00
Vincent Baron
64dda06595 feat: capitalise var naming to IDs (#964)
* feat: capitalise var naming to IDs

* feat: added test case for IDs case
2024-01-17 14:01:40 +01:00
Marcin Federowicz
9abe06adfa refactor: rename blacklist to blocklist and whitelist to allowlist (#946)
* refactor: rename blacklist to blocklist and whitelist to allowlist
2024-01-15 12:16:00 +01:00
Michael McLoughlin
be35a880ab unhandled-error: use full function name in error message (#962)
* update tests

* Update testdata/unhandled-error-w-ignorelist.go

* Update testdata/unhandled-error-w-ignorelist.go

---------

Co-authored-by: Denis Voytyuk <5462781+denisvmedia@users.noreply.github.com>
2024-01-08 09:36:30 -08:00
Denis Voytyuk
f8e122f43d fix: add-constant struct tags in anonymous struct literals false positive (#954)
* fix: add-constant struct tags in anonymous struct literals false positive
2023-12-28 23:59:58 +01:00
Denis Voytyuk
8d5724f746 feat: add support for enforce-repeated-arg-type-style rule (#953) 2023-12-27 10:30:09 +01:00
Georgy Buranov
782f0f118c variable to skip package name checks (#941)
* variable to skip package name checks

* add tests for skipPackageNameChecks

* Add documentation
2023-11-30 14:19:31 +01:00
Bryan Boreham
7da6a39044 modifies-value-receiver: warn on slice or map (#943)
* modifies-value-receiver: warn on slice or map

Assignments which index into the slice or map are already ignored on
line 72, and those where the whole receiver is slice or map on line 50.
We should not ignore assignments where the member variable is slice
or map.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>

* Remove extra space

---------

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
Co-authored-by: Denis Voytyuk <5462781+denisvmedia@users.noreply.github.com>
2023-11-28 15:45:52 +01:00
Marcin Federowicz
9e80d93545 extend parsing instructions to use json object instead of plain txt (#929) 2023-11-26 10:18:36 +01:00
Nahshon Unna Tsameret
9a2eab34f1 [dot-imports] support allow list of packages (#939)
Add the ability to allow list of packages to be dot imported.

Add a new don-imports configuration:
* `allowedPackages`: (string) comma-separated list of allowed dot import packages

Example:

```toml
[rule.dot-imports]
  arguments = [{ allowedPackages = "github.com/onsi/ginkgo/v2,github.com/onsi/gomega" }]
```
2023-11-26 10:07:12 +01:00
Denis Voytyuk
07eb59669a fix: ignore dot import aliases in import-alias-naming rule (#938) 2023-11-26 08:57:34 +01:00
Denis Voytyuk
fd9a130d7a Add denyRegex support for import-alias-naming rule (#927) 2023-10-29 13:19:53 +01:00
Marcin Federowicz
bcae8c78ca fix trailing whitespaces (#917) 2023-10-27 07:26:27 +02:00
Gavin Inglis
1ef3c0f554 refactor: remove refs to io/ioutil (#918)
Signed-off-by: ginglis13 <ginglis05@gmail.com>
2023-10-14 19:25:25 +02:00
Marcin Federowicz
fb5bbe72e7 fix: literal calls case (#909) 2023-09-30 10:18:17 +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
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
f900b6c2d4 feat: add support for import-alias-naming rule (#881) 2023-08-28 15:26:00 +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
310d1d76e4 per-rule file exclude filters (#850) (#857) 2023-08-12 08:21:11 +02:00