Skip to content

Commit

Permalink
docs: updated the project's documentation
Browse files Browse the repository at this point in the history
FossilOrigin-Name: 0dedd96faa4f6bcdce57bbd066975e0bd5df2d0f4ff9f633bcb56ac44f190736
  • Loading branch information
thindil committed Aug 13, 2024
1 parent c26664c commit 17e01eb
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions doc/available_rules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,66 @@ Examples

search not params used all

Ranges rule
===========
The rule to check do ranges' declarations in the code follow some design
patterns.
Checked things:

* Do ranges' declarations have space before and after `..` sign.

The syntax in a configuration file is::

[ruleType] ?not? ranges [checkType]

* ruleType is the type of rule which will be executed. Proper values are:
*check*, *search*, *count* and *fix*. For more information about the types of
rules, please refer to the program's documentation. Check type will raise
an error if there is a declaration which violates any of the checks. Search
type will list all declarations which violates any of checks or raise an
error if nothing found. Count type will simply list the amount of the
declarations which violates the checks. Fix type will try to upgrade the
declaration to meet the rule settings. For example, it will add spaces before
and after `..` sign or remove them if negation was used.
* optional word *not* means negation for the rule. Adding word *not* will
change to inform only about declarations which not violate the checks. For
example, it will raise an error when check type find a declaration with space
before and after `..` sign.
* ranges is the name of the rule. It is case-insensitive, thus it can be
set as *ranges*, *ranges* or *rAnGeS*.
* checkType is the type of checks to perform on the declarations. Proper
value is: *spaces*. It will check if all declarations do they have spaces
before and after `..` sign.

Disabling the rule
------------------
It is possible to disable the rule for a selected part of the checked code
by using pragma *ruleOff: "ranges"* in the element from which the rule
should be disabled or in code before it. For example, if the rule should
be disabled for procedure `proc main()`, the full declaration of it should
be::

proc main() {.ruleOff: "ranges".}

To enable the rule again, the pragma *ruleOn: "ranges"* should be added in
the element which should be checked or in code before it. For example, if
the rule should be re-enabled for procedure `proc main()`, the full declaration should
be::

proc main() {.ruleOn: "ranges".}

Examples
--------

1. Check if all ranges' declarations in the code have spaces before and after
`..` sign, the opposite to the Nim coding standard ::

check ranges spaces

2. Replace all range's declarations in the code with the Nim coding standard::

fix not ranges spaces

Trystatements rule
==================
The rule to check do `try` statements in the code contains or not some
Expand Down

0 comments on commit 17e01eb

Please sign in to comment.