Skip to content

[feature] Warning to detect missing 'else' statements based on code-formatting #1797

@jcurtiss8086

Description

@jcurtiss8086

Ran into a scenario for a potential new warning that falls into a similar bucket as Wmisleading-indentation and Wdangling-else.

Specifically, if a line of code has an 'end' followed by an 'if' without an 'else', then the new rule would flag that the code is likely missing an 'else' statement. This rule would be more applicable to coders that use K&R style 'bracing' versus Allman style.

class C;
   int a; 
   int b;
   function f();
       if ( a > 3) begin
       end if (b > 3) begin    // <--- user intended this to be 'end else if'
       end
   endfunction
endclass

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions