diff --git a/docs/releasenotes/4.9.0.rst b/docs/releasenotes/4.9.0.rst index b794ec9c..0175cf66 100644 --- a/docs/releasenotes/4.9.0.rst +++ b/docs/releasenotes/4.9.0.rst @@ -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 @@ -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. diff --git a/robotidy/transformers/GenerateDocumentation.py b/robotidy/transformers/GenerateDocumentation.py index af17e02b..6d27f6b6 100644 --- a/robotidy/transformers/GenerateDocumentation.py +++ b/robotidy/transformers/GenerateDocumentation.py @@ -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)) diff --git a/tests/atest/transformers/GenerateDocumentation/expected/overwrite.robot b/tests/atest/transformers/GenerateDocumentation/expected/overwrite.robot index 2654e1c5..57fad33d 100644 --- a/tests/atest/transformers/GenerateDocumentation/expected/overwrite.robot +++ b/tests/atest/transformers/GenerateDocumentation/expected/overwrite.robot @@ -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. diff --git a/tests/atest/transformers/GenerateDocumentation/expected/template_with_defaults.robot b/tests/atest/transformers/GenerateDocumentation/expected/template_with_defaults.robot index 6434624c..379ee58f 100644 --- a/tests/atest/transformers/GenerateDocumentation/expected/template_with_defaults.robot +++ b/tests/atest/transformers/GenerateDocumentation/expected/template_with_defaults.robot @@ -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 diff --git a/tests/atest/transformers/GenerateDocumentation/expected/test.robot b/tests/atest/transformers/GenerateDocumentation/expected/test.robot index 03eed596..918098ac 100644 --- a/tests/atest/transformers/GenerateDocumentation/expected/test.robot +++ b/tests/atest/transformers/GenerateDocumentation/expected/test.robot @@ -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. diff --git a/tests/atest/transformers/GenerateDocumentation/expected/test_rf4.robot b/tests/atest/transformers/GenerateDocumentation/expected/test_rf4.robot index 8f63db45..e503c263 100644 --- a/tests/atest/transformers/GenerateDocumentation/expected/test_rf4.robot +++ b/tests/atest/transformers/GenerateDocumentation/expected/test_rf4.robot @@ -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. diff --git a/tests/atest/transformers/GenerateDocumentation/source/test.robot b/tests/atest/transformers/GenerateDocumentation/source/test.robot index 4d4f9c36..9c155c03 100644 --- a/tests/atest/transformers/GenerateDocumentation/source/test.robot +++ b/tests/atest/transformers/GenerateDocumentation/source/test.robot @@ -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}