Skip to content

Commit

Permalink
gocomment-age (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolaydubina authored Nov 28, 2022
1 parent 5d85bb0 commit b850962
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
+ [➡ Detect non-exhaustive switch and map with `exhaustive`](#-detect-non-exhaustive-switch-and-map-with-exhaustive)
+ [➡ Detect usafe code with `go-safer`](#-detect-usafe-code-with-go-safer)
+ [➡ Calculate cognitive complexity with `gocognit`](#-calculate-cognitive-complexity-with-gocognit)
+ [➡ Calculate age of comments](#-calculate-age-of-comments)
- Code Generation
+ [➡ Run `go:generate` in parallel](#-run-gogenerate-in-parallel)
+ [➡ Generate `String` method for enum types](#-generate-string-method-for-enum-types)
Expand Down Expand Up @@ -840,6 +841,34 @@ Requirements
go install github.com/uudashr/gocognit/cmd/gocognit@latest
```
### [⏫](#contents)➡ Calculate age of comments
This go vet compatible tool analyses AST and git and collects details on how far comments drift from code they describe. — [@nikolaydubina](https://github.com/nikolaydubina)
```
go-commentage ./...
```
Example
```
kubernetes/pkg/util/ipset/ipset.go:283:1: "CreateSet": doc_last_updated_behind_days(1336.83)
kubernetes/pkg/util/ipset/ipset.go:296:1: "createSet": doc_last_updated_behind_days(1603.17)
kubernetes/pkg/util/ipset/ipset.go:320:1: "AddEntry": doc_last_updated_behind_days(1578.10)
kubernetes/pkg/util/ipset/ipset.go:332:1: "DelEntry": doc_last_updated_behind_days(1578.10)
kubernetes/pkg/util/ipset/ipset.go:340:1: "TestEntry": doc_last_updated_behind_days(450.07)
kubernetes/pkg/util/ipset/ipset.go:356:1: "FlushSet": doc_last_updated_behind_days(0.00)
kubernetes/pkg/util/ipset/ipset.go:364:1: "DestroySet": doc_last_updated_behind_days(73.85)
kubernetes/pkg/util/ipset/ipset.go:372:1: "DestroyAllSets": doc_last_updated_behind_days(0.00)
kubernetes/pkg/util/ipset/ipset.go:380:1: "ListSets": doc_last_updated_behind_days(0.00)
kubernetes/pkg/util/ipset/ipset.go:389:1: "ListEntries": doc_last_updated_behind_days(0.00)
```
Requirements
```
go install github.com/nikolaydubina/go-commentage@latest
```
## Code Generation
### [⏫](#contents)➡ Run `go:generate` in parallel
Expand Down
9 changes: 9 additions & 0 deletions page.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,15 @@ groups:
example_output_url: source/gocognit.out
requirements:
- go install github.com/uudashr/gocognit/cmd/gocognit@latest
- title: Calculate age of comments
description: This go vet compatible tool analyses AST and git and collects details on how far comments drift from code they describe.
author: https://github.com/nikolaydubina
commands:
- go-commentage ./...
example_output_url: source/go-commentage.out
requirements:
- # get latest version of git
- go install github.com/nikolaydubina/go-commentage@latest
- title: Code Generation
entries:
- title: Run `go:generate` in parallel
Expand Down
10 changes: 10 additions & 0 deletions source/go-commentage.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
kubernetes/pkg/util/ipset/ipset.go:283:1: "CreateSet": doc_last_updated_behind_days(1336.83)
kubernetes/pkg/util/ipset/ipset.go:296:1: "createSet": doc_last_updated_behind_days(1603.17)
kubernetes/pkg/util/ipset/ipset.go:320:1: "AddEntry": doc_last_updated_behind_days(1578.10)
kubernetes/pkg/util/ipset/ipset.go:332:1: "DelEntry": doc_last_updated_behind_days(1578.10)
kubernetes/pkg/util/ipset/ipset.go:340:1: "TestEntry": doc_last_updated_behind_days(450.07)
kubernetes/pkg/util/ipset/ipset.go:356:1: "FlushSet": doc_last_updated_behind_days(0.00)
kubernetes/pkg/util/ipset/ipset.go:364:1: "DestroySet": doc_last_updated_behind_days(73.85)
kubernetes/pkg/util/ipset/ipset.go:372:1: "DestroyAllSets": doc_last_updated_behind_days(0.00)
kubernetes/pkg/util/ipset/ipset.go:380:1: "ListSets": doc_last_updated_behind_days(0.00)
kubernetes/pkg/util/ipset/ipset.go:389:1: "ListEntries": doc_last_updated_behind_days(0.00)

0 comments on commit b850962

Please sign in to comment.