Skip to content

Commit

Permalink
cmd/gocyclo: remove meaningless -total and -total-short options
Browse files Browse the repository at this point in the history
Fixes #47
  • Loading branch information
fzipp committed Jun 15, 2022
1 parent f2d3760 commit 62aa1f8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 18 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.6.0] - 2022-06-15
### Changed
- Breaking: remove meaningless `-total` and `-total-short` options

## [0.5.1] - 2022-04-06
### Fixed
- Don't skip directories `.` and `..`
Expand Down
2 changes: 0 additions & 2 deletions README.md
Expand Up @@ -51,8 +51,6 @@ Flags:
-top N show the top N most complex functions only
-avg, -avg-short show the average complexity over all functions;
the short option prints the value without a label
-total, -total-short show the total complexity for all functions;
the short option prints the value without a label
-ignore REGEX exclude files matching the given regular expression
The output fields for each line are:
Expand Down
16 changes: 0 additions & 16 deletions cmd/gocyclo/main.go
Expand Up @@ -16,8 +16,6 @@
// -top N show the top N most complex functions only
// -avg, -avg-short show the average complexity;
// the short option prints the value without a label
// -total, -total-short show the total complexity;
// the short option prints the value without a label
// -ignore REGEX exclude files matching the given regular expression
//
// The output fields for each line are:
Expand All @@ -44,8 +42,6 @@ Flags:
-top N show the top N most complex functions only
-avg, -avg-short show the average complexity over all functions;
the short option prints the value without a label
-total, -total-short show the total complexity for all functions;
the short option prints the value without a label
-ignore REGEX exclude files matching the given regular expression
The output fields for each line are:
Expand All @@ -57,8 +53,6 @@ func main() {
top := flag.Int("top", -1, "show the top N most complex functions only")
avg := flag.Bool("avg", false, "show the average complexity")
avgShort := flag.Bool("avg-short", false, "show the average complexity without a label")
total := flag.Bool("total", false, "show the total complexity")
totalShort := flag.Bool("total-short", false, "show the total complexity without a label")
ignore := flag.String("ignore", "", "exclude files matching the given regular expression")

log.SetFlags(0)
Expand All @@ -77,9 +71,6 @@ func main() {
if *avg || *avgShort {
printAverage(allStats, *avgShort)
}
if *total || *totalShort {
printTotal(allStats, *totalShort)
}

if *over > 0 && len(shownStats) > 0 {
os.Exit(1)
Expand Down Expand Up @@ -110,13 +101,6 @@ func printAverage(s gocyclo.Stats, short bool) {
fmt.Printf("%.3g\n", s.AverageComplexity())
}

func printTotal(s gocyclo.Stats, short bool) {
if !short {
fmt.Print("Total: ")
}
fmt.Printf("%d\n", s.TotalComplexity())
}

func usage() {
_, _ = fmt.Fprint(os.Stderr, usageDoc)
os.Exit(2)
Expand Down

0 comments on commit 62aa1f8

Please sign in to comment.