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

1218 Commits

Author SHA1 Message Date
renovate[bot]
8b973cb1c5 fix(deps): update module github.com/spf13/afero to v1.13.0 (#1270)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-15 10:04:51 +01:00
AxiomaticFixedChimpanzee
b77bb1a9db fix: cognitive complexity nesting with if-else chains (#1268)
* test: prove bug in cognitive complexity rule

* fix: cognitive complexity nesting with if-else chains

Currently, an if-else chain will increase the nesting level and add the
nesting increment for every addition `else if` statement in an if-else
chain. This is incorrect behaviour; an `else if` statement should
increment complexity by 1 (regardless of current nesting level) and
leave the nesting level as-is.

For example, the following should yield a total complexity of 5:
```
for { // +1
    if a { // +2 (nesting = 1)
        foo()
    } else if b { // +1
        bar()
    } else if c { // +1
        baz()
    }
}
```

but the current implementation incorrectly increments the nesting level
with each `else if` and adds the nesting increment where it shouldn't:
```
for { // +1
    if a { // +2 (nesting = 1)
        foo()
    } else if b { // +3 (nesting = 2)
        bar()
    } else if c { // +4 (nesting = 3)
        baz()
    }
}
```
2025-03-13 08:31:26 +01:00
Oleksandr Redko
6d0498cb97 refactor: simplify File.disabledIntervals, add tests (#1216) 2025-03-07 06:18:24 +01:00
renovate[bot]
dc3de104c4 chore(deps): update module golang.org/x/text to v0.23.0 (#1259) 2025-03-07 06:16:36 +01:00
renovate[bot]
39ae68321a fix(deps): update module golang.org/x/tools to v0.31.0 (#1261)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-06 13:47:09 -08:00
chavacava
54ea25b718 doc: update description of struct-tag rule (#1262) 2025-03-06 22:38:54 +01:00
renovate[bot]
c940fa671b fix(deps): update module golang.org/x/mod to v0.24.0 (#1258) 2025-03-06 08:32:34 +01:00
renovate[bot]
c9c079f295 chore(deps): update module golang.org/x/sys to v0.31.0 (#1257) 2025-03-06 08:32:04 +01:00
chavacava
88d5434cee feature: add support for TOML struct tags in struct-tag rule (#1255) 2025-03-03 13:19:40 +01:00
Oleksandr Redko
b04d5a71b6 refactor: return error instead of panic (#1252) 2025-02-26 22:27:31 +01:00
Oleksandr Redko
77f4474cab refactor: string-format implements ConfigurableRule (#1251) 2025-02-26 22:26:21 +01:00
Oleksandr Redko
67d0a61a1b fix: error-strings custom funcs overwrites defaults (#1249) 2025-02-26 22:16:06 +01:00
Oleksandr Redko
9177f5044a test: re-enable and fix test case for getVersion (#1246) 2025-02-21 17:33:13 +01:00
Oleksandr Redko
8cd85e4e6c docs: describe configuration for error-strings rule (#1245) 2025-02-21 17:29:40 +01:00
chavacava
3bbfedbf43 feature: add suport of validate struct tags in struct-tag rule (#1244) 2025-02-20 19:48:35 +01:00
chavacava
4f342352f0 feature: add suport of mapstructure struct tags in struct-tag rule (#1241) 2025-02-19 14:30:29 +01:00
chavacava
a4ee892836 feature: add support of datastore struct tags in struct-tag rume (#1240) 2025-02-18 13:09:31 +01:00
chavacava
3cf67c5783 feature: add support of URL struct tags in struct-tag rule (#1239) 2025-02-17 07:18:30 +01:00
chavacava
8ece20b078 feature: add support for omitzero in rule struct-tag (#1238) v1.7.0 2025-02-16 11:31:17 +01:00
renovate[bot]
a59a2288fd chore(deps): update golang docker tag to v1.24 (#1232)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-13 17:07:22 +01:00
chavacava
4020f4387e fix: exclusions are no longer working as before (#1237)
* fix: exclusions are no longer working as before (fixed by reverting #1060)

* removes failing test on main.GetVersion
2025-02-13 14:38:55 +01:00
Ludovic Fernandez
9a54195228 fix: panic with getFieldTypeName (#1229)
* fix: panic with interface type and array

* replaces panic with a return of a default string

* review

---------

Co-authored-by: chavacava <salvadorcavadini+github@gmail.com>
v1.6.1
2025-02-12 14:10:48 +01:00
renovate[bot]
3e3e9825db fix(deps): update module golang.org/x/tools to v0.30.0 (#1227) 2025-02-11 17:10:03 +01:00
renovate[bot]
82dd1920b0 chore(deps): update module golang.org/x/sys to v0.30.0 (#1224)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-04 20:56:31 +01:00
renovate[bot]
f66fd1eb75 chore(deps): update module golang.org/x/text to v0.22.0 (#1225)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-04 20:52:16 +01:00
renovate[bot]
d04f429918 fix(deps): update module golang.org/x/sync to v0.11.0 (#1220)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-04 19:59:36 +01:00
renovate[bot]
ea0222b242 fix(deps): update module golang.org/x/mod to v0.23.0 (#1219)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-04 19:53:48 +01:00
renovate[bot]
3b54068168 chore(deps): update module github.com/stretchr/testify to v1.10.0 (#1223)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-04 19:49:47 +01:00
renovate[bot]
d02fd30f5c chore(deps): update module github.com/mattn/go-colorable to v0.1.14 (#1222)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-02-04 19:49:27 +01:00
Denis Voytyuk
c237f70575 Update renovate.json config (#1221) 2025-02-04 19:45:32 +01:00
Marcin Federowicz
e8b55f8917 prepareSkips: to resolve regexps in excludes (#1060)
* prepareSkips: to resolve regexps in excludes

* prepareSkips: to resolve regexps in excludes

* cleanup

* errorf: format

* doublestar/v4: latest version
2025-02-04 19:17:59 +01:00
chavacava
fd8d99d716 fix (1217): getting parameter type names panics in presence of generic types (#1218) 2025-02-04 12:26:17 +01:00
Oleksandr Redko
a34327e65c chore: check go.mod and run gofmt in CI (#1215) 2025-01-29 18:11:05 +01:00
chavacava
4bd6fbac97 fix: unconditional-recursion false positive when the function is called right after its declaration (#1212) (#1214) 2025-01-29 17:24:22 +01:00
Semih Buyukgungor
5f01efa722 feature: add redundant-test-main-exit rule (#1208) 2025-01-29 14:36:00 +01:00
chavacava
8c5d8fc90a fix: flag-parameter rule wrongly detects var definition and points to the function signature (#1213) 2025-01-28 14:53:32 +01:00
Oleksandr Redko
a600be2470 docs: fix TOC in README (#1210) 2025-01-28 11:32:05 +01:00
ccoVeille
8cb2599624 fix: invalid message reported for directive comment (#1209)
They were invalid but not reported with the correct message.

So they were wrongly caught by golangci-lint that excluded them by default.
2025-01-27 07:12:16 +01:00
Oleksandr Redko
d9c61c1518 fix: running revive in CI (#1205)
* fix: running revive in CI

* fix line-length-limit issue
v1.6.0
2025-01-23 09:17:24 +01:00
Marcin Federowicz
111737201e update doc (#1203)
* update doc

* review updates

* review updates
2025-01-23 09:15:44 +01:00
Oleksandr Redko
77616f0d30 refactor: fix 'use-any' revive issues (#1204) 2025-01-22 16:45:41 +01:00
Denis Voytyuk
7d97f5481a [chore] clean up go.sum (#1201) 2025-01-21 17:38:21 +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
renovate[bot]
57fe5b63d4 fix(deps): update module github.com/spf13/afero to v1.12.0 (#1200)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-01-18 12:15:20 +01:00
Oleksandr Redko
63afe4af77 docs: update "Text Editors" section (#1199)
* docs: update "Text Editors" section

* Fix VSCode setting name
2025-01-10 09:06:41 +01:00
renovate[bot]
4ba2c562ed fix(deps): update module golang.org/x/tools to v0.29.0 (#1198)
* fix(deps): update module golang.org/x/tools to v0.29.0

* Fix go.sum

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Denis Voytyuk <5462781+denisvmedia@users.noreply.github.com>
2025-01-08 19:44:06 +01:00
Denis Voytyuk
4b2c76e8b9 chore: cleanup code in rules (#1197) 2024-12-31 12:33:51 +01:00
Oleksandr Redko
4ca2c11e87 refactor: get rid of mitchellh/go-homedir package (#1195) 2024-12-24 15:34:17 +01:00
Oleksandr Redko
7998011cac fix: return configure rule error (#1193) 2024-12-23 15:10:21 +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