Skip to content

Commit

Permalink
Feat/explicitly define help url for each rule (#1138)
Browse files Browse the repository at this point in the history
Define help url for each rule
  • Loading branch information
Lakitna authored Dec 4, 2024
1 parent 912cd6e commit 739eb8f
Show file tree
Hide file tree
Showing 20 changed files with 315 additions and 202 deletions.
12 changes: 6 additions & 6 deletions robocop/checkers/comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from robot.utils import FileReader

from robocop.checkers import RawFileChecker, VisitorChecker
from robocop.rules import Rule, RuleParam, RuleSeverity
from robocop.rules import DefaultRule, RuleParam, RuleSeverity
from robocop.utils import ROBOT_VERSION


Expand All @@ -22,7 +22,7 @@ def regex(value):
RULE_CATEGORY_ID = "07"

rules = {
"0701": Rule(
"0701": DefaultRule(
RuleParam(
name="markers",
default="todo,fixme",
Expand All @@ -49,7 +49,7 @@ def regex(value):
""",
added_in_version="1.0.0",
),
"0702": Rule(
"0702": DefaultRule(
RuleParam(
name="block",
default="^###",
Expand Down Expand Up @@ -87,7 +87,7 @@ def regex(value):
""",
added_in_version="1.0.0",
),
"0703": Rule(
"0703": DefaultRule(
rule_id="0703",
name="invalid-comment",
msg="Invalid comment. '#' needs to be first character in the cell. "
Expand All @@ -107,7 +107,7 @@ def regex(value):
""",
added_in_version="1.0.0",
),
"0704": Rule(
"0704": DefaultRule(
rule_id="0704",
name="ignored-data",
msg="Ignored data found in file",
Expand Down Expand Up @@ -136,7 +136,7 @@ def regex(value):
""",
added_in_version="1.3.0",
),
"0705": Rule(
"0705": DefaultRule(
rule_id="0705",
name="bom-encoding-in-file",
msg="This file contains BOM (Byte Order Mark) encoding not supported by Robot Framework",
Expand Down
8 changes: 4 additions & 4 deletions robocop/checkers/community_rules/keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from robot.utils.robottime import timestr_to_secs

from robocop.checkers import VisitorChecker
from robocop.rules import Rule, RuleParam, RuleSeverity
from robocop.rules import CommunityRule, RuleParam, RuleSeverity
from robocop.utils.misc import normalize_robot_name
from robocop.utils.run_keywords import iterate_keyword_names

Expand All @@ -17,7 +17,7 @@ def comma_separated_list(value: str) -> set[str]:


rules = {
"10001": Rule(
"10001": CommunityRule(
RuleParam(
name="max_time", default=0, converter=timestr_to_secs, desc="Maximum amount of time allowed in Sleep"
),
Expand Down Expand Up @@ -53,7 +53,7 @@ def comma_separated_list(value: str) -> set[str]:
""",
),
"10002": Rule(
"10002": CommunityRule(
RuleParam(
name="keywords",
default=None,
Expand Down Expand Up @@ -87,7 +87,7 @@ def comma_separated_list(value: str) -> set[str]:
""",
),
"10003": Rule(
"10003": CommunityRule(
rule_id="10003",
name="no-embedded-keyword-arguments",
msg="Not allowed embedded arguments {{ arguments }} found in keyword '{{ keyword }}'",
Expand Down
6 changes: 3 additions & 3 deletions robocop/checkers/community_rules/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
from robot.libraries import STDLIBS

from robocop.checkers import VisitorChecker
from robocop.rules import Rule, RuleSeverity
from robocop.rules import CommunityRule, RuleSeverity

RULE_CATEGORY_ID = "01"


rules = {
"10101": Rule(
"10101": CommunityRule(
rule_id="10101",
name="non-builtin-imports-not-sorted",
msg="Non builtin library import '{{ custom_import }}' should be placed before '{{ previous_custom_import }}'",
Expand All @@ -25,7 +25,7 @@
""",
),
"10102": Rule(
"10102": CommunityRule(
rule_id="10102",
name="resources-imports-not-sorted",
msg="Resource import '{{ resource_import }}' should be placed before '{{ previous_resource_import }}'",
Expand Down
4 changes: 2 additions & 2 deletions robocop/checkers/community_rules/usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
from robot.running.arguments import EmbeddedArguments

from robocop.checkers import ProjectChecker
from robocop.rules import Message, Rule, RuleSeverity
from robocop.rules import CommunityRule, Message, RuleSeverity
from robocop.utils.misc import ROBOT_VERSION, normalize_robot_name
from robocop.utils.run_keywords import iterate_keyword_names

RULE_CATEGORY_ID = "01"

rules = {
"10101": Rule(
"10101": CommunityRule(
rule_id="10101",
name="unused-keyword",
msg="Keyword '{{ keyword_name }}' is not used",
Expand Down
10 changes: 5 additions & 5 deletions robocop/checkers/documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
from robot.parsing.model.statements import Documentation

from robocop.checkers import VisitorChecker
from robocop.rules import Rule, RuleParam, RuleSeverity
from robocop.rules import DefaultRule, RuleParam, RuleSeverity
from robocop.utils.misc import str2bool

RULE_CATEGORY_ID = "02"

rules = {
"0201": Rule(
"0201": DefaultRule(
rule_id="0201",
name="missing-doc-keyword",
msg="Missing documentation in '{{ name }}' keyword",
Expand All @@ -30,7 +30,7 @@
Other Step
""",
),
"0202": Rule(
"0202": DefaultRule(
RuleParam(
name="ignore_templated",
default="True",
Expand Down Expand Up @@ -59,7 +59,7 @@
Possible values are: ``Yes`` / ``1`` / ``True`` (default) or ``No`` / ``False`` / ``0``.
""",
),
"0203": Rule(
"0203": DefaultRule(
rule_id="0203",
name="missing-doc-suite",
msg="Missing documentation in suite",
Expand All @@ -72,7 +72,7 @@
Documentation Suite documentation
""",
),
"0204": Rule(
"0204": DefaultRule(
rule_id="0204",
name="missing-doc-resource-file",
msg="Missing documentation in resource file",
Expand Down
28 changes: 14 additions & 14 deletions robocop/checkers/duplications.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from robot.api import Token

from robocop.checkers import VisitorChecker
from robocop.rules import Rule, RuleParam, RuleSeverity
from robocop.rules import DefaultRule, RuleParam, RuleSeverity
from robocop.utils import get_errors, normalize_robot_name, normalize_robot_var_name


Expand Down Expand Up @@ -33,7 +33,7 @@ def configure_sections_order(value):
RULE_CATEGORY_ID = "08"

rules = {
"0801": Rule(
"0801": DefaultRule(
rule_id="0801",
name="duplicated-test-case",
msg="Multiple test cases with name '{{ name }}' (first occurrence in line {{ first_occurrence_line }})",
Expand All @@ -52,7 +52,7 @@ def configure_sections_order(value):
""",
added_in_version="1.0.0",
),
"0802": Rule(
"0802": DefaultRule(
rule_id="0802",
name="duplicated-keyword",
msg="Multiple keywords with name '{{ name }}' (first occurrence in line {{ first_occurrence_line }})",
Expand All @@ -75,7 +75,7 @@ def configure_sections_order(value):
""",
added_in_version="1.0.0",
),
"0803": Rule(
"0803": DefaultRule(
rule_id="0803",
name="duplicated-variable",
msg="Multiple variables with name '{{ name }}' in Variables section (first occurrence in line "
Expand All @@ -96,14 +96,14 @@ def configure_sections_order(value):
""",
added_in_version="1.0.0",
),
"0804": Rule(
"0804": DefaultRule(
rule_id="0804",
name="duplicated-resource",
msg="Multiple resource imports with path '{{ name }}' (first occurrence in line {{ first_occurrence_line }})",
severity=RuleSeverity.WARNING,
added_in_version="1.0.0",
),
"0805": Rule(
"0805": DefaultRule(
rule_id="0805",
name="duplicated-library",
msg="Multiple library imports with name '{{ name }}' and identical arguments (first occurrence in line "
Expand All @@ -119,21 +119,21 @@ def configure_sections_order(value):
""",
added_in_version="1.0.0",
),
"0806": Rule(
"0806": DefaultRule(
rule_id="0806",
name="duplicated-metadata",
msg="Duplicated metadata '{{ name }}' (first occurrence in line {{ first_occurrence_line }})",
severity=RuleSeverity.WARNING,
added_in_version="1.0.0",
),
"0807": Rule(
"0807": DefaultRule(
rule_id="0807",
name="duplicated-variables-import",
msg="Duplicated variables import with path '{{ name }}' (first occurrence in line {{ first_occurrence_line }})",
severity=RuleSeverity.WARNING,
added_in_version="1.0.0",
),
"0808": Rule(
"0808": DefaultRule(
rule_id="0808",
name="section-already-defined",
msg="'{{ section_name }}' section header already defined in file (first occurrence in line "
Expand All @@ -160,7 +160,7 @@ def configure_sections_order(value):
""",
added_in_version="1.0.0",
),
"0809": Rule(
"0809": DefaultRule(
RuleParam(
name="sections_order",
default="settings,variables,testcases,keywords",
Expand Down Expand Up @@ -194,7 +194,7 @@ def configure_sections_order(value):
""",
added_in_version="1.0.0",
),
"0810": Rule(
"0810": DefaultRule(
rule_id="0810",
name="both-tests-and-tasks",
msg="Both Task(s) and Test Case(s) section headers defined in file",
Expand All @@ -209,7 +209,7 @@ def configure_sections_order(value):
""",
added_in_version="1.0.0",
),
"0811": Rule(
"0811": DefaultRule(
rule_id="0811",
name="duplicated-argument-name",
msg="Argument name '{{ argument_name }}' is already used",
Expand All @@ -226,7 +226,7 @@ def configure_sections_order(value):
""",
added_in_version="1.11.0",
),
"0812": Rule(
"0812": DefaultRule(
rule_id="0812",
name="duplicated-assigned-var-name",
msg="Assigned variable name '{{ variable_name }}' is already used",
Expand All @@ -250,7 +250,7 @@ def configure_sections_order(value):
""",
added_in_version="1.12.0",
),
"0813": Rule(
"0813": DefaultRule(
rule_id="0813",
name="duplicated-setting",
msg="{{ error_msg }}",
Expand Down
Loading

0 comments on commit 739eb8f

Please sign in to comment.