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

28 Commits

Author SHA1 Message Date
Godsgift Uloamaka Ebite
1bc57ac6f3 feature(deep-exit): detect exit-triggering flag usage (#1544) 2025-10-23 16:17:59 +02:00
Baranov Victor
15aded98f6 feature: new rule package-directory-mismatch (#1429) 2025-08-16 19:16:20 +02:00
Oleksandr Redko
f4976873e7 docs: improve comments for functions; enable godot (#1382) 2025-05-27 07:44:24 +02:00
chavacava
92f28cb5e1 refactor: moves code related to AST from rule.utils into astutils package (#1380)
Modifications summary:

* Moves AST-related functions from rule/utils.go to astutils/ast_utils.go (+ modifies function calls)
* Renames some of these AST-related functions
* Avoids instantiating a printer config at each call to astutils.GoFmt
* Uses astutils.IsIdent and astutils.IsPkgDotName when possible
2025-05-26 13:18:38 +02:00
Oleksandr Redko
9f5f957b33 rule: allow lowercased and kebab-cased options (#1272)
* rule: tests for Configure with named options; fix errors

* rule: refactor and add tests for ifelse rules

* rule: allow lowercased and kebab-cased options

* test: update integration tests with lowercased params

* docs: update rules descriptions

* rule: simplify Configure implementation with one option

* gofmt and fix lint

* review: add isRuleOption, update grammar in doc, simplify regex

Co-authored-by: ccoVeille <3875889+ccoVeille@users.noreply.github.com>

---------

Co-authored-by: ccoVeille <3875889+ccoVeille@users.noreply.github.com>
2025-03-28 09:34:20 +01:00
Denis Voytyuk
4b2c76e8b9 chore: cleanup code in rules (#1197) 2024-12-31 12:33:51 +01:00
Marcin Federowicz
9b15f3fcb6 refactor: replace panic with error in rules (#1126)
Co-authored-by: chavacava <salvadorcavadini+github@gmail.com>
Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
2024-12-11 19:35:58 +01:00
Oleksandr Redko
777abc9c35 refactor: avoid duplicated exitFunctions map (#1145) 2024-11-28 08:47:10 +01:00
Oleksandr Redko
0e8acea6ce refactor: move functions out from utils.go (#1139) 2024-11-19 13:58:14 -08: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
Oleksandr Redko
ccae54e04e refactor: remove unused parameter from pick function (#932) 2023-11-06 11:01:38 +01:00
Marcin Federowicz
36c2ee2718 code cleanup: replace interface{} with any (#906) 2023-09-24 08:44:02 +02:00
Ivan Trubach
dc30eb1182 fix(receiver-naming): distinguish types with parameters (#692)
* fix(receiver-naming): distinguish types with parameters

* chore: run tests using supported Go versions matrix
2022-06-18 18:47:53 +02:00
chavacava
04728cf0de Lint cleanup (#679) 2022-04-10 11:55:13 +02:00
chavacava
5ce2ff53c0 removes duplicated utility function (#652) 2022-03-18 15:00:41 +01:00
Euan Kemp
af953e6189 Allow whitelist for the context parameter check (#616)
* Allow a whitelist for the context parameter check

This allows users to configure a set of types that may appear before
`context.Context`.

Notably, I think this rule is useful for allowing the `*testing.T` type
to come before `context.Context`, though there may be other uses (such
as putting a tracer before it, etc).

See #605 for a little more context on this.

Fixes #605

* Save a level of indentation in context-as-arg validation

We can unindent if we make the above check more specific

* refactoring taking into account chavacava's review

Co-authored-by: chavacava <salvadorcavadini+github@gmail.com>
2021-12-31 17:11:18 -08: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
SalvadorC
097f0bb533 better messages for rules' config errors (#563) 2021-08-17 12:14:42 -07:00
chris erway
7dde483bac Add Unwrap to common methods (#547) 2021-07-28 10:50:09 +02:00
chavacava
579c7c761f utils.gofmt now accepts a interface{} 2020-05-08 22:08:16 +02:00
SalvadorC
da63d0a965 Refactors atomic rule code to move gofmt function to utils.go (issue #79) (#80)
* Refactoring on atomic rule:
-Main modification: move func gofmt to utils.go

* Refactoring on constant-logical-expr rule
Simplifies equality check of subexpressions by using gofmt function
2018-10-03 11:56:57 -07:00
mgechev
90f51530cc Add white & black lists for var-naming
This PR introduces a white & black lists of initialisms for the
`var-naming` rule.

Now the rule can be configured with:

```toml
[rule.var-naming]
  arguments = [["ID"], ["VM", "BAR"]]
```

This way, the linter will ignore `customId` but will throw on `customVm` or `customBar`.

Fix #41
2018-09-15 15:05:31 -07:00
SalvadorC
771aa23069 bool-literal-in-expr (new rule) (#54)
* bool-literal-in-expr (new rule)

* bool-literal-in-expr: add test case and fix typo
2018-08-23 11:10:17 -07:00
chavacava
d95910df55 Refactoring: move pick function to rule/utils.go (#30)
* Adds rule superfluous-else (an extension of indent-error-flow)

* Fix superfluous-else rule struct namming.

* Adds superfuous-else rule to the rules table

* Adds confusing-naming rule

* adds multifile test

* [WIP] fix multiple file test

* draft solution for detecting confusing-names through multiple files

* [WIP] confusing-name multiple files

* clean-up

* draft working version

* cleaner version + more informative messages

* adds check on struct field names

* fix config.go

* clean master

* new ADS rule: newerr

* ADS-print working version

* ads-print final version

* ads-lost-err working version

* confusing-namming: fix tests

* moves pick to rule/utils for better reusability
2018-07-09 03:00:44 +10:00
mgechev
f35fad066d Add errorf rule 2018-01-25 10:42:39 -08:00
mgechev
f926547659 Refactoring 2018-01-24 15:44:03 -08:00
mgechev
98dce265c6 Refactoring 2018-01-21 18:04:41 -08:00