johnsonjh/jleveldb

View on GitHub
manualtest/dbstress/main.go

Summary

Maintainability
F
5 days
Test Coverage

Function main has a Cognitive Complexity of 194 (exceeds 20 allowed). Consider refactoring.
Open

func main() {
    flag.Parse()

    var src cryptoSource
    rnd := rand.New(src)
Severity: Minor
Found in manualtest/dbstress/main.go - About 3 days to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function main has 289 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func main() {
    flag.Parse()

    var src cryptoSource
    rnd := rand.New(src)
Severity: Major
Found in manualtest/dbstress/main.go - About 1 day to fix

    File main.go has 567 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    package main
    
    import (
        crand "crypto/rand"
        "encoding/binary"
    Severity: Minor
    Found in manualtest/dbstress/main.go - About 3 hrs to fix

      Method testingStorage.scanTable has 68 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (ts *testingStorage) scanTable(fd storage.FileDesc, checksum bool) (corrupted bool) {
          r, err := ts.Open(fd)
          if err != nil {
              log.Fatal(err)
          }
      Severity: Minor
      Found in manualtest/dbstress/main.go - About 1 hr to fix

        Method testingStorage.scanTable has 6 return statements (exceeds 4 allowed).
        Open

        func (ts *testingStorage) scanTable(fd storage.FileDesc, checksum bool) (corrupted bool) {
            r, err := ts.Open(fd)
            if err != nil {
                log.Fatal(err)
            }
        Severity: Major
        Found in manualtest/dbstress/main.go - About 40 mins to fix

          There are no issues that match your filters.

          Category
          Status