Skip to content

Deprecate Robotidy for Robocop 6.0+ #743

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions .github/dependabot.yml

This file was deleted.

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ Robotidy
- [Usage](#usage)
- [Example](#example)

DEPRECATION NOTICE
------------
Starting from Robocop 6.0, Robotidy is part of Robocop as formatter.

If you are new users, please use https://github.com/MarketSquare/robotframework-robocop instead.

Introduction <a name="introduction"></a>
------------
Robotidy is a tool for autoformatting Robot Framework code.
Expand Down
8 changes: 8 additions & 0 deletions docs/source/overview.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Deprecation notice
-------------------

Starting with Robocop 6.0, Robotidy is now integrated into Robocop.
The standalone version of Robotidy is deprecated and may not support the latest Robot Framework versions.

Please see https://robocop.readthedocs.io/en/stable/ for Robocop documentation.

Introduction
------------
Robotidy is a tool for autoformatting Robot Framework code.
Expand Down
8 changes: 8 additions & 0 deletions robotidy/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ def cli(ctx: click.Context, **kwargs):
Robotidy is a tool for formatting Robot Framework source code.
Full documentation available at <https://robotidy.readthedocs.io> .
"""
print_deprecation_warning()
cli_config = RawConfig.from_cli(ctx=ctx, **kwargs)
global_config = config_module.MainConfig(cli_config)
global_config.validate_src_is_required()
Expand All @@ -507,3 +508,10 @@ def cli(ctx: click.Context, **kwargs):
tidy = app.Robotidy(global_config)
status = tidy.transform_files()
sys.exit(status)


def print_deprecation_warning() -> None:
print(
"DeprecationWarning: Starting with Robocop 6.0, Robotidy is now integrated into Robocop. "
"The standalone version of Robotidy is deprecated and may not support the latest Robot Framework versions.\n"
)
2 changes: 1 addition & 1 deletion robotidy/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "4.16.0"
__version__ = "4.17.0"
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@
include_package_data=True,
python_requires=">=3.8",
install_requires=[
"robotframework>=4.0,<7.3",
"robotframework>=4.0",
"click==8.1.*",
"colorama>=0.4.3,<0.4.7",
"pathspec>=0.9.0,<0.12.2",
"tomli>=2.0,<2.3",
"rich_click>=1.4,<1.8.6",
"jinja2>=3.1.3,<4.0",
"colorama>=0.4.3",
"pathspec>=0.9.0",
"tomli>=2.0",
"rich_click>=1.4",
"jinja2>=3.1.3",
],
extras_require={
"dev": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_invalid_template_path(self):
f"Error: {self.TRANSFORMER_NAME}: Invalid 'doc_template' parameter value: '{template_path}'. "
f"The template path does not exist or cannot be found.\n"
)
assert expected_output == result.output
assert expected_output in result.output

def test_invalid_template(self):
template_path = Path(__file__).parent / "source" / "invalid_template.jinja"
Expand All @@ -65,4 +65,4 @@ def test_invalid_template(self):
f"Failed to load the template: Unexpected end of template. Jinja was looking for the "
f"following tags: 'endfor' or 'else'. The innermost block that needs to be closed is 'for'.\n"
)
assert expected_output == result.output
assert expected_output in result.output
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def test_invalid_order_parameter(self, parameter):
"Custom order should be provided in comma separated list with all section names:\n"
"order=comments,settings,variables,testcases,tasks,variables\n"
)
assert expected_output == result.output
assert expected_output in result.output

def test_inline_if(self):
self.compare(source="inline_if.robot", not_modified=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_invalid_equal_sign_type(self, param_name):
f"Error: {self.TRANSFORMER_NAME}: Invalid '=' parameter value: '{param_name}'. "
"Possible values:\n remove\n equal_sign\n space_and_equal_sign\n"
)
assert expected_output == result.output
assert expected_output in result.output

def test_disablers(self):
self.compare(source="disablers.robot", not_modified=True)
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_wrong_case(self):
f"Error: {self.TRANSFORMER_NAME}: Invalid 'case' parameter value: 'invalid'. "
f"Supported cases: lowercase, uppercase, titlecase.\n"
)
assert expected_output == result.output
assert expected_output in result.output

def test_only_remove_duplicates(self):
self.compare(source="duplicates.robot", config=f":normalize_case=False")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_custom_order_invalid_param(self):
f" Custom order should be provided in comma separated list with valid setting names: "
f"arguments,documentation,return,setup,tags,teardown,timeout\n"
)
assert result.output == expected_output
assert expected_output in result.output

def test_disablers(self):
self.compare(source="disablers.robot", not_modified=True)
Expand All @@ -76,7 +76,7 @@ def test_custom_order_setting_twice_in_one(self):
f"Error: {self.TRANSFORMER_NAME}: Invalid 'test_after' parameter value: 'teardown,teardown'. "
"Custom order cannot contain duplicated setting names.\n"
)
assert result.output == expected_output
assert expected_output in result.output

def test_custom_order_setting_twice_in_after_before(self):
config = "keyword_before=documentation,arguments:keyword_after=teardown,documentation"
Expand All @@ -89,7 +89,7 @@ def test_custom_order_setting_twice_in_after_before(self):
f"Error: {self.TRANSFORMER_NAME}: Invalid 'keyword_before' and 'keyword_after' order values. "
f"Following setting names exists in both orders: documentation\n"
)
assert result.output == expected_output
assert expected_output in result.output

def test_translated(self):
self.compare(source="translated.robot", target_version=">=6")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def test_invalid_group(self):
"Custom order should be provided in comma separated list with valid group names:\n"
"('documentation', 'imports', 'settings', 'tags')\n"
)
assert expected_output == result.output
assert expected_output in result.output

def test_custom_order_inside_group(self):
self.compare(
Expand All @@ -84,7 +84,7 @@ def test_invalid_token_name_in_order(self):
f"Custom order should be provided in comma separated list with valid group names:\n"
f"['documentation', 'metadata']\n"
)
assert expected_output == result.output
assert expected_output in result.output

def test_remote_library_as_external(self):
self.compare(source="remote_library.robot", config=":imports_order=library,resource,variables")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_invalid_pattern(self):
rf"Error: {self.TRANSFORMER_NAME}: Invalid 'replace_pattern' parameter value: '[\911]'. "
"It should be a valid regex expression. Regex error: 'bad escape \\9'\n"
)
assert expected_output == result.output
assert expected_output in result.output

def test_with_library_name_ignore(self):
self.compare(source="with_library_name.robot")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_invalid_pattern(self):
rf"Error: {self.TRANSFORMER_NAME}: Invalid 'replace_pattern' parameter value: '[\911]'. "
"It should be a valid regex expression. Regex error: 'bad escape \\9'\n"
)
assert expected_output == result.output
assert expected_output in result.output

def test_disablers(self):
self.compare(source="disablers.robot", not_modified=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_invalid_param(self, param_name, allowed):
f"Error: {self.TRANSFORMER_NAME}: Invalid '{param_name}' parameter value: 'invalid'. "
f"Invalid case type. Allowed case types are: {allowed}\n"
)
assert expected_output == result.output
assert expected_output in result.output

def test_invalid_variable_separator(self):
result = self.run_tidy(
Expand All @@ -94,7 +94,7 @@ def test_invalid_variable_separator(self):
f"Error: {self.TRANSFORMER_NAME}: Invalid 'variable_separator' parameter value: 'invalid'. "
f"Allowed values are: underscore, space, ignore\n"
)
assert expected_output == result.output
assert expected_output in result.output

def test_excluded_and_env_vars(self):
self.compare(source="excluded_vars.robot")
Expand Down
2 changes: 1 addition & 1 deletion tests/atest/transformers/Translate/test_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def test_bdd_alternative_invalid(self):
f"Error: {self.TRANSFORMER_NAME}: Invalid 'but_alternative' parameter value: 'chyba'. "
"Provided BDD keyword alternative does not exist in the destination language. Select one of: Ale\n"
)
assert expected_output == result.output
assert expected_output in result.output

def test_add_language_header(self):
config = ":language=pl:add_language_header=True"
Expand Down
35 changes: 19 additions & 16 deletions tests/utest/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_transform_not_existing_transformer(self, name, similar):
)
args = f"--transform {name} --transform MissingTransformer --transform DiscardEmptySections -".split()
result = run_tidy(args, exit_code=1)
assert expected_output == result.output
assert expected_output in result.output

# Disabled until validate_config_names remains commented out
# @pytest.mark.parametrize(
Expand All @@ -77,7 +77,7 @@ def test_transform_not_existing_transformer(self, name, similar):
# )
# args = f"--configure {name}:param=value -".split()
# result = run_tidy(args, exit_code=1)
# assert expected_output == result.output
# assert expected_output in result.output

@pytest.mark.parametrize("option_name", ["-t", "--transform"])
def test_not_existing_configurable_similar(self, option_name):
Expand All @@ -89,7 +89,7 @@ def test_not_existing_configurable_similar(self, option_name):

args = f"{option_name} DiscardEmptySections:allow_only_commentss=True -".split()
result = run_tidy(args, exit_code=1)
assert result.output == expected_output
assert expected_output in result.output

def test_not_existing_configurable(self):
expected_output = (
Expand All @@ -100,7 +100,7 @@ def test_not_existing_configurable(self):

args = "--transform DiscardEmptySections:invalid=True -".split()
result = run_tidy(args, exit_code=1)
assert result.output == expected_output
assert expected_output in result.output

def test_not_existing_configurable_skip(self):
expected_args = [
Expand All @@ -123,7 +123,7 @@ def test_not_existing_configurable_skip(self):
)
args = "--transform AlignTestCasesSection:invalid=True -".split()
result = run_tidy(args, exit_code=1)
assert result.output == expected_output
assert expected_output in result.output

def test_invalid_configurable_usage(self):
expected_output = (
Expand All @@ -132,7 +132,7 @@ def test_invalid_configurable_usage(self):
)
args = "--transform DiscardEmptySections=allow_only_comments=False -".split()
result = run_tidy(args, exit_code=1)
assert result.output == expected_output
assert expected_output in result.output

def test_too_many_arguments_for_transform(self):
expected_output = (
Expand All @@ -141,7 +141,7 @@ def test_too_many_arguments_for_transform(self):
)
args = "--transform DiscardEmptySections:allow_only_comments:False -".split()
result = run_tidy(args, exit_code=1)
assert result.output == expected_output
assert expected_output in result.output

def test_invalid_argument_type_for_transform(self):
expected_output = (
Expand All @@ -151,7 +151,7 @@ def test_invalid_argument_type_for_transform(self):
)
args = "--transform AlignVariablesSection:up_to_column=1a -".split()
result = run_tidy(args, exit_code=1)
assert result.output == expected_output
assert expected_output in result.output

def test_find_project_root_from_src(self):
src = TEST_DATA_DIR / "nested" / "test.robot"
Expand Down Expand Up @@ -267,7 +267,8 @@ def test_list_transformers_filter_disabled(self, flag):
def test_list_transformers_invalid_filter_value(self, flag):
cmd = [flag, "RenameKeywords"]
result = run_tidy(cmd, exit_code=2)
error = self.normalize_cli_error(result.stderr)
# Click bug, ignored due to Robotidy deprecation
error = self.normalize_cli_error(result.stderr + result.stdout)
assert (
"Invalid value for '--list' / '-l': Not allowed value. Allowed values are: all, enabled, disabled"
) in error
Expand Down Expand Up @@ -331,7 +332,7 @@ def test_check(self, source, return_status, expected_output):
exit_code=return_status,
)
mock_writer.assert_not_called()
assert result.output == expected_output
assert expected_output in result.output

@pytest.mark.parametrize(
"source, return_status, expected_output",
Expand All @@ -353,7 +354,7 @@ def test_check_overwrite(self, source, return_status, expected_output):
mock_writer.assert_called()
else:
mock_writer.assert_not_called()
assert result.output == expected_output
assert expected_output in result.output

def test_read_only_file(self):
source = TEST_DATA_DIR / "read_only" / "test.robot"
Expand Down Expand Up @@ -463,7 +464,7 @@ def test_src_and_space_in_param_in_configuration(self, source, should_parse, sum
path = source_dir / file
expected.append(f"Found {path} file")
actual = sorted(line for line in result.output.split("\n") if line.strip())
assert actual == sorted(expected)
assert all(line in actual for line in expected)

@pytest.mark.parametrize("source", [1, 2])
def test_empty_configuration(self, source):
Expand All @@ -483,14 +484,15 @@ def test_loading_from_stdin(self):
)
args = "--transform DiscardEmptySections -".split()
result = run_tidy(args, std_in=input_file)
assert result.output == expected_output
assert expected_output in result.output

@pytest.mark.parametrize("target_version", ["rf", "abc", "5", "rf3"])
@patch("robotidy.utils.misc.ROBOT_VERSION")
def test_invalid_target_version(self, mocked_version, target_version):
mocked_version.major = 5
result = run_tidy(f"--target-version {target_version} .".split(), exit_code=2)
error = self.normalize_cli_error(result.stderr)
# Click bug, ignored due to Robotidy deprecation
error = self.normalize_cli_error(result.stderr + result.stdout)
assert f"Invalid value for '--target-version' / '-tv':" in error

def normalize_cli_error(self, error):
Expand All @@ -504,7 +506,8 @@ def test_too_recent_target_version(self, mocked_version, option_name):
target_version = 5
mocked_version.major = 4
result = run_tidy(f"{option_name} rf{target_version} .".split(), exit_code=2)
error = self.normalize_cli_error(result.stderr)
# Click bug, ignored due to Robotidy deprecation
error = self.normalize_cli_error(result.stderr + result.stdout)
assert (
"Invalid value for '--target-version' / '-tv': "
f"Target Robot Framework version ({target_version}) "
Expand Down Expand Up @@ -605,4 +608,4 @@ def test_missing_dependency(self, monkeypatch, temporary_cwd):
"Error: Missing optional dependency: tomli_w. Install robotidy with extra `generate_config` "
"profile:\n\npip install robotframework-tidy[generate_config]\n"
)
assert result.output == expected_output
assert expected_output in result.output