-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use rule for having a begin and end #2040
Comments
Indeed, there is no rule that checks this. It shouldn't be too hard to create it, if you're willing to spend some time on it. Anyway, thanks for the sugestion. I might give it a go in a couple of months. |
If you can guide me, I would like to add this rule and maybe be a contributor. Would you mentor me in this regard? |
Disclaimer: I'm not a maintainer, but I have done a couple of PRs (mainly lint rule stuff). But happy to help you! When I did my first PR I found the documentation pretty decent, so you might want to start there: https://github.com/chipsalliance/verible/blob/master/doc/style_lint.md. I'll leave you a couple of example PRs I have done in case they're useful to you. Basically, what you have to do is create a new SyntaxTreeLintRule (see documentation linked above) that matches Then, what I would do is use Using: // saved in a file named "beginend.sv"
module beginend ();
initial begin
if (1) begin
end else begin
end
if (1) x = y;
else y = x;
end
endmodule
Will give you the syntax tree, and you have to see how the pattern you want to discourage is structured. From my example, it looks like the
But the "wrong"
Other informationIf you haven't, check https://github.com/chipsalliance/verible/tree/master#developers-welcome Bazel specificI hadn't used bazel before and I remember being a bit lost at the begining so, just in case it is helpful:
Extra: I usually rebuild Examples
|
FWIW: there's an old PR that hasn't closed here #1336. |
Summary
I want to use the rule for checking if there are any if-else or for or while with single statements but doesn't have begin-end.
Which rules should I use, as I don't see them in the rules list.
Proposal
[optional] Suggest approach or include pseudo code for how one might implement
the rule.
Additional context
https://chipsalliance.github.io/verible/lint.html
The text was updated successfully, but these errors were encountered: