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

57 Commits

Author SHA1 Message Date
chavacava
611c6f7c81 firts working version 2019-12-14 08:27:06 +01:00
John Rinehart
40564c5052 support global config (e.g. for company-wide settings) (#233)
* support global config (e.g. for company-wide settings)

* documented global config behavior
2019-09-17 08:38:25 -07:00
SalvadorC
55cfae63e9 Conf reason rule disabling (#193)
* adds support for comments when enabling/disabling

* adds config flag to require disabling reason

* Update lint/file.go

adds code fmt suggestion by @mgechev

Co-Authored-By: Minko Gechev <mgechev@gmail.com>

* moves regexp compilation out of the function
fix typo in condition

* adds support for comments when enabling/disabling

* skips incomplete directives and generate a failure

* adds _directive_ concept to cope with specify-disable-reason

* adds doc
gofmt

* fixes severity is ignored
2019-08-02 08:21:33 -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
SalvadorC
55fe366696 call-to-gc (new rule) (#90) 2018-10-31 07:32:23 -07:00
mgechev
2020b30eef
feat: add links to rules in formatters
This PR introduces:

- A new formatter called "plain" which produces the same output as "default" but also appends link to the rule
- The "friendly" and "stylish" formatters now have URLs to the rules instead of the rule names
- Update of the README, adding the "unix" and "plain" formatters
2018-10-30 16:07:32 -07:00
xuri
3c177e2824 New rule: line-length-limit (#86)
* New rule: line-length-limit

* simplify the panic message of rule line-length-limit

* Refactors `line-length-limit` rule, use private `check` method instead of `Visit`
2018-10-19 08:18:33 -04:00
Genadi Samokovarov
d2e0e5a0ed Introduce the empty-lines rule that verifies there are no {head,trail}ing lines (#81) 2018-10-11 14:52:46 -07:00
xuri
7d2c43c827
Rename rule name waitgroup-by-copy to waitgroup-by-value 2018-10-03 16:01:41 +08:00
xuri
c781c8b090
Fix rule name in README, and format code. 2018-10-03 14:12:19 +08:00
xuri
9545122d39 New rule: atomic (#77) 2018-10-01 12:24:17 -07:00
SalvadorC
6ebe5bbb1e waitgroup-by-value (new rule) (#76)
* waitgroup-by-value (new rule)

* code simplification
2018-09-30 12:29:11 -07:00
xuri
924e3db3ba
Rename rule range-loop-var to range-val-in-closure. 2018-09-29 11:32:32 +08:00
xuri
b34a6c053e
New rule: range-loop-var 2018-09-27 23:21:10 +08:00
Pavel Sapezhko
20b1f54a85 Add missed max-public-structs rule to all list (#69) 2018-09-18 08:19:25 -07:00
Sylvain Kerkour
02575a7674 Add the imports-blacklist rule (#68)
* Add the imports-blacklist rule with tests

* Add the imports-blacklist rule to README.md

* Update the imports-blacklist rule to use map[string]bool so that we can have the algorithm in Visit below with O(n) instead of O(n*m)

* Fix the imports-blacklist rule to be case sensitive
2018-09-17 13:06:42 -07:00
SalvadorC
7240bd56d0
Merge pull request #62 from xuri/return-value-limit
New rule: return-result-limit
2018-09-17 21:56:59 +02:00
Sylvain Kerkour
2e16582cbc New formatter: unix (#65) 2018-09-17 11:57:56 -07:00
xuri
0c243f004c
Rename rule return-argument-limit to function-result-limit 2018-09-17 17:06:53 +08:00
xuri
f0ec17c8d5
New rule: return-argument-limit 2018-09-17 15:22:07 +08:00
SalvadorC
f004425b6e redefines-builtin-id (new rule) (#60) 2018-09-13 19:19:49 -07:00
SalvadorC
81bdff4472 constant-logical-expr (new rule) (#55)
* suspicious-logical-expr (new rule)

* renames 'suspicious-logical-expression' to 'constant-logical-expression'
2018-08-23 11:45:10 -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
SalvadorC
613fd24a3b modifies-value-receiver (new rule) (#51) 2018-08-13 15:18:28 -07:00
SalvadorC
6fa95fb6ba struct-tag (new rule) (#47) 2018-07-28 09:07:31 -07:00
SalvadorC
0404d66548 unnecessary-stmt (new rule) (#45)
* simpler (new rule)

* simpler: checks unitary switches

* unnecessary-stmt (new rule)
2018-07-27 22:38:39 -07:00
SalvadorC
3d8d46af0b flag-parameter (new rule) (#44)
* flag-parameter (new rule)

* fix failure confidence
2018-07-21 22:58:48 -07:00
chavacava
5248ad8ed9 add-constant (new rule) (#39) 2018-07-17 12:21:27 -07:00
chavacava
db6c522a37 New rule: unreachable-code (#38)
* 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

* removes ads-* rules

* rule unreachable-code

* unreachable-code refactored version

* skip corner case of mandatory return
2018-07-16 14:23:47 -07:00
chavacava
439cef2893 New formatter: checkstyle (#37)
* 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

* removes ads-* rules

* Adds checkstyle formatter

* Update README.md

fix typo
2018-07-15 12:45:15 -07:00
Markus Wiegand
095a25d375 Add formatter NDJSON (#34)
* Add formatter json-stream

* use new json struct in json-stream

* rename json-stream formatter to ndjson

* add ndjson formatter to readme
2018-07-13 15:01:27 -07:00
chavacava
c2e2dbac85 New rule: unused-parameter (#28)
* 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

* unused-parameter: working version

* WIP adds scopes - still imprecise ( eg a:=a is not detected as use)

* w/scopes and more precise

* adds test on structs

* adds test w/ var shadowing

* more precise handling of for/switch statements

* fix check of +=, -=, *= and the like. Adds better support for slices and switchs
2018-07-07 18:40:02 +10:00
chavacava
b8eababb0d New rule: confusing-results (#27)
* 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

* confusing-results working version
2018-07-02 12:09:58 +10:00
chavacava
443bfc9e0b New rule: Confusing naming (#16)
* 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

* draft working version

* cleaner version + more informative messages

* adds check on struct field names

* confusing-namming: fix tests
2018-07-02 12:05:20 +10:00
chavacava
68deb55492 New rule deep-exit (#26)
* 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

* deep-exit: first working version

* fix pbs from  @mgechev review

* deep-exit: modifies failure message
2018-06-27 06:21:03 +10:00
chavacava
b2532b3c33 New rule: modifies-parameter (#25)
* 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

* working version
2018-06-24 17:26:21 +10:00
chavacava
f8c1094ecd New rule: get-return (#23)
* 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

* clean master

* running version

* isGetter now checks for non lowercase characters
2018-06-22 21:21:09 +10:00
mgechev
1b84ff83dd
Add missing rule in config 2018-06-08 14:22:21 -07:00
chavacava
1fa5046357 Adds new rule empty-block (#14)
* Adds rule superfluous-else (an extension of indent-error-flow)

* initial (non functional) version

* empty-block working version

* adds tests for empty-block rule

* Adds empty-block to the rules table

* code clean-up
2018-06-08 12:41:49 -07:00
mgechev
64636caedd
Fix package level type checking 2018-05-31 19:49:39 -07:00
mgechev
21ff630a2b
Same behavior as golint with no arguments 2018-05-30 18:31:38 -07:00
mgechev
9e52d7ffdd
Use new dots 2018-05-30 17:03:27 -07:00
mgechev
6c9ea8cf2d
Refactoring and renaming 2018-05-26 21:28:31 -07:00
mgechev
8c53dad5ec
Rename and docs 2018-05-26 16:14:36 -07:00
mgechev
87860f3d8a
Add new formatter 2018-05-26 13:47:16 -07:00
mgechev
b8e1c67e9c
Rename formatter 2018-05-26 12:08:02 -07:00