1
0
mirror of https://github.com/mgechev/revive.git synced 2024-11-30 08:57:07 +02:00
Commit Graph

37 Commits

Author SHA1 Message Date
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
Aleksey Bakin
305f6c13d2 var-naming rule: note about initialisms 2021-12-29 23:29:46 -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
doniacld
be81121399
Add banned characters rule (#532) (#591) 2021-10-14 20:56:29 +02:00
sina safari
62db66915b
add new rule time equal (#584) 2021-10-01 13:55:53 +02:00
Oleg Butuzov
b1f01484c2
fix: markdown headers (#570)
minor markdown issue with rules headers
2021-09-10 08:25:48 +02:00
jmckenzieark
d7c8e25652
Update dead cognitive-complexity link (#569) 2021-08-30 19:55:43 +02:00
SalvadorC
18cdb55850
Exported config (#565)
* working version

* adds flag for replacing "stutters"
2021-08-26 08:36:24 -07:00
SalvadorC
c939bb6af8
add new rule useless-break (#551) 2021-08-15 15:30:08 -07:00
Derek Perkins
1acbe6b30e
Fix testeability typo (#542) 2021-07-10 08:15:20 +02:00
Robert Deusser
575ce5f61a
new rule: nested-structs (#530)
new rule: nested-structs
2021-06-15 11:36:41 +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
46f65914e3
new rule function-length (#504) 2021-03-20 15:45:30 -07:00
SalvadorC
1412d0c6ed
new rule: unexported-naming (#443)
* new rule: unexported-naming

* better failure message
2020-07-23 02:17:20 +03:00
chavacava
ad3100c9ec adds defer rule 2020-06-08 09:40:38 -07:00
chavacava
65beded8c4 Merge remote-tracking branch 'upstream/master' into unconditional-recursion 2020-05-13 22:13:08 +02:00
chavacava
a76c962bd6 fix typo 2020-05-09 21:44:53 +02:00
chavacava
4eb7ae0821 documents unconditional-recursion 2020-05-09 17:19:37 +02:00
chavacava
b43b33a4e6 adds identical-branches to doc 2020-05-08 22:21:34 +02:00
SalvadorC
67c83886d7
Late return rule (#406)
* fisrt working version of late-return rule

* late-update: adds doc

* renames to early-return

* fix rule failure condition

* fix alphabetical sorting of early-return
2020-05-08 11:14:21 -07:00
Bernhard Reisenberger
c15fae8f18 range-val-address: update readme and rule description 2020-02-27 08:21:39 +01:00
Bernhard Reisenberger
22014c3f08
Add rule 'range-val-address' (#353)
* Add rule 'range-val-address'

* range-val-address: replace pick with visitor; avoid nesting; improve failure message

* range-val-address: not all callexprs are bad. limit to 'append'
2020-02-26 10:33:00 -10:00
SalvadorC
a24e8e7b81
String of int (#342)
* string-of-int: working version

* adds doc of string-to-int
2020-02-18 09:38:01 -08:00
SalvadorC
65f203d8ad
fix typo in description 2019-12-17 19:12:40 +01:00
chavacava
e842146006 better description of cognitive complexity 2019-12-17 19:05:35 +01:00
chavacava
74551b1bf8 cocuments cognitive-complexity 2019-12-14 16:36:42 +01:00
SalvadorC
c8ee35a500 adds blacklist to unhandled-error (#128)
* adds blacklist for unhandled-error

* uses ignoreList in place of blackList
2019-04-29 19:56:12 -07:00
SalvadorC
8aa0cd8bd4 unhandled-error (new rule) (#124)
* unhandled-error (new rule)

* better failure msg

* encapsulates error type detection
2019-04-27 19:23:17 -07:00
SalvadorC
00a86ae1fd new rule: unused-receiver (#119)
* new rule: unused-receiver

* unused-receiver: adds more test cases
2019-04-18 10:35:51 -07:00
SalvadorC
745bcf65aa bare-return (first working version) (#117)
New rule bare-return
2019-04-17 22:55:52 +02:00
SalvadorC
2ce440cf96 new rule: import shadowing (#114)
* 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

* clean-up

* fix config.go

* clean master

* new ADS rule: newerr

* ADS-print working version

* ads-print final version

* ads-lost-err working version

* fix ads-print

* removes ads rules from master

* new rule: import-shadowing

* removes ads rules from master

* new rule: import-shadowing

* fix defaults

* adds explanations on the rule implementation
2019-03-27 11:46:20 -07:00
SalvadorC
fbefad8558 New rule: duplicated-imports (#111)
* 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

* clean-up

* fix config.go

* clean master

* new ADS rule: newerr

* ADS-print working version

* ads-print final version

* ads-lost-err working version

* adds duplicated-imports rule

* adds duplicated-imports rule
2019-03-20 11:54:03 -07:00
Mario Pérez
d775d613d0
Adds missing rule in rules examples 2019-01-21 14:25:14 +01:00
xuri
9fccf1407f
Doc updated: fix typo 2018-11-06 10:28:24 +08:00
SalvadorC
55fe366696 call-to-gc (new rule) (#90) 2018-10-31 07:32:23 -07:00
mgechev
8e24648520
docs: update the documentation
I did some formatting:

- There were new lines in the middle of few sentences
- Added newlines before code blocks
- Removed trailing spaces

I also dropped statements in the form "This rule checks/does/warns...", when this was clear from the rule's explanation.
2018-10-25 20:29:31 -07:00
SalvadorC
3ef16e4c45 Doc rules description (#87)
* partial document

* complete list of rules descriptions

* Links rules in README to corresponding descriptions

* Update RULES_DESCRIPTIONS.md

Co-Authored-By: chavacava <salvadorcavadini+github@gmail.com>

* Update RULES_DESCRIPTIONS.md

Co-Authored-By: chavacava <salvadorcavadini+github@gmail.com>

* Update RULES_DESCRIPTIONS.md

Co-Authored-By: chavacava <salvadorcavadini+github@gmail.com>

* Update RULES_DESCRIPTIONS.md

Co-Authored-By: chavacava <salvadorcavadini+github@gmail.com>

* Update RULES_DESCRIPTIONS.md

Co-Authored-By: chavacava <salvadorcavadini+github@gmail.com>

* Update RULES_DESCRIPTIONS.md

Co-Authored-By: chavacava <salvadorcavadini+github@gmail.com>

* Update RULES_DESCRIPTIONS.md

Co-Authored-By: chavacava <salvadorcavadini+github@gmail.com>

* Update RULES_DESCRIPTIONS.md

Co-Authored-By: chavacava <salvadorcavadini+github@gmail.com>

* Update RULES_DESCRIPTIONS.md

Co-Authored-By: chavacava <salvadorcavadini+github@gmail.com>

* Update RULES_DESCRIPTIONS.md

Co-Authored-By: chavacava <salvadorcavadini+github@gmail.com>

* Update RULES_DESCRIPTIONS.md

Co-Authored-By: chavacava <salvadorcavadini+github@gmail.com>

* Update RULES_DESCRIPTIONS.md

Co-Authored-By: chavacava <salvadorcavadini+github@gmail.com>

* Update RULES_DESCRIPTIONS.md

Co-Authored-By: chavacava <salvadorcavadini+github@gmail.com>

* Update RULES_DESCRIPTIONS.md

Co-Authored-By: chavacava <salvadorcavadini+github@gmail.com>

* Update RULES_DESCRIPTIONS.md

Co-Authored-By: chavacava <salvadorcavadini+github@gmail.com>

* Update RULES_DESCRIPTIONS.md

Co-Authored-By: chavacava <salvadorcavadini+github@gmail.com>

* Update RULES_DESCRIPTIONS.md

Co-Authored-By: chavacava <salvadorcavadini+github@gmail.com>

* Update RULES_DESCRIPTIONS.md

Co-Authored-By: chavacava <salvadorcavadini+github@gmail.com>

* Update RULES_DESCRIPTIONS.md

Co-Authored-By: chavacava <salvadorcavadini+github@gmail.com>

* Update RULES_DESCRIPTIONS.md

Co-Authored-By: chavacava <salvadorcavadini+github@gmail.com>

* Update RULES_DESCRIPTIONS.md

Co-Authored-By: chavacava <salvadorcavadini+github@gmail.com>

* Update RULES_DESCRIPTIONS.md

Co-Authored-By: chavacava <salvadorcavadini+github@gmail.com>

* Update RULES_DESCRIPTIONS.md

Co-Authored-By: chavacava <salvadorcavadini+github@gmail.com>

* Update RULES_DESCRIPTIONS.md

Co-Authored-By: chavacava <salvadorcavadini+github@gmail.com>

* Update RULES_DESCRIPTIONS.md

Co-Authored-By: chavacava <salvadorcavadini+github@gmail.com>

* Update RULES_DESCRIPTIONS.md

Co-Authored-By: chavacava <salvadorcavadini+github@gmail.com>

* Update RULES_DESCRIPTIONS.md

Co-Authored-By: chavacava <salvadorcavadini+github@gmail.com>

* Update RULES_DESCRIPTIONS.md

Includes @mgechev remarks
2018-10-25 20:15:13 -07:00