Showing 191 of 191 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
package main
import (
"flag"
"log"
- 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 153.
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 init
has 58 lines of code (exceeds 50 allowed). Consider refactoring. Open
func init() {
flaggy.SetName("qiloop")
description := fmt.Sprintf("%s\n\n%s",
"an utility to explore QiMessaging",
asciibot.Random())
Function generateStubObject
has 58 lines of code (exceeds 50 allowed). Consider refactoring. Open
func generateStubObject(file *jen.File, itf *idl.InterfaceType) error {
writing := make([]jen.Code, 0)
if itf.Name == "Object" {
code := jen.Id(`p.signal.Activate(activation)`)
writing = append(writing, code)
Method Header.Read
has 13 return statements (exceeds 4 allowed). Open
func (h *Header) Read(r io.Reader) (err error) {
if err = h.readMagic(r); err != nil {
return fmt.Errorf("read message magic: %s", err)
} else if h.Magic != Magic {
return fmt.Errorf("invalid message magic: %x", h.Magic)
Method qiDecoder.Decode
has 13 return statements (exceeds 4 allowed). Open
func (q qiDecoder) Decode(x interface{}) (err error) {
switch v := x.(type) {
case CustomDecoder:
return v.Decode(q)
case BinaryDecoder:
Similar blocks of code found in 2 locations. Consider refactoring. Open
func (s Signal) Meta(id uint32) object.MetaSignal {
var meta object.MetaSignal
meta.Uid = id
meta.Name = s.Name
types := make([]signature.Type, 0)
- 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 143.
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 (p Property) Meta(id uint32) object.MetaProperty {
var meta object.MetaProperty
meta.Uid = id
meta.Name = p.Name
types := make([]signature.Type, 0)
- 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 143.
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 generateReceiveMethod
has 55 lines of code (exceeds 50 allowed). Consider refactoring. Open
func generateReceiveMethod(file *jen.File, itf *idl.InterfaceType) error {
writing := make([]jen.Code, 0)
prelude := jen.Comment("action dispatch")
if itf.Name == "Object" {
Method qiDecoder.Decode
has 55 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (q qiDecoder) Decode(x interface{}) (err error) {
switch v := x.(type) {
case CustomDecoder:
return v.Decode(q)
case BinaryDecoder:
Function convertFrom
has 54 lines of code (exceeds 50 allowed). Consider refactoring. Open
func convertFrom(v, w reflect.Value) error {
errConversion := fmt.Errorf("Failed to convert %v into %v",
v.Type(), w.Type())
Method client.Call
has 11 return statements (exceeds 4 allowed). Open
func (c *client) Call(cancel <-chan struct{}, serviceID, objectID, actionID uint32,
payload []byte) ([]byte, error) {
// Do nothing if cancel is already closed.
if cancel != nil {
Similar blocks of code found in 2 locations. Consider refactoring. Open
func DialEndPoint(addr string) (EndPoint, error) {
u, err := url.Parse(addr)
if err != nil {
return nil, fmt.Errorf("dial: invalid address: %s", err)
}
- 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 135.
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
Method Header.Write
has 11 return statements (exceeds 4 allowed). Open
func (h *Header) Write(w io.Writer) (err error) {
wrap := func(field string, err error) error {
return fmt.Errorf("write message %s: %s", field, err)
}
if err = h.writeMagic(w); err != nil {
Function generateObjectInterface
has 11 return statements (exceeds 4 allowed). Open
func generateObjectInterface(itf *InterfaceType, serviceName string,
file *jen.File) error {
definitions := make([]jen.Code, 0)
Similar blocks of code found in 2 locations. Consider refactoring. Open
func Listen(addr string) (Listener, error) {
u, err := url.Parse(addr)
if err != nil {
return nil, fmt.Errorf("listen: invalid address: %s", err)
}
- 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 135.
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 methodBodyBlock
has 52 lines of code (exceeds 50 allowed). Consider refactoring. Open
func methodBodyBlock(itf *idl.InterfaceType, method idl.Method,
methodName string) (*jen.Statement, error) {
writing := make([]jen.Code, 0)
params := make([]jen.Code, 0)
Function generateStubPropertyCallback
has 52 lines of code (exceeds 50 allowed). Consider refactoring. Open
func generateStubPropertyCallback(file *jen.File, itf *idl.InterfaceType) error {
writing := make([]jen.Code, 0)
method := func(m object.MetaMethod, methodName string) error {
Similar blocks of code found in 2 locations. Consider refactoring. Open
func (p *proxyALRobotPosture) GoToPosture(postureName string, maxSpeedFraction float32) (bool, error) {
var ret bool
args := bus.NewParams("(sf)", postureName, maxSpeedFraction)
resp := bus.NewResponse("b", &ret)
err := p.Proxy().Call2("goToPosture", args, resp)
- 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 132.
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 (p *proxyALRobotPosture) ApplyPosture(postureName string, maxSpeedFraction float32) (bool, error) {
var ret bool
args := bus.NewParams("(sf)", postureName, maxSpeedFraction)
resp := bus.NewResponse("b", &ret)
err := p.Proxy().Call2("applyPosture", args, resp)
- 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 132.
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
for _, param := range signal.Params {
code = jen.If(jen.Err().Op(":=").Add(
param.Type.Marshal(param.Name, "&buf"),
).Op(";").Err().Op("!=").Nil()).Block(
jen.Id(`return fmt.Errorf("serialize ` +
- 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 132.
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