Showing 191 of 191 total issues

Method varReader.Read has 6 return statements (exceeds 4 allowed).
Open

func (v varReader) Read(r io.Reader) ([]byte, error) {
    size, err := basic.ReadUint32(r)
    if err != nil {
        return nil, fmt.Errorf("read size: %s", err)
    }
Severity: Major
Found in meta/signature/reader.go - About 40 mins to fix

    Function authenticateContinue has 6 return statements (exceeds 4 allowed).
    Open

    func authenticateContinue(endpoint net.EndPoint, prefered, resp CapabilityMap) error {
        newTokenValue, ok := resp[KeyNewToken]
        if !ok {
            return fmt.Errorf("missing authentication new token")
        }
    Severity: Major
    Found in bus/auth.go - About 40 mins to fix

      Method client.Subscribe has 6 return statements (exceeds 4 allowed).
      Open

      func (c *client) Subscribe(serviceID, objectID, actionID uint32) (
          cancel func(), events chan []byte, err error) {
      
          abort := make(chan struct{})
          events = make(chan []byte)
      Severity: Major
      Found in bus/client.go - About 40 mins to fix

        Method Session.client has 6 return statements (exceeds 4 allowed).
        Open

        func (s *Session) client(info services.ServiceInfo) (bus.Client, error) {
            if len(info.Endpoints) == 0 {
                return nil, fmt.Errorf("empty address list")
            }
            s.pollMutex.RLock()
        Severity: Major
        Found in bus/session/session.go - About 40 mins to fix

          Function checkServiceInfo has 6 return statements (exceeds 4 allowed).
          Open

          func checkServiceInfo(i ServiceInfo) error {
              if i.Name == "" {
                  return fmt.Errorf("empty name not allowed")
              }
              if i.MachineId == "" {
          Severity: Major
          Found in bus/directory/directory.go - About 40 mins to fix

            Function convertMap has 6 return statements (exceeds 4 allowed).
            Open

            func convertMap(v, w reflect.Value) error {
                if w.Kind() != reflect.Map {
                    return fmt.Errorf("Failed to convert map %v into %v",
                        v.Type(), w.Type())
                }
            Severity: Major
            Found in type/conversion/conversion.go - About 40 mins to fix

              Function findSignature has 6 return statements (exceeds 4 allowed).
              Open

              func findSignature(msg *net.Message, meta *object.MetaObject) string {
                  if msg.Header.Type == net.Call ||
                      msg.Header.Type == net.Post ||
                      msg.Header.Type == net.Reply {
                      m, ok := meta.Methods[msg.Header.Action]
              Severity: Major
              Found in bus/object.go - About 40 mins to fix

                Method clientObject.handleRegister has 6 return statements (exceeds 4 allowed).
                Open

                func (c *clientObject) handleRegister(msg *net.Message, from Channel) error {
                    buf := bytes.NewBuffer(msg.Payload)
                    objectID, err := basic.ReadUint32(buf)
                    if err != nil {
                        err = fmt.Errorf("cannot read object uid: %s", err)
                Severity: Major
                Found in bus/object.go - About 40 mins to fix

                  Method Message.Write has 6 return statements (exceeds 4 allowed).
                  Open

                  func (m *Message) Write(w io.Writer) error {
                  
                      if uint32(len(m.Payload)) != m.Header.Size {
                          return fmt.Errorf("invalid message size: %d instead of %d",
                              len(m.Payload), m.Header.Size)
                  Severity: Major
                  Found in bus/net/message.go - About 40 mins to fix

                    Method signalHandler.UnregisterEvent has 6 return statements (exceeds 4 allowed).
                    Open

                    func (o *signalHandler) UnregisterEvent(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 40 mins to fix

                      Function dialPipe has 6 return statements (exceeds 4 allowed).
                      Open

                      func dialPipe(name string) (EndPoint, error) {
                      
                          addr := gonet.UnixAddr{
                              Name: name,
                              Net:  "unix",
                      Severity: Major
                      Found in bus/net/endpoint.go - About 40 mins to fix

                        Function convertSlice has 6 return statements (exceeds 4 allowed).
                        Open

                        func convertSlice(v, w reflect.Value) error {
                            if w.Kind() != reflect.Slice {
                                return fmt.Errorf("Failed to convert slice %v into %v",
                                    v.Type(), w.Type())
                            }
                        Severity: Major
                        Found in type/conversion/conversion.go - About 40 mins to fix

                          Function generateStub has 6 return statements (exceeds 4 allowed).
                          Open

                          func generateStub(f *jen.File, itf *idl.InterfaceType) error {
                              if err := generateStubType(f, itf); err != nil {
                                  return err
                              }
                              if err := generateStubConstructor(f, itf); err != nil {
                          Severity: Major
                          Found in meta/stub/stub.go - About 40 mins to fix

                            Function generatePropertyDef has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            func generatePropertyDef(file *jen.File, serviceName string,
                                property Property, getMethodName, setMethodName,
                                subscribeMethodName string, definitions *[]jen.Code) error {
                            Severity: Minor
                            Found in meta/idl/proxy.go - About 35 mins to fix

                              Method proxyALVideoDevice.SubscribeCamera has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              func (p *proxyALVideoDevice) SubscribeCamera(name string, cameraIndex int32, resolution int32, colorSpace int32, fps int32) (string, error) {
                              Severity: Minor
                              Found in examples/video/video_proxy.go - About 35 mins to fix

                                Function generateMethodDef has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                func generateMethodDef(file *jen.File, serviceName string,
                                    method Method, methodName string, definitions *[]jen.Code) error {
                                Severity: Minor
                                Found in meta/idl/proxy.go - About 35 mins to fix

                                  Function NewHeader has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                  func NewHeader(typ uint8, service uint32, object uint32, action uint32, id uint32) Header {
                                  Severity: Minor
                                  Found in bus/net/message.go - About 35 mins to fix

                                    Function generateSignalDef has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                    func generateSignalDef(file *jen.File, serviceName string,
                                        signal Signal, signalName string, definitions *[]jen.Code) error {
                                    Severity: Minor
                                    Found in meta/idl/proxy.go - About 35 mins to fix

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

                                      func (s *StructType) Reader() TypeReader {
                                          readers := make([]memberReader, len(s.Members))
                                          for i, m := range s.Members {
                                              readers[i] = memberReader{
                                                  name:   m.Name,
                                      Severity: Minor
                                      Found in meta/signature/type.go and 1 other location - About 35 mins to fix
                                      meta/signature/type.go on lines 841..850

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

                                      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) Reader() TypeReader {
                                          readers := make([]memberReader, len(t.Members))
                                          for i, m := range t.Members {
                                              readers[i] = memberReader{
                                                  name:   m.Name,
                                      Severity: Minor
                                      Found in meta/signature/type.go and 1 other location - About 35 mins to fix
                                      meta/signature/type.go on lines 1004..1013

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

                                      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