1set/starlet

View on GitHub

Showing 84 of 84 total issues

Function convertToDict has 5 return statements (exceeds 4 allowed).
Open

func convertToDict(thread *starlark.Thread, b *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
    var v starlark.Value
    if err := starlark.UnpackArgs(b.Name(), args, kwargs, "v", &v); err != nil {
        return nil, err
    }
Severity: Major
Found in lib/goidiomatic/idiomatic.go - About 35 mins to fix

    Function sharedDictFromJSON has 5 return statements (exceeds 4 allowed).
    Open

    func sharedDictFromJSON(thread *starlark.Thread, b *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
        // check the arguments
        var s tps.StringOrBytes
        if err := starlark.UnpackArgs(b.Name(), args, kwargs, "x", &s); err != nil {
            return nil, err
    Severity: Major
    Found in dataconv/share.go - About 35 mins to fix

      Method Module.genLoggerBuiltin has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
      Open

      func (m *Module) genLoggerBuiltin(name string, level zapcore.Level) starlark.Callable {
          return starlark.NewBuiltin(ModuleName+"."+name, func(thread *starlark.Thread, fn *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
              var msg string
              if len(args) <= 0 {
                  return nil, fmt.Errorf("%s: expected at least 1 argument, got 0", fn.Name())
      Severity: Minor
      Found in lib/log/zaplog.go - About 35 mins 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 processArgs has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
      Open

      func processArgs() int {
          // get starlet machine
          mac := starlet.NewWithNames(nil, preloadModules, lazyLoadModules)
          if allowRecursion {
              mac.EnableRecursionSupport()
      Severity: Minor
      Found in cmd/starlet/main.go - About 25 mins 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

      Severity
      Category
      Status
      Source
      Language