Showing 193 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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            func (m *MetaObject) SignalID(name, sig string) (uint32, error) {
                for _, signal := range m.Signals {
                    if signal.Name == name &&
                        signal.Signature == sig {
                        return signal.Uid, nil
            Severity: Major
            Found in type/object/metaobject_decorator.go and 1 other location - About 2 hrs to fix
            type/object/metaobject_decorator.go on lines 84..110

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 242.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            func (m *MetaObject) PropertyID(name, sig string) (uint32, error) {
                for _, property := range m.Properties {
                    if property.Name == name &&
                        property.Signature == sig {
                        return property.Uid, nil
            Severity: Major
            Found in type/object/metaobject_decorator.go and 1 other location - About 2 hrs to fix
            type/object/metaobject_decorator.go on lines 54..78

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 242.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            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

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                func nodifyProperty(nodes []signature.Node) signature.Node {
                    if ok, err := checkError(nodes); ok {
                        return fmt.Errorf("parse method: %s", err)
                    }
                    paramNode := nodes[3]
                Severity: Major
                Found in meta/idl/parser.go and 1 other location - About 2 hrs to fix
                meta/idl/parser.go on lines 710..728

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 200.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                func nodifySignal(nodes []signature.Node) signature.Node {
                    if ok, err := checkError(nodes); ok {
                        return fmt.Errorf("parse method: %s", err)
                    }
                    paramNode := nodes[3]
                Severity: Major
                Found in meta/idl/parser.go and 1 other location - About 2 hrs to fix
                meta/idl/parser.go on lines 731..749

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 200.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                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

                  Similar blocks of code found in 10 locations. Consider refactoring.
                  Open

                  func NewUint8Type() Type {
                      return &typeConstructor{
                          signature:    "C",
                          signatureIDL: "uint8",
                          typeName:     jen.Uint8(),
                  Severity: Major
                  Found in meta/signature/type.go and 9 other locations - About 2 hrs to fix
                  meta/signature/type.go on lines 133..149
                  meta/signature/type.go on lines 171..187
                  meta/signature/type.go on lines 190..206
                  meta/signature/type.go on lines 209..225
                  meta/signature/type.go on lines 228..244
                  meta/signature/type.go on lines 247..263
                  meta/signature/type.go on lines 266..282
                  meta/signature/type.go on lines 285..301
                  meta/signature/type.go on lines 304..320

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 199.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 10 locations. Consider refactoring.
                  Open

                  func NewDoubleType() Type {
                      return &typeConstructor{
                          signature:    "d",
                          signatureIDL: "float64",
                          typeName:     jen.Float64(),
                  Severity: Major
                  Found in meta/signature/type.go and 9 other locations - About 2 hrs to fix
                  meta/signature/type.go on lines 133..149
                  meta/signature/type.go on lines 152..168
                  meta/signature/type.go on lines 171..187
                  meta/signature/type.go on lines 190..206
                  meta/signature/type.go on lines 209..225
                  meta/signature/type.go on lines 228..244
                  meta/signature/type.go on lines 247..263
                  meta/signature/type.go on lines 266..282
                  meta/signature/type.go on lines 285..301

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 199.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 10 locations. Consider refactoring.
                  Open

                  func NewUint16Type() Type {
                      return &typeConstructor{
                          signature:    "W",
                          signatureIDL: "uint16",
                          typeName:     jen.Uint16(),
                  Severity: Major
                  Found in meta/signature/type.go and 9 other locations - About 2 hrs to fix
                  meta/signature/type.go on lines 133..149
                  meta/signature/type.go on lines 152..168
                  meta/signature/type.go on lines 171..187
                  meta/signature/type.go on lines 209..225
                  meta/signature/type.go on lines 228..244
                  meta/signature/type.go on lines 247..263
                  meta/signature/type.go on lines 266..282
                  meta/signature/type.go on lines 285..301
                  meta/signature/type.go on lines 304..320

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 199.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 10 locations. Consider refactoring.
                  Open

                  func NewLongType() Type {
                      return &typeConstructor{
                          signature:    "l",
                          signatureIDL: "int64",
                          typeName:     jen.Int64(),
                  Severity: Major
                  Found in meta/signature/type.go and 9 other locations - About 2 hrs to fix
                  meta/signature/type.go on lines 133..149
                  meta/signature/type.go on lines 152..168
                  meta/signature/type.go on lines 171..187
                  meta/signature/type.go on lines 190..206
                  meta/signature/type.go on lines 209..225
                  meta/signature/type.go on lines 228..244
                  meta/signature/type.go on lines 266..282
                  meta/signature/type.go on lines 285..301
                  meta/signature/type.go on lines 304..320

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 199.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 10 locations. Consider refactoring.
                  Open

                  func NewFloatType() Type {
                      return &typeConstructor{
                          signature:    "f",
                          signatureIDL: "float32",
                          typeName:     jen.Float32(),
                  Severity: Major
                  Found in meta/signature/type.go and 9 other locations - About 2 hrs to fix
                  meta/signature/type.go on lines 133..149
                  meta/signature/type.go on lines 152..168
                  meta/signature/type.go on lines 171..187
                  meta/signature/type.go on lines 190..206
                  meta/signature/type.go on lines 209..225
                  meta/signature/type.go on lines 228..244
                  meta/signature/type.go on lines 247..263
                  meta/signature/type.go on lines 266..282
                  meta/signature/type.go on lines 304..320

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 199.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Severity
                  Category
                  Status
                  Source
                  Language