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)
}
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")
}
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)
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()
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 == "" {
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())
}
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]
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)
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)
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 {
Function dialPipe
has 6 return statements (exceeds 4 allowed). Open
func dialPipe(name string) (EndPoint, error) {
addr := gonet.UnixAddr{
Name: name,
Net: "unix",
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())
}
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 {
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 {
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) {
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 {
Function NewHeader
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func NewHeader(typ uint8, service uint32, object uint32, action uint32, id uint32) Header {
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 {
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,
- 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 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
- 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 (t *TupleType) Reader() TypeReader {
readers := make([]memberReader, len(t.Members))
for i, m := range t.Members {
readers[i] = memberReader{
name: m.Name,
- 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 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
- 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