Showing 107 of 107 total issues
Method provider.GetWeather
has 7 return statements (exceeds 4 allowed). Open
func (p *provider) GetWeather() (weather.Weather, error) {
response, err := http.Get(p.url)
if err != nil {
return weather.Weather{}, err
}
Similar blocks of code found in 2 locations. Consider refactoring. Open
func (alsaImpl) snd_mixer_selem_get_playback_switch(arg_elem *ctyp_snd_mixer_elem_t, arg_channel ctyp_snd_mixer_selem_channel_id_t, arg_value *int32) int32 {
tmp_arg_elem := (*C.snd_mixer_elem_t)(arg_elem)
tmp_arg_channel := C.snd_mixer_selem_channel_id_t(arg_channel)
tmp_arg_value := (*C.int)(arg_value)
result_c := C.snd_mixer_selem_get_playback_switch(tmp_arg_elem, tmp_arg_channel, tmp_arg_value)
- 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 111.
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 (alsaImpl) snd_mixer_selem_get_playback_volume(arg_elem *ctyp_snd_mixer_elem_t, arg_channel ctyp_snd_mixer_selem_channel_id_t, arg_value *int64) int32 {
tmp_arg_elem := (*C.snd_mixer_elem_t)(arg_elem)
tmp_arg_channel := C.snd_mixer_selem_channel_id_t(arg_channel)
tmp_arg_value := (*C.long)(arg_value)
result_c := C.snd_mixer_selem_get_playback_volume(tmp_arg_elem, tmp_arg_channel, tmp_arg_value)
- 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 111.
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 typeName
has 6 return statements (exceeds 4 allowed). Open
func typeName(typ reflect.Type) string {
if typ == nil {
return "nil"
}
name := typ.Name()
Method write_capi_file
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def write_capi_file(library, package, pkg_config, header_filename, c_functions)
Method TestBusObject.GoWithContext
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func (t *TestBusObject) GoWithContext(ctx context.Context, method string, flags dbus.Flags, ch chan *dbus.Call, args ...interface{}) *dbus.Call {
Function Load
has 5 return statements (exceeds 4 allowed). Open
func Load(repoPath string) error {
f, err := fs.Open(filepath.Join(repoPath, "metadata/icons.yml"))
if err != nil {
return err
}
Function updateTz
has 5 return statements (exceeds 4 allowed). Open
func updateTz(tzFile string) error {
if atomic.LoadUint32(&testMode) > 0 {
return errTestMode
}
link, err := os.Readlink(tzFile)
Function shorten
has 5 return statements (exceeds 4 allowed). Open
func shorten(path string) string {
// If path is a function, it can be something like some/package.(*Type).fn,
// but we'll simplify it to some/package.Type.fn for logging.
path = strings.Replace(path, "*", "", -1)
path = strings.Replace(path, "(", "", -1)
Function getCondition
has 5 return statements (exceeds 4 allowed). Open
func getCondition(owmCondition int) weather.Condition {
switch owmCondition {
case 611, 612:
return weather.Sleet
case 701:
Similar blocks of code found in 2 locations. Consider refactoring. Open
func (alsaImpl) snd_mixer_detach(arg_mixer *ctyp_snd_mixer_t, arg_name string) int32 {
tmp_arg_mixer := (*C.snd_mixer_t)(arg_mixer)
tmp_arg_name := C.CString(arg_name)
defer C.free(unsafe.Pointer(tmp_arg_name))
result_c := C.snd_mixer_detach(tmp_arg_mixer, tmp_arg_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 105.
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 allBatteriesInfo
has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring. Open
func allBatteriesInfo() Info {
dir, err := fs.Open("/sys/class/power_supply")
if err != nil {
l.Log("No batteries: %s", err)
return Info{Status: Disconnected}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function SI
has 5 return statements (exceeds 4 allowed). Open
func SI(v float64, unit string) Value {
if v < 0 {
inv := SI(-v, unit)
inv.number = "-" + inv.number
return inv
Method Module.getNotifications
has 5 return statements (exceeds 4 allowed). Open
func (m *Module) getNotifications(client *http.Client) (Notifications, error) {
req, _ := http.NewRequest("GET", "https://api.github.com/notifications", nil)
if m.lastModified != "" {
req.Header.Add("If-Modified-Since", m.lastModified)
}
Similar blocks of code found in 2 locations. Consider refactoring. Open
func (alsaImpl) snd_mixer_attach(arg_mixer *ctyp_snd_mixer_t, arg_name string) int32 {
tmp_arg_mixer := (*C.snd_mixer_t)(arg_mixer)
tmp_arg_name := C.CString(arg_name)
defer C.free(unsafe.Pointer(tmp_arg_name))
result_c := C.snd_mixer_attach(tmp_arg_mixer, tmp_arg_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 105.
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 (alsaImpl) snd_mixer_selem_set_playback_volume(arg_elem *ctyp_snd_mixer_elem_t, arg_channel ctyp_snd_mixer_selem_channel_id_t, arg_value int64) int32 {
tmp_arg_elem := (*C.snd_mixer_elem_t)(arg_elem)
tmp_arg_channel := C.snd_mixer_selem_channel_id_t(arg_channel)
tmp_arg_value := C.long(arg_value)
result_c := C.snd_mixer_selem_set_playback_volume(tmp_arg_elem, tmp_arg_channel, tmp_arg_value)
- 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 105.
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 (alsaImpl) snd_mixer_selem_set_playback_switch(arg_elem *ctyp_snd_mixer_elem_t, arg_channel ctyp_snd_mixer_selem_channel_id_t, arg_value int32) int32 {
tmp_arg_elem := (*C.snd_mixer_elem_t)(arg_elem)
tmp_arg_channel := C.snd_mixer_selem_channel_id_t(arg_channel)
tmp_arg_value := C.int(arg_value)
result_c := C.snd_mixer_selem_set_playback_switch(tmp_arg_elem, tmp_arg_channel, tmp_arg_value)
- 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 105.
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 (n *Node) ConcatText(texts ...string) *Node {
nodes := make([]*Node, len(texts))
for i, t := range texts {
nodes[i] = &Node{nodeType: ntText, content: t}
}
- 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 103.
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 (n *Node) AppendText(texts ...string) *Node {
nodes := make([]*Node, len(texts))
for i, t := range texts {
nodes[i] = &Node{nodeType: ntText, content: t}
}
- 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 103.
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
} else {
if !isSet(s.HasSeparator()) && g.attrSet&sgaInnerSeparators != 0 {
s.Separator(g.innerSeparator)
}
if !isSet(s.GetPadding()) && g.attrSet&sgaInnerPadding != 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 100.
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