Skip to content

Commit

Permalink
chore: fixed errors reported by nimalyzer
Browse files Browse the repository at this point in the history
FossilOrigin-Name: f1b86c15e62bdb4a828c7dafdf347f0547c3ef09ec6f8fb744bb0f3d73131869
  • Loading branch information
thindil committed Mar 19, 2024
1 parent f0cfdc5 commit 350f2f1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
8 changes: 3 additions & 5 deletions src/config.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright © 2023 Bartek Jasicki
# Copyright © 2023-2024 Bartek Jasicki
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -152,13 +152,11 @@ proc parseConfig*(configFile: string; sections: var int): tuple[sources: seq[
# If the configuration file contains a couple of sections of settings,
# skip the current line until don't meet the proper section
if configSection > 0:
if configLine[0] != "reset":
continue
else:
if configLine[0] == "reset":
configSection.dec
message(text = "Restarting parsing of the configuration file.",
level = lvlDebug)
continue
continue
case setting.name
# If the configuration file contains "reset" setting, stop parsing it
# and increase the amount of sections
Expand Down
6 changes: 3 additions & 3 deletions src/rules.nim
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,12 @@ template setResult*(checkResult: bool; positiveMessage, negativeMessage: string;
return
else:
if rule.negation:
if rule.ruleType != count:
if rule.ruleType == count:
rule.amount.inc
else:
message(text = messagePrefix & negativeMessage.multiReplace(
replacements = replacements), returnValue = rule.amount,
level = lvlNotice, decrease = false)
else:
rule.amount.inc
rule.maxResults.dec
if rule.maxResults == 0:
return
Expand Down
12 changes: 6 additions & 6 deletions src/rules/paramsused.nim
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,17 @@ checkRule:
break
# The node doesn't use one of its parameters
if index == -1:
if not rule.negation:
if rule.negation:
setResult(checkResult = false, positiveMessage = "",
negativeMessage = positiveMessage, node = node, params = [
procName, $node.info.line, " doesn't"])
break
else:
setResult(checkResult = false, positiveMessage = "",
negativeMessage = negativeMessage, ruleData = varName,
node = node, params = [procName, $node.info.line, varName])
if rule.ruleType == fix:
return
else:
setResult(checkResult = false, positiveMessage = "",
negativeMessage = positiveMessage, node = node, params = [
procName, $node.info.line, " doesn't"])
break
except KeyError, Exception:
rule.amount = errorMessage(text = messagePrefix &
"can't check parameters of procedure " & procName &
Expand Down

0 comments on commit 350f2f1

Please sign in to comment.