Showing 191 of 191 total issues

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

func (p *proxyALMotion) WakeUp() error {
    var ret struct{}
    args := bus.NewParams("()")
    resp := bus.NewResponse("v", &ret)
    err := p.Proxy().Call2("wakeUp", args, resp)
Severity: Major
Found in examples/motion/proxy/motion_proxy.go and 4 other locations - About 45 mins to fix
examples/motion/proxy/motion_proxy.go on lines 63..72
examples/motion/proxy/motion_proxy.go on lines 75..84
examples/motion/proxy/motion_proxy.go on lines 99..108
examples/posture/proxy/posture_proxy.go on lines 90..99

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

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

func (p *proxyALMotion) Rest() error {
    var ret struct{}
    args := bus.NewParams("()")
    resp := bus.NewResponse("v", &ret)
    err := p.Proxy().Call2("rest", args, resp)
Severity: Major
Found in examples/motion/proxy/motion_proxy.go and 4 other locations - About 45 mins to fix
examples/motion/proxy/motion_proxy.go on lines 51..60
examples/motion/proxy/motion_proxy.go on lines 75..84
examples/motion/proxy/motion_proxy.go on lines 99..108
examples/posture/proxy/posture_proxy.go on lines 90..99

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

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

func (p *proxyALMotion) WaitUntilMoveIsFinished() error {
    var ret struct{}
    args := bus.NewParams("()")
    resp := bus.NewResponse("v", &ret)
    err := p.Proxy().Call2("waitUntilMoveIsFinished", args, resp)
Severity: Major
Found in examples/motion/proxy/motion_proxy.go and 4 other locations - About 45 mins to fix
examples/motion/proxy/motion_proxy.go on lines 51..60
examples/motion/proxy/motion_proxy.go on lines 63..72
examples/motion/proxy/motion_proxy.go on lines 75..84
examples/posture/proxy/posture_proxy.go on lines 90..99

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

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

func (p *proxyALRobotPosture) StopMove() error {
    var ret struct{}
    args := bus.NewParams("()")
    resp := bus.NewResponse("v", &ret)
    err := p.Proxy().Call2("stopMove", args, resp)
Severity: Major
Found in examples/posture/proxy/posture_proxy.go and 4 other locations - About 45 mins to fix
examples/motion/proxy/motion_proxy.go on lines 51..60
examples/motion/proxy/motion_proxy.go on lines 63..72
examples/motion/proxy/motion_proxy.go on lines 75..84
examples/motion/proxy/motion_proxy.go on lines 99..108

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

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

func (p *proxyALMotion) MoveInit() error {
    var ret struct{}
    args := bus.NewParams("()")
    resp := bus.NewResponse("v", &ret)
    err := p.Proxy().Call2("moveInit", args, resp)
Severity: Major
Found in examples/motion/proxy/motion_proxy.go and 4 other locations - About 45 mins to fix
examples/motion/proxy/motion_proxy.go on lines 51..60
examples/motion/proxy/motion_proxy.go on lines 63..72
examples/motion/proxy/motion_proxy.go on lines 99..108
examples/posture/proxy/posture_proxy.go on lines 90..99

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

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 Message.Read has 7 return statements (exceeds 4 allowed).
Open

func (m *Message) Read(r io.Reader) error {

    // Read the complete header, then parse the fields.
    b := make([]byte, HeaderSize)
    if err := basic.ReadN(r, b, HeaderSize); err != nil {
Severity: Major
Found in bus/net/message.go - About 45 mins to fix

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

            if ret.Signature() != "v" {
                writing = append(writing, jen.If(jen.Err().Op("=").Add(v.Type.Marshal(v.Name, "&buf")).Op(";").Err().Op("!=").Nil()).Block(
                    jen.Id(`return ret, fmt.Errorf("serialize `+v.Name+`: %s", err)`),
                ))
            } else {
    Severity: Minor
    Found in meta/idl/proxy.go and 1 other location - About 45 mins to fix
    meta/idl/proxy.go on lines 554..558

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

    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

    Avoid deeply nested control flow statements.
    Open

                if err == nil {
                    err = fmt.Errorf("no progress")
                }
    Severity: Major
    Found in type/basic/basic.go - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                  if err != nil {
                      return fmt.Errorf("read %v: %w",
                          v.Type().Name(), err)
                  }
      Severity: Major
      Found in type/encoding/encoding.go - About 45 mins to fix

        Function Parse has 7 return statements (exceeds 4 allowed).
        Open

        func Parse(input string) (Type, error) {
            text := []byte(input)
        
            root, rest := typeSignature(parsec.NewScanner(text))
            if root == nil {
        Severity: Major
        Found in meta/signature/signature.go - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                      if err == nil {
                          err = fmt.Errorf("no progress")
                      }
          Severity: Major
          Found in type/basic/basic.go - About 45 mins to fix

            Function convertFrom has 7 return statements (exceeds 4 allowed).
            Open

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

              Avoid deeply nested control flow statements.
              Open

                  } else if logCommand.Used {
                      logger(serverURL, logLevel)
                  } else if serverCommand.Used {
                      server(serverURL)
                  } else if traceCommand.Used {
              Severity: Major
              Found in cmd/qiloop/main.go - About 45 mins to fix

                Method signalHandler.RegisterEvent has 7 return statements (exceeds 4 allowed).
                Open

                func (o *signalHandler) RegisterEvent(msg *net.Message, from Channel) error {
                
                    buf := bytes.NewBuffer(msg.Payload)
                    objectID, err := basic.ReadUint32(buf)
                    if err != nil {
                Severity: Major
                Found in bus/signal.go - About 45 mins to fix

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

                          } else {
                              writing = append(writing, jen.If(jen.Err().Op("=").Add(v.Type.Marshal(v.Name, "&buf")).Op(";").Err().Op("!=").Nil()).Block(
                                  jen.Id(`return fmt.Errorf("serialize `+v.Name+`: %s", err)`),
                              ))
                          }
                  Severity: Minor
                  Found in meta/idl/proxy.go and 1 other location - About 45 mins to fix
                  meta/idl/proxy.go on lines 550..554

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

                  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 proxy.Call2 has 7 return statements (exceeds 4 allowed).
                  Open

                  func (p proxy) Call2(method string, args Params, ret Response) error {
                      methodID, sig, err := p.MetaObject().MethodID(method, args.Signature())
                      if err != nil {
                          return err
                      }
                  Severity: Major
                  Found in bus/proxy.go - About 45 mins to fix

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

                    func (s *Session) findServiceName(name string) (i services.ServiceInfo, err error) {
                        s.serviceListMutex.Lock()
                        defer s.serviceListMutex.Unlock()
                        for _, service := range s.serviceList {
                            if service.Name == name {
                    Severity: Minor
                    Found in bus/session/session.go and 1 other location - About 45 mins to fix
                    bus/session/session.go on lines 106..115

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

                    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 (s *Session) findServiceID(uid uint32) (i services.ServiceInfo, err error) {
                        s.serviceListMutex.Lock()
                        defer s.serviceListMutex.Unlock()
                        for _, service := range s.serviceList {
                            if service.ServiceId == uid {
                    Severity: Minor
                    Found in bus/session/session.go and 1 other location - About 45 mins to fix
                    bus/session/session.go on lines 95..104

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

                    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 GenerateIDL has 6 return statements (exceeds 4 allowed).
                    Open

                    func GenerateIDL(writer io.Writer, packageName string, objs map[string]object.MetaObject) error {
                        set := signature.NewTypeSet()
                    
                        fmt.Fprintf(writer, "package %s\n", packageName)
                        scope := NewScope()
                    Severity: Major
                    Found in meta/idl/idl.go - About 40 mins to fix

                      Method pipeListener.Accept has 6 return statements (exceeds 4 allowed).
                      Open

                      func (c pipeListener) Accept() (Stream, error) {
                          conn, err := c.l.AcceptUnix()
                          if err != nil {
                              return nil, err
                          }
                      Severity: Major
                      Found in bus/net/listen.go - About 40 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language