1
0
mirror of https://github.com/mgechev/revive.git synced 2025-11-25 22:12:38 +02:00
Commit Graph

40 Commits

Author SHA1 Message Date
Oleksandr Redko
7f769f8c16 feat: add redundant-build-tag rule (#1135) 2024-11-20 20:26:28 +01:00
Oleksandr Redko
1b4440c160 refactor: use toml.Unmarshal instead of toml.Decode (#1122) 2024-11-16 16:15:36 +01:00
chavacava
eb18252088 adds filename-format rule (#1092) 2024-11-02 14:23:46 -03:00
Oleksandr Redko
3bead6f4a0 feat: add file-length-limit rule (#1072) 2024-10-26 07:40:24 -03:00
chavacava
9b297848d9 adds comments-density rule (#979) 2024-04-20 10:20:56 +02:00
Ludovic Fernandez
5c5d6c1075 fix: enforce-repeated-arg-type-style in config (#970) 2024-02-07 18:00:26 +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
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
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
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
Fagim Sadykov
310d1d76e4 per-rule file exclude filters (#850) (#857) 2023-08-12 08:21:11 +02:00
Damián Ferencz
7bd666898c feat: add rule for redundant import alias (#854) 2023-07-31 08:22:40 +02:00
Robert Liebowitz
2b4286ede2 Drop if-return from default ruleset (#843)
The `if-return` rule was originally a golint rule which was removed
from their ruleset for being out of scope. Similarly, it was dropped
from revive intentionally as a result of #537. More recently, it was
reintroduced into the default ruleset as a result of #799 due to a
discrepancy in documentation without a discussion of whether this rule
in particular belonged as a part of that default rule set.

While it is no longer a goal of this project to align 100% with the
golint defaults, I believe that this rule gives bad advice often enough
that it should not be enabled by default.

For example, consider the following code:

```go
if err := func1(); err != nil {
	return err
}

if err := func2(); err != nil {
	return err
}

if err := func3(); err != nil {
	return err
}

return nil
```

The `if-return` rule considers this a violation of style, and instead
suggests the following:

```go
if err := func1(); err != nil {
	return err
}

if err := func2(); err != nil {
	return err
}

return func3()
```

While this is more terse, it has a few shortcomings compared to the
original. In particular, it means extending the size of the diff if
changing the order of checks, adding logic after the call that currently
happens to be last, or choosing to wrap the error. And in that last
case, it can make it less obvious that there is an unwrapped error being
propagated up the call stack.

This in practice has a very similar effect to disabling trailing commas;
while it is not necessarily wrong as a style choice, I don't believe it
warrants a position as part of the default ruleset here.

See-also: https://github.com/golang/lint/issues/363
2023-06-26 09:43:19 -07:00
Minko Gechev
6d5bc51b50 Move away from deprecated ioutils (#825)
Fix #806
2023-05-16 08:06:52 +02:00
Johan Walles
aea6254fca Update default rule set to match recommendations (#799)
Before this change, Revive's defaults did not match the recommended
configuration:

https://github.com/mgechev/revive#recommended-configuration

With this change in place, Revive now defaults to following its own
recommendations.
2023-03-14 16:17:36 -07: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
a67ecdd7ba add rule datarace (#683) 2022-04-18 09:45:42 -07:00
chavacava
04728cf0de Lint cleanup (#679) 2022-04-10 11:55:13 +02:00
chavacava
671c55d82e adds rule use-any (#660) 2022-03-29 11:25:38 -07:00
Bernardo Heynemann
1c283837a9 Allow revive to be called with extra linters (#650)
This change allows revive to be called from main.go
in other libraries and pass in a list of custom
linters to be added to the built-in linters found in config

Co-authored-by: Bernardo Heynemann <bernardo.heynemann@coinbase.com>
Co-authored-by: chavacava <salvadorcavadini+github@gmail.com>
2022-03-20 09:12:51 +01:00
subham sarkar
577441d60c format sources w/ gofumpt (#643)
Signed-off-by: subham sarkar <sarkar.subhams2@gmail.com>
2022-03-02 08:24:55 +01:00
doniacld
5d04216294 Add optimize-operands-order rule (#599) (#603)
Co-authored-by: SalvadorC <salvadorcavadini+github@gmail.com>
2021-10-23 09:29:14 +02:00
doniacld
be81121399 Add banned characters rule (#532) (#591) 2021-10-14 20:56:29 +02:00
SalvadorC
1c654afd91 Update config.go 2021-10-04 09:37:01 -07:00
SalvadorC
12e4e8c172 Update config.go
removes use of `math.Inf(1)`
2021-10-04 09:37:01 -07:00
Mihai Todor
c3af594461 Fix config initialisation
Allow setting confidence to 0
2021-10-04 09:37:01 -07:00
sina safari
62db66915b add new rule time equal (#584) 2021-10-01 13:55:53 +02:00
SalvadorC
e545098165 fixes issue #577 (#581) 2021-09-30 13:37:44 -07:00
SalvadorC
c939bb6af8 add new rule useless-break (#551) 2021-08-15 15:30:08 -07:00
SalvadorC
ea51f7aa3f fix issue #537 (#538) 2021-06-29 13:04:51 -07:00
Robert Deusser
575ce5f61a new rule: nested-structs (#530)
new rule: nested-structs
2021-06-15 11:36:41 +02:00
SalvadorC
b298ffe4ee Adds configuration option to enable all available rules (#521)
Adds configuration option to enable all available rules
2021-05-21 09:53:10 +02:00
Keith Scroggs
2afe668e7b Check string literals against regular expressions (#511)
Add string-format rule
2021-04-18 18:35:30 +02:00
SalvadorC
f2d79cc85d adds SARIF formatter (#508) 2021-04-05 11:54:33 -07:00
SalvadorC
46f65914e3 new rule function-length (#504) 2021-03-20 15:45:30 -07:00
SalvadorC
50f01f660d fix issue 470 (#477) 2020-10-29 15:11:52 +02:00