Showing 191 of 191 total issues

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

package main

import (
    "flag"
    "log"
Severity: Major
Found in meta/cmd/proxy/main.go and 1 other location - About 1 hr to fix
meta/cmd/stub/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

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

      Method Header.Read has 13 return statements (exceeds 4 allowed).
      Open

      func (h *Header) Read(r io.Reader) (err error) {
          if err = h.readMagic(r); err != nil {
              return fmt.Errorf("read message magic: %s", err)
          } else if h.Magic != Magic {
              return fmt.Errorf("invalid message magic: %x", h.Magic)
      Severity: Major
      Found in bus/net/message.go - About 1 hr to fix

        Method qiDecoder.Decode has 13 return statements (exceeds 4 allowed).
        Open

        func (q qiDecoder) Decode(x interface{}) (err error) {
            switch v := x.(type) {
            case CustomDecoder:
                return v.Decode(q)
            case BinaryDecoder:
        Severity: Major
        Found in type/encoding/encoding.go - About 1 hr to fix

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

          func (s Signal) Meta(id uint32) object.MetaSignal {
              var meta object.MetaSignal
              meta.Uid = id
              meta.Name = s.Name
              types := make([]signature.Type, 0)
          Severity: Major
          Found in meta/idl/interface.go and 1 other location - About 1 hr to fix
          meta/idl/interface.go on lines 164..174

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

          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 (p Property) Meta(id uint32) object.MetaProperty {
              var meta object.MetaProperty
              meta.Uid = id
              meta.Name = p.Name
              types := make([]signature.Type, 0)
          Severity: Major
          Found in meta/idl/interface.go and 1 other location - About 1 hr to fix
          meta/idl/interface.go on lines 120..130

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

          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 generateReceiveMethod has 55 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func generateReceiveMethod(file *jen.File, itf *idl.InterfaceType) error {
              writing := make([]jen.Code, 0)
          
              prelude := jen.Comment("action dispatch")
              if itf.Name == "Object" {
          Severity: Minor
          Found in meta/stub/stub.go - About 1 hr to fix

            Method qiDecoder.Decode has 55 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (q qiDecoder) Decode(x interface{}) (err error) {
                switch v := x.(type) {
                case CustomDecoder:
                    return v.Decode(q)
                case BinaryDecoder:
            Severity: Minor
            Found in type/encoding/encoding.go - About 1 hr to fix

              Function convertFrom has 54 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func convertFrom(v, w reflect.Value) error {
              
                  errConversion := fmt.Errorf("Failed to convert %v into %v",
                      v.Type(), w.Type())
              
              
              Severity: Minor
              Found in type/conversion/conversion.go - About 1 hr to fix

                Method client.Call has 11 return statements (exceeds 4 allowed).
                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: Major
                Found in bus/client.go - About 1 hr to fix

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

                  func DialEndPoint(addr string) (EndPoint, error) {
                      u, err := url.Parse(addr)
                      if err != nil {
                          return nil, fmt.Errorf("dial: invalid address: %s", err)
                      }
                  Severity: Major
                  Found in bus/net/endpoint.go and 1 other location - About 1 hr to fix
                  bus/net/listen.go on lines 125..142

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

                  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 Header.Write has 11 return statements (exceeds 4 allowed).
                  Open

                  func (h *Header) Write(w io.Writer) (err error) {
                      wrap := func(field string, err error) error {
                          return fmt.Errorf("write message %s: %s", field, err)
                      }
                      if err = h.writeMagic(w); err != nil {
                  Severity: Major
                  Found in bus/net/message.go - About 1 hr to fix

                    Function generateObjectInterface has 11 return statements (exceeds 4 allowed).
                    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 1 hr to fix

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

                      func Listen(addr string) (Listener, error) {
                          u, err := url.Parse(addr)
                          if err != nil {
                              return nil, fmt.Errorf("listen: invalid address: %s", err)
                          }
                      Severity: Major
                      Found in bus/net/listen.go and 1 other location - About 1 hr to fix
                      bus/net/endpoint.go on lines 207..224

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

                      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 methodBodyBlock has 52 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func methodBodyBlock(itf *idl.InterfaceType, method idl.Method,
                          methodName string) (*jen.Statement, error) {
                      
                          writing := make([]jen.Code, 0)
                          params := make([]jen.Code, 0)
                      Severity: Minor
                      Found in meta/stub/stub.go - About 1 hr to fix

                        Function generateStubPropertyCallback has 52 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func generateStubPropertyCallback(file *jen.File, itf *idl.InterfaceType) error {
                        
                            writing := make([]jen.Code, 0)
                        
                            method := func(m object.MetaMethod, methodName string) error {
                        Severity: Minor
                        Found in meta/stub/stub.go - About 1 hr to fix

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

                          func (p *proxyALRobotPosture) GoToPosture(postureName string, maxSpeedFraction float32) (bool, error) {
                              var ret bool
                              args := bus.NewParams("(sf)", postureName, maxSpeedFraction)
                              resp := bus.NewResponse("b", &ret)
                              err := p.Proxy().Call2("goToPosture", args, resp)
                          Severity: Major
                          Found in examples/posture/proxy/posture_proxy.go and 1 other location - About 1 hr to fix
                          examples/posture/proxy/posture_proxy.go on lines 78..87

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

                          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 (p *proxyALRobotPosture) ApplyPosture(postureName string, maxSpeedFraction float32) (bool, error) {
                              var ret bool
                              args := bus.NewParams("(sf)", postureName, maxSpeedFraction)
                              resp := bus.NewResponse("b", &ret)
                              err := p.Proxy().Call2("applyPosture", args, resp)
                          Severity: Major
                          Found in examples/posture/proxy/posture_proxy.go and 1 other location - About 1 hr to fix
                          examples/posture/proxy/posture_proxy.go on lines 66..75

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

                          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

                              for _, param := range signal.Params {
                                  code = jen.If(jen.Err().Op(":=").Add(
                                      param.Type.Marshal(param.Name, "&buf"),
                                  ).Op(";").Err().Op("!=").Nil()).Block(
                                      jen.Id(`return fmt.Errorf("serialize ` +
                          Severity: Major
                          Found in meta/stub/stub.go and 1 other location - About 1 hr to fix
                          meta/stub/stub.go on lines 222..230

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

                          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