Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: fzipp/gocyclo
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: alecthomas/gocyclo
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Feb 8, 2015

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    aa8f8b1 View commit details
Showing with 4 additions and 7 deletions.
  1. +4 −7 gocyclo.go
11 changes: 4 additions & 7 deletions gocyclo.go
Original file line number Diff line number Diff line change
@@ -28,7 +28,6 @@ import (
"os"
"path/filepath"
"sort"
"strings"
)

const usageDoc = `Calculate cyclomatic complexities of Go functions.
@@ -105,12 +104,10 @@ func analyzeFile(fname string, stats []stat) []stat {
}

func analyzeDir(dirname string, stats []stat) []stat {
filepath.Walk(dirname, func(path string, info os.FileInfo, err error) error {
if err == nil && !info.IsDir() && strings.HasSuffix(path, ".go") {
stats = analyzeFile(path, stats)
}
return err
})
files, _ := filepath.Glob(filepath.Join(dirname, "*.go"))
for _, file := range files {
stats = analyzeFile(file, stats)
}
return stats
}