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

82 Commits

Author SHA1 Message Date
Oleksandr Redko
a295bebe6e refactor: enable godoclint linter in golangci-lint (#1576) 2025-11-14 08:02:48 -08:00
Oleksandr Redko
b73cca9e66 change: merge code-style with style categories (#1573)
* change: merge code-style with style categories

* deprecate variable
2025-11-09 18:18:26 +01:00
cce
ed85b79854 feature: add enableDefaultRules config option (#1551)
Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
2025-11-06 04:05:40 -08:00
chavacava
2db7034aca feature: new rule use-waitgroup-go (#1484) 2025-08-26 19:04:46 +02:00
Oleksandr Redko
b34c8e96ec refactor: fix musttag lint issues (#1464) 2025-08-11 01:43:23 -07:00
Asaf Krenzler
cc180e221e var-naming: option to skip initialism name checks (#1415)
Co-authored-by: akrenzler <akrenzler@paloaltonetworks@com>
Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
2025-07-11 04:45:38 -07:00
Oleksandr Redko
594e56503b chore: update golangci-lint; enable a few revive rules (#1420)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-11 04:19:23 -07:00
ccoVeille
e515d11480 unexported_return: exclude main package and test and tests files (#1399)
The content of these files cannot be imported by other packages,
so they are excluded from the unexported_return rule.
2025-06-06 09:48:30 +02:00
Oleksandr Redko
f4976873e7 docs: improve comments for functions; enable godot (#1382) 2025-05-27 07:44:24 +02:00
Oleksandr Redko
e8ed573739 refactor: enable gocritic linter; fix lint issues (#1375) 2025-05-26 02:40:17 -07:00
chavacava
94cd7bdec2 refactor: removes get from getters names (#1373) 2025-05-24 19:03:05 +02:00
Arjun Rajpal
26125211ba Integrate golangci-lint into CI/CD pipeline (#1346)
Co-authored-by: ccoVeille <3875889+ccoVeille@users.noreply.github.com>
Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
2025-05-16 05:12:23 -07:00
Oleksandr Redko
724a4ca419 chore: remove redundant //revive:disable-line (#1335) 2025-05-02 02:02:31 -07:00
Oleksandr Redko
1cb97fdcfc refactor: fix typos in comments and struct names (#1304) 2025-04-10 07:47:55 +02:00
Ludovic Fernandez
fbd90be544 fix: race condition of Package fields (#1307) 2025-04-10 07:44:38 +02:00
Oleksandr Redko
43a44af30f refactor: apply suggestions from gopls modernize (#1282) 2025-03-28 09:32:30 +01:00
chavacava
9919e6bbe0 refactor: replace IsAtLeastGo1* functions by IsAtLeastGoVersion (#1274) 2025-03-16 18:18:05 +01:00
Oleksandr Redko
6d0498cb97 refactor: simplify File.disabledIntervals, add tests (#1216) 2025-03-07 06:18:24 +01:00
chavacava
8ece20b078 feature: add support for omitzero in rule struct-tag (#1238) 2025-02-16 11:31:17 +01:00
Semih Buyukgungor
5f01efa722 feature: add redundant-test-main-exit rule (#1208) 2025-01-29 14:36:00 +01:00
Oleksandr Redko
77616f0d30 refactor: fix 'use-any' revive issues (#1204) 2025-01-22 16:45:41 +01:00
Oleksandr Redko
395f7902d3 refactor: replace failure Category raw string with constant (#1196)
* refactor: replace Category raw strings with constants

* Add type FailureCategory; add comments for constants
2025-01-18 12:16:19 +01:00
ccoVeille
3d1115dacd refactor: rule configuration and error management (#1185)
* refactor: avoid running rule once configuration failed

* refactor: remove deep-exit in lint/linter.go
2024-12-13 21:38:46 +01:00
ccoVeille
3421eaecf0 refactor: fix linting issues (#1188)
* refactor: fix thelper issues

test/utils_test.go:19:6   thelper  test helper function should start from t.Helper()
test/utils_test.go:42:6   thelper  test helper function should start from t.Helper()
test/utils_test.go:63:6   thelper  test helper function should start from t.Helper()
test/utils_test.go:146:6  thelper  test helper function should start from t.Helper()

* refactor: fix govet issues

rule/error_strings.go:50:21  govet  printf: non-constant format string in call to fmt.Errorf

* refactor: fix gosimple issue

rule/bare_return.go:52:9  gosimple  S1016: should convert w (type lintBareReturnRule) to bareReturnFinder instead of using struct literal

* refactor: fix errorlint issues

lint/filefilter.go:70:86    errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
lint/filefilter.go:113:104  errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
lint/filefilter.go:125:89   errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
lint/linter.go:166:72       errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
lint/linter.go:171:73       errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
config/config.go:174:57     errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
config/config.go:179:64     errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors

* refactor: fix revive issue about comment spacing

cli/main.go:31:2 revive comment-spacings: no space between comment delimiter and comment text

* refactor: fix revive issue about unused-receiver

revivelib/core_test.go:77:7                     revive       unused-receiver: method receiver 'r' is not referenced in method's body, consider removing or renaming it as _
revivelib/core_test.go:81:7                     revive       unused-receiver: method receiver 'r' is not referenced in method's body, consider removing or renaming it as _
rule/context_as_argument.go:76:7                revive       unused-receiver: method receiver 'r' is not referenced in method's body, consider removing or renaming it as _
rule/var_naming.go:73:7                         revive       unused-receiver: method receiver 'r' is not referenced in method's body, consider removing or renaming it as _
rule/modifies_value_receiver.go:59:7            revive       unused-receiver: method receiver 'r' is not referenced in method's body, consider removing or renaming it as _
rule/filename_format.go:43:7                    revive       unused-receiver: method receiver 'r' is not referenced in method's body, consider removing or renaming it as _

* refactor: fix revive issues about unused-parameter

revivelib/core_test.go:81:24                    revive       unused-parameter: parameter 'file' seems to be unused, consider removing or renaming it as _
revivelib/core_test.go:81:41                    revive       unused-parameter: parameter 'arguments' seems to be unused, consider removing or renaming it as _

* refactor: fix gocritic issues about commentedOutCode

test/utils_test.go:119:5                       gocritic  commentedOutCode: may want to remove commented-out code
rule/unreachable_code.go:65:3                  gocritic  commentedOutCode: may want to remove commented-out code
2024-12-12 08:42:41 +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
chavacava
f94c9d75db refactor: add all wait group delta at once when possible (#1179) 2024-12-08 16:59:52 +01:00
chavacava
e23fcdb498 refactor: modifies linting machinery to use Failure as a mean to signal erros in rules application (#1178) 2024-12-08 15:56:14 +01:00
chavacava
f6a38208af refactor: code cleanup (#1177) 2024-12-08 11:08:54 +01:00
Denis Voytyuk
cb74ccbf44 chore: Improve sortables detection (#1151)
Co-authored-by: chavacava <salvador.cavadini@gmail.com>
2024-12-02 13:02:39 +01:00
Oleksandr Redko
0afba4ff15 refactor: enforce map and slice style (#1131) 2024-11-16 18:05:30 +01:00
Oleksandr Redko
74e2417f7d fix: revive hangs on Windows if go.mod is not found 2024-11-15 09:37:53 +01:00
Oleksandr Redko
4c958ef739 refactor: remove redundant defer 2024-11-12 09:26:30 +01:00
centralab
c0d4d07ab6 fix: nil panic on old go.mod (issue #1100) 2024-11-11 18:50:12 +01:00
Oleksandr Redko
9a8587cc49 revive: add revive.toml for linting revive itself (#1094) 2024-11-04 09:18:17 -03:00
Oleksandr Redko
14babf2824 refactor: move lint.Name to name.go file (#1084) 2024-10-28 13:22:36 +01:00
Oleksandr Redko
d29323985f refactor: add tests for isGenerated in the lint package (#1083) 2024-10-28 08:24:10 -03:00
Oleksandr Redko
599874c773 chore: remove unnecessary empty lines (#1080) 2024-10-26 07:35:02 -03:00
Oleksandr Redko
662e02cd70 refactor: use "filepath" instead of "path" (#1073) 2024-10-25 11:48:41 +02:00
yuta nishiyama
6b745b0075 fix lint issues (#1038) 2024-09-16 09:32:34 +02:00
chavacava
251470be6a use a default Go version (1.0) in absence of go.mod (#1028) 2024-08-18 19:21:50 +02:00
chavacava
56702bd8d7 extract go version without depending on go list (#1025)
* extract go version without depending on go list

---------

Co-authored-by: chavacava <salvador.cavadini@gmail.com>
2024-08-18 09:53:45 +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
dominiquelefevre
0df1bb0860 Fix a performance regression #995 (#998)
* Support go workspaces when detecting the go version.

When a module is part of a workspace, a call to `go list -m` lists all
modules in the workspace, and we need to parse multiple modinfos.

* Do not invoke `go list` for every package.

* Add a go language version override config option for golangci-lint.
2024-06-22 17:12:49 +02:00
dominiquelefevre
4242f24f4d Add support for the new implementation of for loop variables in go 1.22. (#993)
* Add support for the new behaviour of for loops in go 1.22.

Go 1.22 has changed the behaviour of for loops. Every iteration
makes new loop variables. It is now safe to take their addresses
because they are guaranteed to be unique. Similarly, it is now
safe to capture loop variables in functions.

* adds documentation for public function

---------

Co-authored-by: chavacava <salvadorcavadini+github@gmail.com>
2024-06-02 11:55:26 +02: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
Marcin Federowicz
cd2737acb4 Load config from different locations prefer XDG_CONFIG_HOME before HOME (#912) 2023-10-03 20:07:00 +02: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
Fagim Sadykov
310d1d76e4 per-rule file exclude filters (#850) (#857) 2023-08-12 08:21:11 +02:00
Minko Gechev
71ef7fdcb9 Move to the default importer from gcexportdata (#723) 2022-08-06 09:42:15 +02:00