DiscardEmptySections¶
Remove empty sections.
Formatter configuration
DiscardEmptySections is included in the default formatters, but it can be also run separately with:
robocop format --select DiscardEmptySections
You can also disable DiscardEmptySections:
robocop format --configure DiscardEmptySections.enabled=False
*** Settings ***
*** Test Cases ***
Test
[Documentation] doc
[Tags] sometag
Pass
Keyword
One More
*** Keywords ***
# This section is not considered empty.
*** Variables ***
*** Comments ***
robocop: disable=all
*** Test Cases ***
Test
[Documentation] doc
[Tags] sometag
Pass
Keyword
One More
*** Keywords ***
# This section is not considered empty.
*** Comments ***
robocop: disable=all
Remove sections only with comments¶
Sections are considered empty if there are only empty lines inside.
You can remove sections with only comments by setting allow_only_comments
parameter to False. *** Comments ***
section with only comments is always considered as non-empty:
robocop format --configure DiscardEmptySection.allow_only_comments=True
*** Test Cases ***
Test
[Documentation] doc
[Tags] sometag
Pass
Keyword
One More
*** Keywords ***
# This section is considered to be empty.
*** Comments ***
# robocop: off=all
*** Test Cases ***
Test
[Documentation] doc
[Tags] sometag
Pass
Keyword
One More
*** Comments ***
# robocop: off=all
Skip formatting¶
It is possible to use the following arguments to skip formatting of the code:
It is also possible to use disablers (Disablers) but skip
option
makes it easier to skip all instances of given type of the code.