ozanh/ugodev

View on GitHub

Showing 4 of 10 total issues

Function runWrapper has 76 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func runWrapper() js.Func {
    mm := ugo.NewModuleMap().
        AddBuiltinModule("time", ugotime.Module).
        AddBuiltinModule("strings", ugostrings.Module).
        AddBuiltinModule("fmt", ugofmt.Module).
Severity: Major
Found in playground/cmd/wasm/main.go - About 2 hrs to fix

    Function runWrapper has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
    Open

    func runWrapper() js.Func {
        mm := ugo.NewModuleMap().
            AddBuiltinModule("time", ugotime.Module).
            AddBuiltinModule("strings", ugostrings.Module).
            AddBuiltinModule("fmt", ugofmt.Module).
    Severity: Minor
    Found in playground/cmd/wasm/main.go - About 1 hr 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 Gosched has 8 return statements (exceeds 4 allowed).
    Open

    func Gosched(bc *ugo.Bytecode, callCount int64) (int, error) {
        // Generate following instructions to insert before backward jumps and
        // function start points.
        /*
            0000 CONSTANT <index>
    Severity: Major
    Found in patcher/patcher.go - About 50 mins to fix

      Function linesFromError has 6 return statements (exceeds 4 allowed).
      Open

      func linesFromError(err error) map[int][]error {
      
          switch v := err.(type) {
          case parser.ErrorList:
              out := make(map[int][]error)
      Severity: Major
      Found in playground/cmd/wasm/check.go - About 40 mins to fix
        Severity
        Category
        Status
        Source
        Language