Showing 191 of 191 total issues

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

func NewIntType() Type {
    return &typeConstructor{
        signature:    "i",
        signatureIDL: "int32",
        typeName:     jen.Int32(),
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 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

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 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 2 locations. Consider refactoring.
Open

func WriteN(w io.Writer, buf []byte, length int) error {
    size := 0
    for size < length {
        write, err := w.Write(buf[size:])
        size += write
Severity: Major
Found in type/basic/basic.go and 1 other location - About 2 hrs to fix
type/basic/basic.go on lines 16..36

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 198.

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 ReadN(r io.Reader, buf []byte, length int) error {
    size := 0
    for size < length {
        read, err := r.Read(buf[size:])
        size += read
Severity: Major
Found in type/basic/basic.go and 1 other location - About 2 hrs to fix
type/basic/basic.go on lines 41..61

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 198.

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

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

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

    func (s *StructType) Type() reflect.Type {
        fields := make([]reflect.StructField, len(s.Members))
        var offset uintptr = 0
        for i, m := range s.Members {
            typ := m.Type.Type()
    Severity: Major
    Found in meta/signature/type.go and 1 other location - About 1 hr to fix
    meta/signature/type.go on lines 853..869

    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 186.

    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 generatePropertyHelper(file *jen.File, itf *idl.InterfaceType,
        property idl.Property, propertyName string) error {
        tuple := property.Tuple()
    
        body, err := propertyBodyBlock(itf, property, propertyName)
    Severity: Major
    Found in meta/stub/stub.go and 1 other location - About 1 hr to fix
    meta/stub/stub.go on lines 283..295

    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 186.

    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 (t *TupleType) Type() reflect.Type {
        fields := make([]reflect.StructField, len(t.Members))
        var offset uintptr = 0
        for i, m := range t.Members {
            typ := m.Type.Type()
    Severity: Major
    Found in meta/signature/type.go and 1 other location - About 1 hr to fix
    meta/signature/type.go on lines 1016..1032

    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 186.

    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 generateSignalHelper(file *jen.File, itf *idl.InterfaceType,
        signal idl.Signal, signalName string) error {
        tuple := signal.Tuple()
    
        body, err := signalBodyBlock(itf, signal, signalName)
    Severity: Major
    Found in meta/stub/stub.go and 1 other location - About 1 hr to fix
    meta/stub/stub.go on lines 297..309

    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 186.

    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

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

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

                  metaSignals := func(d jen.Dict) {
                      for _, signal := range itf.Signals {
                          d[jen.Lit(int(signal.ID))] = jen.Values(jen.Dict{
                              jen.Id("Uid"):  jen.Lit(int(signal.ID)),
                              jen.Id("Name"): jen.Lit(signal.Name),
              Severity: Major
              Found in meta/stub/stub.go and 1 other location - About 1 hr to fix
              meta/stub/stub.go on lines 377..387

              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 163.

              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

                  metaProperties := func(d jen.Dict) {
                      for _, property := range itf.Properties {
                          d[jen.Lit(int(property.ID))] = jen.Values(jen.Dict{
                              jen.Id("Uid"):  jen.Lit(int(property.ID)),
                              jen.Id("Name"): jen.Lit(property.Name),
              Severity: Major
              Found in meta/stub/stub.go and 1 other location - About 1 hr to fix
              meta/stub/stub.go on lines 366..376

              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 163.

              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

              package main
              
              import (
                  "flag"
                  "log"
              Severity: Major
              Found in meta/cmd/stub/main.go and 1 other location - About 1 hr to fix
              meta/cmd/proxy/main.go on lines 1..23

              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 153.

              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