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)
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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()
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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()
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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 {
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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()
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
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()
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" {
Function getCertFiles
has 5 return statements (exceeds 4 allowed). Open
func getCertFiles() (string, string, error) {
filename, err := getCertConf()
if err != nil {
return "", "", err
}
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
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 {
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" {
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
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)
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)
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)
}
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")
}
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()
exported function Certificate should have comment or be unexported Open
func Certificate() (cert tls.Certificate, err error) {
- Exclude checks
exported function GenerateCertificate should have comment or be unexported Open
func GenerateCertificate() (tls.Certificate, error) {
- Exclude checks