<commit_before>.. _rules-file:

Labelling rules
===============

Rules for issue labelling by Gitbot is defined in file ``rules.cfg``.

By default, it is located next to the gitbot package, but can be changed via a command line parameter or when
deploying as a WSGI app. When in doubt, run ``gitbot generate`` command.

Rules' function
---------------

Rules for Gitbot map a regular expression pattern to a label. Simply put, each issue is scanned and matched against
the given rules. If any regexp pattern matches the issue, it is labelled with the given label. Issue is considered to
match a rule if the rule pattern matches its title or body. (Or optionally its comments, as defined by app parameters,
see :ref:`console-usage`.)

Rules' format
-------------

Rules are specified one-per-line in the following format::
   [pattern]=>[label]

For example, following pattern would assign ``generic`` label to all issues::

   .*=>generic

*Note*: Spaces matter in rules definitions. Following rule::

   hell => devil

Will NOT match issue with contents of ``hello world``, but it will match contents of ``this is hell``.

Lines starting with ``#;`` are considered comments and will be ignored by the rules processor.



<commit_msg>RST syntax typo<commit_after>.. _rules-file:

Labelling rules
===============

Rules for issue labelling by Gitbot is defined in file ``rules.cfg``.

By default, it is located next to the gitbot package, but can be changed via a command line parameter or when
deploying as a WSGI app. When in doubt, run ``gitbot generate`` command.

Rules' function
---------------

Rules for Gitbot map a regular expression pattern to a label. Simply put, each issue is scanned and matched against
the given rules. If any regexp pattern matches the issue, it is labelled with the given label. Issue is considered to
match a rule if the rule pattern matches its title or body. (Or optionally its comments, as defined by app parameters,
see :ref:`console-usage`.)

Rules' format
-------------

Rules are specified one-per-line in the following format::

   [pattern]=>[label]

For example, following pattern would assign ``generic`` label to all issues::

   .*=>generic

*Note*: Spaces matter in rules definitions. Following rule::

   hell => devil

Will NOT match issue with contents of ``hello world``, but it will match contents of ``this is hell``.

Lines starting with ``#;`` are considered comments and will be ignored by the rules processor.




{'fraction_non_alphanumeric': 0.10441116956697694, 'fraction_numerical': 0.0, 'mean_word_length': 3.7906976744186047, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7269359', 'n_tokens_mistral': 637, 'n_tokens_neox': 609, 'n_words': 360}