Skip to content

Commit

Permalink
Do not remove docs in settings and tests sections in GenerateDocument…
Browse files Browse the repository at this point in the history
…ation (#634)
  • Loading branch information
bhirsz authored Feb 3, 2024
1 parent 776b2ac commit a6646c6
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 2 deletions.
20 changes: 18 additions & 2 deletions docs/releasenotes/4.9.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
Robotidy 4.9.0
==============

Support skipping documentation in AlignSettingsSection with ``AlignSettingsSection:skip_documentation=True``
or ``--skip-documentation`` skip options (#622).
Allow to skip formatting documentation in ``AlignSettingsSection`` transformer and fix ``GenerateDocumentation``
transformer removing documentation from settings and test cases sections.

You can install the latest available version by running

Expand All @@ -22,3 +22,19 @@ or to install exactly this version
.. contents::
:depth: 2
:local:

Transformers changes
====================

Skip documentation option for AlignSettingsSection transformer (#622)
---------------------------------------------------------------------
Support skipping documentation in AlignSettingsSection with ``AlignSettingsSection:skip_documentation=True``
or ``--skip-documentation`` skip options (#622).

Fixes
=====

GenerateDocumentation overwriting documentation in Settings and Test Cases sections (#628)
------------------------------------------------------------------------------------------

``GenerateDocumentation`` transformer should now only overwrite documentation for the ``*** Keywords ***`` section.
5 changes: 5 additions & 0 deletions robotidy/transformers/GenerateDocumentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ def __init__(self, overwrite: bool = False, doc_template: str = "google", templa
self.args_returns_finder = ArgumentsAndReturnsVisitor()
super().__init__()

def visit_TestCaseSection(self, node): # noqa
return node

visit_SettingSection = visit_TestCaseSection

def load_template(self, template: str, template_directory: Optional[str] = None) -> str:
try:
return Template(self.get_template(template, template_directory))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
*** Settings ***
Documentation Suite documentation should not be changed.

*** Test Cases ***
Test without documentation
No Operation

Test with documentation
[Documentation] Should not be changed.
No Operation


*** Keywords ***
Single Argument
[Documentation] Short description.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
*** Settings ***
Documentation Suite documentation should not be changed.

*** Test Cases ***
Test without documentation
No Operation

Test with documentation
[Documentation] Should not be changed.
No Operation


*** Keywords ***
Single Argument
[Documentation] Single Argument
Expand Down
13 changes: 13 additions & 0 deletions tests/atest/transformers/GenerateDocumentation/expected/test.robot
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
*** Settings ***
Documentation Suite documentation should not be changed.

*** Test Cases ***
Test without documentation
No Operation

Test with documentation
[Documentation] Should not be changed.
No Operation


*** Keywords ***
Single Argument
[Documentation] Short description.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
*** Settings ***
Documentation Suite documentation should not be changed.

*** Test Cases ***
Test without documentation
No Operation

Test with documentation
[Documentation] Should not be changed.
No Operation


*** Keywords ***
Single Argument
[Documentation] Short description.
Expand Down
13 changes: 13 additions & 0 deletions tests/atest/transformers/GenerateDocumentation/source/test.robot
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
*** Settings ***
Documentation Suite documentation should not be changed.

*** Test Cases ***
Test without documentation
No Operation

Test with documentation
[Documentation] Should not be changed.
No Operation


*** Keywords ***
Single Argument
[Arguments] ${var}
Expand Down

0 comments on commit a6646c6

Please sign in to comment.