Skip to content

simple: S1008 suggests to remove comments from if()s that are specifically written to make a comment stand out #1488

@artem-anisimov-0x7f

Description

@artem-anisimov-0x7f

Sometimes it makes sense to have code organised this way:

if cond {
    // explain a rather non-obvious condition checked by this if()
    return true
}
// I expect more cases to appear where I need to return true,
// but for now the above case is the only one.
return false

Gosimple's check S1008 suggests to replace this with a plain return cond.

If a conditional if smth { return true } has comments inside, then do not suggest to fold it with the code that follows.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions