Repository: MarketSquare/robotframework-robocop

Issue:
Enable all rules at once
We have growing number of non-default rules. User may want to enable all rules and then disable unwanted ones, rather than keeping track if new release contain new rules etc. 

We could reuse ruff syntax:

```
select = ["ALL"]
```

Hints from issue comments:

Solution patch:
diff --git a/docs/releasenotes/6.0.0a3.rst b/docs/releasenotes/6.0.0a3.rst
index 14f85e3..9c86a59 100644
--- a/docs/releasenotes/6.0.0a3.rst
+++ b/docs/releasenotes/6.0.0a3.rst
@@ -35,6 +35,9 @@ following command::
 
     robocop migrate <config_path>
 
+It will create new file named <config_path>_migrated.toml with translated option names and their structure.
+Rule ids are also converted to new format, but patterns are not migrated (such as ``02*``).
+
 .. contents::
    :depth: 2
    :local:
@@ -704,6 +707,26 @@ We are now supporting following integrations:
 - pre-commit
 - ... and more - see the `Integrations` documentation
 
+Select all rules with ALL (#1316)
+---------------------------------
+
+We have growing number of non-default (disabled by default) rules. This requires period checking of the release
+notes if there is new rule that may be worth to be enabled.
+If you want instead to always enable all rules and chose what to disable (rather than selecting all rules that
+you want to enable one by one) you can now use special keyword ``ALL``::
+
+    robocop check --select ALL
+
+::
+
+    [tool.robocop.lint]
+    select = [
+        "ALL"
+    ]
+    ignore = [
+        "rules-you-want-to-disable"
+    ]
+
 Shell autocompletion
 ---------------------
 
diff --git a/docs/source/rules/rules_basics.rst b/docs/source/rules/rules_basics.rst
index ad2f07a..648fa9c 100644
--- a/docs/source/rules/rules_basics.rst
+++ b/docs/source/rules/rules_basics.rst
@@ -4,12 +4,17 @@
 Rule basics
 ***********
 
-Checkers
-========
+Robocop uses rules as a basic building block of the linter. They can define what message will be printed in the report,
+which Robot Framework versions it supports or provide additional configuration for the rule. Rules are internally
+used by checkers - classes that scan code for related issues and report then as Diagnostic issues.
 
-# TODO: cli / configuration files examples
+Each rule has a unique rule id (for example ``DOC01``) consisting of:
 
-.. automodule:: robocop.linter.rules
+- a alphanumeric group name (for example ``DOC``)
+- a 2-digit rule number (for example ``01``)
+
+Rule ID as well as rule name can be used to refer to the rule (e.g. in select/ignore statements, configurations etc.).
+You can optionally configure rule severity or other parameters.
 
 .. _list-rules:
 
@@ -56,33 +61,35 @@ Available list filters::
     ENABLED - print only enabled rules
     DISABLED - print only disabled rules
     DEPRECATED - print only deprecated rules
+    STYLE_GUIDE - print only rules directly connected to official Robot Framework style guide
 
-Rule message
-============
+.. _selecting-rules:
 
-# .. automodule:: robocop.rules
+Selecting and ignoring rules
+----------------------------
 
-# .. module:: robocop
+You can select or ignore particular rules using rule name or id.
 
-.. _rule-severity:
+To only select and run ``missing-doc-keyword`` rule:
 
-Rule severity
-=============
+.. tab-set::
 
-.. automodule:: robocop.linter.rules.RuleSeverity
+    .. tab-item:: Cli
 
-.. _severity-threshold:
+        .. code:: shell
 
-Severity threshold
--------------------
+            robocop check --select missing-doc-keyword
 
-Selected rules can be configured to have different severity depending on the parameter value.
+    .. tab-item:: Configuration file
 
-Using ``line-too-long`` as an example - this rule issues a warning when line length exceeds configured value
-(default ``120``).
-It is possible to configure this rule to issue a warning for line length above 120 but an error for line length
-above 200.
-We can use ``severity_threshold`` for this purpose:
+        .. code:: toml
+
+            [robocop.lint]
+            select = [
+                "missing-doc-keyword"
+            ]
+
+To run all rules except ``missing-doc-keyword`` rule:
 
 .. tab-set::
 
@@ -90,27 +97,18 @@ We can use ``severity_threshold`` for this purpose:
 
         .. code:: shell
 
-            robocop check -c line-too-long.severity_threshold=warning=120:error=200
+            robocop check --ignore missing-doc-keyword
 
     .. tab-item:: Configuration file
 
         .. code:: toml
 
             [robocop.lint]
-            configure = [
-                "line-too-long.severity_threshold=warning=120:error=200"
+            ignore = [
+                "missing-doc-keyword"
             ]
 
-It supports all default severity values:
-
-- error, e
-- warning, w
-- info, i
-
-The issue needs to be raised in order for severity thresholds to be evaluated. That's why the parameter value needs to
-be configured to raise an issue for at least one of our threshold ranges. In previous example, if we want to issue
-info message if the line is longer than 80 characters, we need to configure ``line_length`` parameter
-(default ``120``) to 80 to trigger the rule:
+Robocop supports glob patterns:
 
 .. tab-set::
 
@@ -118,36 +116,20 @@ info message if the line is longer than 80 characters, we need to configure ``li
 
         .. code:: shell
 
-            robocop check -c line-too-long.line_length=80 -c line-too-long.severity_threshold=info=80:warning=120:error=200
+             robocop check --select *doc*
 
     .. tab-item:: Configuration file
 
         .. code:: toml
 
             [robocop.lint]
-            configure = [
-                "line-too-long.line_length=80",
-                "line-too-long.severity_threshold=info=80:warning=120:error=200"
+            select = [
+                "*doc*"
             ]
 
-Following rules support ``severity_threshold``:
-
-{% for checker_group in checker_groups %}
-{% for rule_doc in checker_group[1] %}
-{%- if rule_doc.severity_threshold is not none %}
-- :ref:`{{ rule_doc.name }}`
-{% endif %}
-{% endfor %}
-{% endfor %}
-
-.. _selecting-rules:
-
-Selecting and ignoring rules
-=============================
-
-You can select or ignore particular rules using rule name or id.
+All rules will be ignored except those with *doc* in its name (like ``missing-doc-keyword``, ``too-long-doc`` etc).
 
-To only select and run ``missing-doc-keyword`` rule:
+To configure multiple rules you can repeat option / or add more to array (configuration file):
 
 .. tab-set::
 
@@ -155,7 +137,7 @@ To only select and run ``missing-doc-keyword`` rule:
 
         .. code:: shell
 
-            robocop check --select missing-doc-keyword
+             robocop check --select rule1 --select rule2 --select rule3 --ignore rule2
 
     .. tab-item:: Configuration file
 
@@ -163,10 +145,19 @@ To only select and run ``missing-doc-keyword`` rule:
 
             [robocop.lint]
             select = [
-                "missing-doc-keyword"
+                "rule1",
+                "rule2",
+                "rule3"
+            ]
+            ignore = [
+                "rule2"
             ]
 
-To run all rules except ``missing-doc-keyword`` rule:
+Select all rules
+================
+
+If you want to always enable all rules and chose what to disable (rather than selecting all rules that
+you want to enable one by one) you can use special keyword ``ALL``:
 
 .. tab-set::
 
@@ -174,18 +165,41 @@ To run all rules except ``missing-doc-keyword`` rule:
 
         .. code:: shell
 
-            robocop check --ignore missing-doc-keyword
+            robocop check --select ALL
 
     .. tab-item:: Configuration file
 
         .. code:: toml
 
-            [robocop.lint]
+            [tool.robocop.lint]
+            select = [
+                "ALL"
+            ]
             ignore = [
-                "missing-doc-keyword"
+                "rules-you-want-to-disable"
             ]
 
-Robocop supports glob patterns:
+.. _rule-severity:
+
+Rule severity
+-------------
+
+Robocop rules can have one of the following severities: info, warning or error.
+
+.. automodule:: robocop.linter.rules.RuleSeverity
+
+.. _severity-threshold:
+
+Severity threshold
+==================
+
+Selected rules can be configured to have different severity depending on the parameter value.
+
+Using ``line-too-long`` as an example - this rule issues a warning when line length exceeds configured value
+(default ``120``).
+It is possible to configure this rule to issue a warning for line length above 120 but an error for line length
+above 200.
+We can use ``severity_threshold`` for this purpose:
 
 .. tab-set::
 
@@ -193,20 +207,27 @@ Robocop supports glob patterns:
 
         .. code:: shell
 
-             robocop check --select *doc*
+            robocop check -c line-too-long.severity_threshold=warning=120:error=200
 
     .. tab-item:: Configuration file
 
         .. code:: toml
 
             [robocop.lint]
-            select = [
-                "*doc*"
+            configure = [
+                "line-too-long.severity_threshold=warning=120:error=200"
             ]
 
-All rules will be ignored except those with *doc* in its name (like ``missing-doc-keyword``, ``too-long-doc`` etc).
+It supports all default severity values:
 
-To configure multiple rules you can repeat option / or add more to array (configuration file):
+- error, e
+- warning, w
+- info, i
+
+The issue needs to be raised in order for severity thresholds to be evaluated. That's why the parameter value needs to
+be configured to raise an issue for at least one of our threshold ranges. In previous example, if we want to issue
+info message if the line is longer than 80 characters, we need to configure ``line_length`` parameter
+(default ``120``) to 80 to trigger the rule:
 
 .. tab-set::
 
@@ -214,18 +235,24 @@ To configure multiple rules you can repeat option / or add more to array (config
 
         .. code:: shell
 
-             robocop check --select rule1 --select rule2 --select rule3 --ignore rule2
+            robocop check -c line-too-long.line_length=80 -c line-too-long.severity_threshold=info=80:warning=120:error=200
 
     .. tab-item:: Configuration file
 
         .. code:: toml
 
             [robocop.lint]
-            select = [
-                "rule1",
-                "rule2",
-                "rule3"
-            ]
-            ignore = [
-                "rule2"
+            configure = [
+                "line-too-long.line_length=80",
+                "line-too-long.severity_threshold=info=80:warning=120:error=200"
             ]
+
+Following rules support ``severity_threshold``:
+
+{% for group in builtin_checkers %}
+{% for rule_doc in group.rules %}
+{%- if rule_doc.severity_threshold is not none %}
+- :ref:`{{ rule_doc.name }}`
+{% endif %}
+{% endfor %}
+{% endfor %}
diff --git a/docs/source/rules/rules_list.rst b/docs/source/rules/rules_list.rst
index ae0e005..f7bdce3 100644
--- a/docs/source/rules/rules_list.rst
+++ b/docs/source/rules/rules_list.rst
@@ -13,7 +13,7 @@ There are over a {{ rules_length_in_10 }} rules available in Robocop and they ar
 * {{ group.group_id }}: :ref:`{{ group.group_name }}`
 {%- endfor %}
 
-Below is the list of all built-in Robocop rules.
+Below is the list of all Robocop rules.
 
 {% for group in builtin_checkers %}
 .. _{{ group.group_name }}:
diff --git a/src/robocop/config.py b/src/robocop/config.py
index a7ecff8..fc6ec6f 100644
--- a/src/robocop/config.py
+++ b/src/robocop/config.py
@@ -45,6 +45,8 @@ class RuleMatcher:
     def is_rule_enabled(self, rule: Rule) -> bool:
         if self.is_rule_disabled(rule):
             return False
+        if "ALL" in self.config.include_rules:
+            return True
         if (
             self.config.include_rules or self.config.include_rules_patterns
         ):  # if any include pattern, it must match with something
diff --git a/src/robocop/linter/rules/__init__.py b/src/robocop/linter/rules/__init__.py
index ad90c20..f7a7d35 100644
--- a/src/robocop/linter/rules/__init__.py
+++ b/src/robocop/linter/rules/__init__.py
@@ -60,7 +60,7 @@ if TYPE_CHECKING:
 @total_ordering
 class RuleSeverity(Enum):
     """
-    It can be configured with::
+    You can override rule default severity::
 
         robocop check --configure id_or_msg_name.severity=value
 


Test patch:
diff --git a/tests/config/test_rule_matcher.py b/tests/config/test_rule_matcher.py
index 173244b..c3d2691 100644
--- a/tests/config/test_rule_matcher.py
+++ b/tests/config/test_rule_matcher.py
@@ -94,3 +94,11 @@ class TestIncludingExcluding:
         msg = get_message_with_id("0101")
         assert rule_matcher.is_rule_disabled(msg)
         assert not rule_matcher.is_rule_enabled(msg)
+
+    def test_select_all(self):
+        linter_config = LinterConfig(select=["ALL", "0101"], ignore=["0103"])
+        linter_config.load_configuration()
+        rule_matcher = RuleMatcher(linter_config)
+        assert rule_matcher.is_rule_enabled(get_message_with_id("0101"))
+        assert rule_matcher.is_rule_enabled(get_message_with_id("0102"))
+        assert not rule_matcher.is_rule_enabled(get_message_with_id("0103"))