Comparing v5.0.0...v5.1.0 · bombsimon/wsl (original) (raw)

Commits on Jul 2, 2025

  1. Make error checking more laxed (#184)
    Only perform error checking when there's a single comparison with a
    binary operator comparing an error with nil. Both != and == are
    candidates for cuddling.
    These should be cuddled if err exist on the line above
if err != nil {}  
if err == nil {}  

Nothing else should trigger this lint, all of these should be left

// More than error checking  
if err != nil || true {}  
// Technically an error checking, but we only check for binary  
// operators, not expressions.  
if errors.Is(err, SomeErr) {}  
// More than one error checking  
if err != nil || err2 != nil {}  

This also matches gofumpt which
has this rule:

No empty lines before a simple error check

foo, err := processFoo()  
 
if err != nil {  
    return err  
}  
foo, err := processFoo()  
if err != nil {  
    return err  
}  

@bombsimon
Configuration menu
Browse the repository at this point in the history