Showing 82 of 193 total issues

File type.go has 883 lines of code (exceeds 500 allowed). Consider refactoring.
Open

package signature

import (
    "bytes"
    "fmt"
Severity: Major
Found in meta/signature/type.go - About 1 day to fix

    File parser.go has 758 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    package idl
    
    import (
        "fmt"
        "io"
    Severity: Major
    Found in meta/idl/parser.go - About 1 day to fix

      File stub.go has 731 lines of code (exceeds 500 allowed). Consider refactoring.
      Open

      package stub
      
      import (
          "fmt"
          "io"
      Severity: Minor
      Found in meta/stub/stub.go - About 7 hrs to fix

        Method qiDecoder.value has a Cognitive Complexity of 44 (exceeds 20 allowed). Consider refactoring.
        Open

        func (q qiDecoder) value(v reflect.Value) error {
            switch v.Kind() {
            case reflect.Interface:
                i := v.Interface()
                b, ok := i.(BinaryDecoder)
        Severity: Minor
        Found in type/encoding/encoding.go - About 4 hrs 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

        File proxy.go has 586 lines of code (exceeds 500 allowed). Consider refactoring.
        Open

        package idl
        
        import (
            "fmt"
        
        
        Severity: Minor
        Found in meta/idl/proxy.go - About 4 hrs to fix

          Method qiDecoder.value has 112 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (q qiDecoder) value(v reflect.Value) error {
              switch v.Kind() {
              case reflect.Interface:
                  i := v.Interface()
                  b, ok := i.(BinaryDecoder)
          Severity: Major
          Found in type/encoding/encoding.go - About 3 hrs to fix

            Function trace has a Cognitive Complexity of 34 (exceeds 20 allowed). Consider refactoring.
            Open

            func trace(serverURL, serviceName string, objectID uint32) {
            
                sess, err := session.NewSession(serverURL)
                if err != nil {
                    log.Fatalf("%s: %s", serverURL, err)
            Severity: Minor
            Found in cmd/qiloop/trace.go - About 2 hrs 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 generateObjectInterface has 89 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func generateObjectInterface(file *jen.File, set *signature.TypeSet,
                itf *idl.InterfaceType) error {
            
                // Proxy and stub shall generate the name method name: reuse
                // the MetaObject method ForEachMethodAndSignal to get an
            Severity: Major
            Found in meta/stub/stub.go - About 2 hrs to fix

              Function generateObjectInterface has 86 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func generateObjectInterface(itf *InterfaceType, serviceName string,
                  file *jen.File) error {
              
                  definitions := make([]jen.Code, 0)
              
              
              Severity: Major
              Found in meta/idl/proxy.go - About 2 hrs to fix

                Method qiEncoder.value has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
                Open

                func (q qiEncoder) value(v reflect.Value) error {
                    switch v.Kind() {
                    case reflect.Interface:
                        i := v.Interface()
                        w, ok := i.(BinaryEncoder)
                Severity: Minor
                Found in type/encoding/encoding.go - About 2 hrs 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 generateProxyType has 79 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func generateProxyType(file *jen.File, serviceName, ProxyName string,
                    itf *InterfaceType) {
                
                    file.Comment(ProxyName + " implements " + objName(serviceName))
                    if ProxyName == proxyName("Object") || ProxyName == proxyName("ServiceZero") {
                Severity: Major
                Found in meta/idl/proxy.go - About 2 hrs to fix

                  Method client.Call has 74 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (c *client) Call(cancel <-chan struct{}, serviceID, objectID, actionID uint32,
                      payload []byte) ([]byte, error) {
                  
                      // Do nothing if cancel is already closed.
                      if cancel != nil {
                  Severity: Minor
                  Found in bus/client.go - About 1 hr to fix

                    Method qiDecoder.value has 21 return statements (exceeds 4 allowed).
                    Open

                    func (q qiDecoder) value(v reflect.Value) error {
                        switch v.Kind() {
                        case reflect.Interface:
                            i := v.Interface()
                            b, ok := i.(BinaryDecoder)
                    Severity: Major
                    Found in type/encoding/encoding.go - About 1 hr to fix

                      Function methodBodyBlock2 has 71 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func methodBodyBlock2(method Method, params *signature.TupleType,
                          ret signature.Type) (*Statement, error) {
                          writing := []jen.Code{}
                          if ret.Signature() == "v" {
                              writing = append(writing, jen.Var().Id("ret").Struct())
                      Severity: Minor
                      Found in meta/idl/proxy.go - About 1 hr to fix

                        Method qiEncoder.value has 71 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func (q qiEncoder) value(v reflect.Value) error {
                            switch v.Kind() {
                            case reflect.Interface:
                                i := v.Interface()
                                w, ok := i.(BinaryEncoder)
                        Severity: Minor
                        Found in type/encoding/encoding.go - About 1 hr to fix

                          Function trace has 68 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func trace(serverURL, serviceName string, objectID uint32) {
                          
                              sess, err := session.NewSession(serverURL)
                              if err != nil {
                                  log.Fatalf("%s: %s", serverURL, err)
                          Severity: Minor
                          Found in cmd/qiloop/trace.go - About 1 hr to fix

                            Function generateStubMetaObject has 68 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func generateStubMetaObject(file *jen.File, itf *idl.InterfaceType) error {
                                metaMethods := func(d jen.Dict) {
                                    for _, method := range itf.Methods {
                                        d[jen.Lit(int(method.ID))] = jen.Values(jen.Dict{
                                            jen.Id("Uid"): jen.Lit(int(method.ID)),
                            Severity: Minor
                            Found in meta/stub/stub.go - About 1 hr to fix

                              Function logger has 64 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              func logger(serverURL string, level uint32) {
                              
                                  stat, err := os.Stdout.Stat()
                                  if err != nil {
                                      log.Fatal(err)
                              Severity: Minor
                              Found in cmd/qiloop/log.go - About 1 hr to fix

                                Function init has 58 lines of code (exceeds 50 allowed). Consider refactoring.
                                Open

                                func init() {
                                    flaggy.SetName("qiloop")
                                    description := fmt.Sprintf("%s\n\n%s",
                                        "an utility to explore QiMessaging",
                                        asciibot.Random())
                                Severity: Minor
                                Found in cmd/qiloop/main.go - About 1 hr to fix

                                  Function generateStubObject has 58 lines of code (exceeds 50 allowed). Consider refactoring.
                                  Open

                                  func generateStubObject(file *jen.File, itf *idl.InterfaceType) error {
                                      writing := make([]jen.Code, 0)
                                      if itf.Name == "Object" {
                                          code := jen.Id(`p.signal.Activate(activation)`)
                                          writing = append(writing, code)
                                  Severity: Minor
                                  Found in meta/stub/stub.go - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language