Skip to content

Commit

Permalink
docs: added code documentation in ifstatements rule
Browse files Browse the repository at this point in the history
FossilOrigin-Name: eaf9ea2dcef647b099bfd946f49790fc4e02bbf03f307be7d090d879a936246f
  • Loading branch information
thindil committed Mar 17, 2024
1 parent 8097aa3 commit a7aa4f2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/rules/ifstatements.nim
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ ruleConfig(ruleName = "ifstatements",
{.push ruleOff: "paramsUsed".}
proc checkMinMax(node, parent: PNode; messagePrefix: string;
rule: var RuleOptions) {.raises: [ValueError], tags: [RootEffect], contractual.} =
## Check the amount of branches of the selected if statement
##
## * node - the node which will be checked
## * parent - the parent node of the node to check
## * messagePrefix - the prefix added to the log message, set by the program
## * rule - the rule options set by the user
body:
let astNode: PNode = parent
var checkResult: bool = true
Expand All @@ -150,6 +156,12 @@ proc checkMinMax(node, parent: PNode; messagePrefix: string;

proc checkEmptyBranch(node, parent: PNode; messagePrefix: string;
rule: var RuleOptions; checkResult: var bool) {.raises: [], tags: [RootEffect], contractual.} =
## Check the if statement for empty branches
##
## * node - the node which will be checked
## * parent - the parent node of the node to check
## * messagePrefix - the prefix added to the log message, set by the program
## * rule - the rule options set by the user
body:
let astNode: PNode = parent
for child in node:
Expand Down

0 comments on commit a7aa4f2

Please sign in to comment.