Showing 191 of 191 total issues

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

    property := func(p object.MetaProperty, propertyName string) error {
        property := itf.Properties[p.Uid]
        propertyName = "Update" + propertyName
        err := generatePropertyHelper(file, itf, property,
            propertyName)
Severity: Minor
Found in meta/stub/stub.go and 1 other location - About 35 mins to fix
meta/stub/stub.go on lines 322..331

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

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 (l *logListenerImpl) OnLogLevelChange(level LogLevel) error {
    if err := validateLevel(level); err != nil {
        return err
    }
    l.filtersMutex.Lock()
Severity: Minor
Found in bus/logger/log_listener.go and 1 other location - About 35 mins to fix
bus/logger/log_listener.go on lines 118..127

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

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 (l *logListenerImpl) SetLevel(level LogLevel) error {
    if err := validateLevel(level); err != nil {
        return err
    }
    l.filtersMutex.Lock()
Severity: Minor
Found in bus/logger/log_listener.go and 1 other location - About 35 mins to fix
bus/logger/log_listener.go on lines 108..117

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

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

    signal := func(s object.MetaSignal, signalName string) error {
        signal := itf.Signals[s.Uid]
        signalName = "Signal" + signalName
        err := generateSignalHelper(file, itf, signal, signalName)
        if err != nil {
Severity: Minor
Found in meta/stub/stub.go and 1 other location - About 35 mins to fix
meta/stub/stub.go on lines 332..342

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

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

func ParsePackage(input []byte) (*PackageDeclaration, error) {
    context := NewContext()
    parser := packageParser(context)
    root, scanner := parser(parsec.NewScanner(input).TrackLineno())
    _, scanner = scanner.SkipWS()
Severity: Major
Found in meta/idl/parser.go - About 35 mins to fix

    Method MetaObject.SignalID has 5 return statements (exceeds 4 allowed).
    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 - About 35 mins to fix

      Method InterfaceType.registerMembers has 5 return statements (exceeds 4 allowed).
      Open

      func (itf *InterfaceType) registerMembers(set *signature.TypeSet) error {
          metaObj := itf.MetaObject()
          method := func(m object.MetaMethod, methodName string) error {
              method := itf.Methods[m.Uid]
              paramType := method.Tuple()
      Severity: Major
      Found in meta/idl/interface.go - About 35 mins to fix

        Function generateReceiveMethod has 5 return statements (exceeds 4 allowed).
        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: Major
        Found in meta/stub/stub.go - About 35 mins to fix

          Function getCertFiles has 5 return statements (exceeds 4 allowed).
          Open

          func getCertFiles() (string, string, error) {
              filename, err := getCertConf()
              if err != nil {
                  return "", "", err
              }
          Severity: Major
          Found in bus/net/cert/cert.go - About 35 mins to fix

            Method MetaObject.PropertyID has 5 return statements (exceeds 4 allowed).
            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 - About 35 mins to fix

              Function generateStubPropertyCallback has 5 return statements (exceeds 4 allowed).
              Open

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

                Method qiDecoder.readValue has 5 return statements (exceeds 4 allowed).
                Open

                func (q qiDecoder) readValue(typ reflect.Type) (v reflect.Value, err error) {
                    if typ.Kind() == reflect.Interface {
                        // not much we can do here. let's handle the
                        // special case of value.Value
                        if typ.Name() == "Value" {
                Severity: Major
                Found in type/encoding/encoding.go - About 35 mins to fix

                  Function NewAuthSession has 5 return statements (exceeds 4 allowed).
                  Open

                  func NewAuthSession(addr, user, token string) (bus.Session, error) {
                  
                      s := new(Session)
                      s.userName = user
                      s.userToken = token
                  Severity: Major
                  Found in bus/session/session.go - About 35 mins to fix

                    Function ReadCapabilityMap has 5 return statements (exceeds 4 allowed).
                    Open

                    func ReadCapabilityMap(in io.Reader) (m CapabilityMap, err error) {
                    
                        size, err := basic.ReadUint32(in)
                        if err != nil {
                            return m, fmt.Errorf("read map size: %s", err)
                    Severity: Major
                    Found in bus/authenticate.go - About 35 mins to fix

                      Function WriteString has 5 return statements (exceeds 4 allowed).
                      Open

                      func WriteString(s string, w io.Writer) error {
                          data := []byte(s)
                          size := len(data)
                          if size > int(MaxStringSize) {
                              return fmt.Errorf("invalid string size: %d", size)
                      Severity: Major
                      Found in type/basic/basic.go - About 35 mins to fix

                        Function ReadString has 5 return statements (exceeds 4 allowed).
                        Open

                        func ReadString(r io.Reader) (string, error) {
                            size, err := ReadUint32(r)
                            if err != nil {
                                return "", fmt.Errorf("read string size: %s", err)
                            }
                        Severity: Major
                        Found in type/basic/basic.go - About 35 mins to fix

                          Method stubObject.UpdateProperty has 5 return statements (exceeds 4 allowed).
                          Open

                          func (s *stubObject) UpdateProperty(id uint32, sig string, data []byte) error {
                              objImpl, ok := (s.impl).(*objectImpl)
                              if !ok {
                                  return fmt.Errorf("unexpected implementation")
                              }
                          Severity: Major
                          Found in bus/object.go - About 35 mins to fix

                            Method server.NewService has 5 return statements (exceeds 4 allowed).
                            Open

                            func (s *server) NewService(name string, object Actor) (Service, error) {
                            
                                s.Router.RLock()
                                session := s.Router.session
                                s.Router.RUnlock()
                            Severity: Major
                            Found in bus/server.go - About 35 mins to fix

                              exported function Certificate should have comment or be unexported
                              Open

                              func Certificate() (cert tls.Certificate, err error) {
                              Severity: Minor
                              Found in bus/net/cert/cert.go by golint

                              exported function GenerateCertificate should have comment or be unexported
                              Open

                              func GenerateCertificate() (tls.Certificate, error) {
                              Severity: Minor
                              Found in bus/net/cert/cert.go by golint
                              Severity
                              Category
                              Status
                              Source
                              Language