Showing 221 of 222 total issues
Method compiler.parseIndexingLValue
has 9 return statements (exceeds 4 allowed). Open
func (cp *compiler) parseIndexingLValue(n *parse.Indexing, f lvalueFlag) lvaluesGroup {
if n.Head.Type == parse.Braced {
// Braced list of lvalues may not have indices.
if len(n.Indices) > 0 {
cp.errorpf(n, "braced list may not have indices when used as lvalue")
Method file.Read
has 9 return statements (exceeds 4 allowed). Open
func (f file) Read() ([]NavigationFile, []byte, error) {
// On Unix, opening a named pipe for reading is blocking when there are no
// writers, so we need to do this check at the very beginning of this
// function.
//
Method slice.Less
has 9 return statements (exceeds 4 allowed). Open
func (s *slice) Less(i, j int) bool {
if s.err != nil {
return true
}
Function ConvertListIndex
has 9 return statements (exceeds 4 allowed). Open
func ConvertListIndex(rawIndex any, n int) (*ListIndex, error) {
switch rawIndex := rawIndex.(type) {
case int:
index, err := adjustAndCheckIndex(rawIndex, n, false)
if err != nil {
Function ConvertListIndex
has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring. Open
func ConvertListIndex(rawIndex any, n int) (*ListIndex, error) {
switch rawIndex := rawIndex.(type) {
case int:
index, err := adjustAndCheckIndex(rawIndex, n, false)
if err != nil {
- 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 doTilde
has 9 return statements (exceeds 4 allowed). Open
func doTilde(v any) (any, error) {
switch v := v.(type) {
case string:
s := v
// TODO: Make this correct on Windows.
Method assignOp.exec
has 9 return statements (exceeds 4 allowed). Open
func (op *assignOp) exec(fm *Frame) Exception {
variables := make([]vars.Var, len(op.lhs.lvalues))
for i, lvalue := range op.lhs.lvalues {
variable, err := derefLValue(fm, lvalue)
if err != nil {
Similar blocks of code found in 2 locations. Consider refactoring. Open
func (c *client) NextCmd(from int, prefix string) (storedefs.Cmd, error) {
req := &api.NextCmdRequest{From: from, Prefix: prefix}
res := &api.NextCmdResponse{}
err := c.call("NextCmd", req, res)
return storedefs.Cmd{Text: res.Text, Seq: res.Seq}, 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 125.
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 (c *client) PrevCmd(upto int, prefix string) (storedefs.Cmd, error) {
req := &api.PrevCmdRequest{Upto: upto, Prefix: prefix}
res := &api.PrevCmdResponse{}
err := c.call("PrevCmd", req, res)
return storedefs.Cmd{Text: res.Text, Seq: res.Seq}, 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 125.
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 completionStart
has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring. Open
func completionStart(ed *Editor, bindings tk.Bindings, ev *eval.Evaler, cfg complete.Config, smart bool) {
codeArea, ok := focusedCodeArea(ed.app)
if !ok {
return
}
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
func (s *service) PrevCmd(req *api.PrevCmdRequest, res *api.PrevCmdResponse) error {
if s.err != nil {
return s.err
}
cmd, err := s.store.PrevCmd(req.Upto, req.Prefix)
- 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 123.
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 (s *service) NextCmd(req *api.NextCmdRequest, res *api.NextCmdResponse) error {
if s.err != nil {
return s.err
}
cmd, err := s.store.NextCmd(req.From, req.Prefix)
- 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 123.
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 service.call
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
func (s *service) call(server *Server, sending *sync.Mutex, wg *sync.WaitGroup, mtype *methodType, req *Request, argv, replyv reflect.Value, codec ServerCodec) {
Method redirOp.exec
has 8 return statements (exceeds 4 allowed). Open
func (op *redirOp) exec(fm *Frame) Exception {
var dst int
if op.dstOp == nil {
// No explicit FD destination specified; use default destinations
switch op.mode {
Function ScanToGo
has 8 return statements (exceeds 4 allowed). Open
func ScanToGo(src any, ptr any) error {
switch ptr := ptr.(type) {
case *int:
i, err := elvToInt(src)
if err == nil {
Function convertEvent
has 8 return statements (exceeds 4 allowed). Open
func convertEvent(event ewindows.InputEvent) Event {
switch event := event.(type) {
case *ewindows.KeyEvent:
if event.BKeyDown == 0 {
// Ignore keyup events.
Function useFromFile
has 8 return statements (exceeds 4 allowed). Open
func useFromFile(fm *Frame, spec, path string, r diag.Ranger) (*Ns, error) {
if ns, ok := fm.Evaler.modules[path]; ok {
return ns, nil
}
_, err := os.Stat(path + ".so")
Method externalCmd.Call
has 8 return statements (exceeds 4 allowed). Open
func (e externalCmd) Call(fm *Frame, argVals []any, opts map[string]any) error {
if len(opts) > 0 {
return ErrExternalCmdOpts
}
if fsutil.DontSearch(e.Name) {
Function set
has 8 return statements (exceeds 4 allowed). Open
func set(fm *Frame, r diag.Ranger, temp bool, variable vars.Var, value any) Exception {
if temp {
saved := variable.Get()
needUnset := false
Function parseCSI
has 8 return statements (exceeds 4 allowed). Open
func parseCSI(nums []int, last rune, seq string) ui.Key {
if k, ok := csiSeqByLast[last]; ok {
if len(nums) == 0 {
// Unmodified: \e[A (Up)
return k