Skip to content

Commit

Permalink
feat: continue work on fix type of check for ranges rule
Browse files Browse the repository at this point in the history
FossilOrigin-Name: 7bb1d532ced66feb43e8c84068a06d7eaedebe0b50c168c616c74f87c0d3f83f
  • Loading branch information
thindil committed Aug 10, 2024
1 parent 5410c87 commit d557512
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/rules/ranges.nim
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ checkRule:
newFile.writeLine(x = line)
newFile.close
except OSError, IOError, Exception:
discard errorMessage(text = "Can't fix file '" &
discard errorMessage(text = "Can't save file '" &
rule.fileName & ". Reason: ", e = getCurrentException())
try:
removeFile(file = rule.fileName)
Expand All @@ -129,4 +129,14 @@ checkRule:
discard

fixRule:
discard
let lineNumber = try:
data.parseInt
except ValueError:
discard errorMessage(text = "Can't fix file '" &
rule.fileName & ". Reason: ", e = getCurrentException())
return false
if rule.negation:
fileContent[lineNumber] = fileContent[lineNumber].replace(sub = " ..", by = "..")
else:
fileContent[lineNumber] = fileContent[lineNumber].replace(sub = "..", by = " .. ")
echo fileContent

0 comments on commit d557512

Please sign in to comment.