Skip to content

Commit a4940bd

Browse files
authored
Deprecate Robotidy for Robocop 6.0+ (#743)
* Deprecate Robotidy * Deprecate Robotidy for Robocop 6.0+ * Remove dependabot
1 parent b253b06 commit a4940bd

File tree

17 files changed

+63
-54
lines changed

17 files changed

+63
-54
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ Robotidy
1616
- [Usage](#usage)
1717
- [Example](#example)
1818

19+
DEPRECATION NOTICE
20+
------------
21+
Starting from Robocop 6.0, Robotidy is part of Robocop as formatter.
22+
23+
If you are new users, please use https://github.com/MarketSquare/robotframework-robocop instead.
24+
1925
Introduction <a name="introduction"></a>
2026
------------
2127
Robotidy is a tool for autoformatting Robot Framework code.

docs/source/overview.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
Deprecation notice
2+
-------------------
3+
4+
Starting with Robocop 6.0, Robotidy is now integrated into Robocop.
5+
The standalone version of Robotidy is deprecated and may not support the latest Robot Framework versions.
6+
7+
Please see https://robocop.readthedocs.io/en/stable/ for Robocop documentation.
8+
19
Introduction
210
------------
311
Robotidy is a tool for autoformatting Robot Framework code.

robotidy/cli.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,7 @@ def cli(ctx: click.Context, **kwargs):
492492
Robotidy is a tool for formatting Robot Framework source code.
493493
Full documentation available at <https://robotidy.readthedocs.io> .
494494
"""
495+
print_deprecation_warning()
495496
cli_config = RawConfig.from_cli(ctx=ctx, **kwargs)
496497
global_config = config_module.MainConfig(cli_config)
497498
global_config.validate_src_is_required()
@@ -507,3 +508,10 @@ def cli(ctx: click.Context, **kwargs):
507508
tidy = app.Robotidy(global_config)
508509
status = tidy.transform_files()
509510
sys.exit(status)
511+
512+
513+
def print_deprecation_warning() -> None:
514+
print(
515+
"DeprecationWarning: Starting with Robocop 6.0, Robotidy is now integrated into Robocop. "
516+
"The standalone version of Robotidy is deprecated and may not support the latest Robot Framework versions.\n"
517+
)

robotidy/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "4.16.0"
1+
__version__ = "4.17.0"

setup.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@
4141
include_package_data=True,
4242
python_requires=">=3.8",
4343
install_requires=[
44-
"robotframework>=4.0,<7.3",
44+
"robotframework>=4.0",
4545
"click==8.1.*",
46-
"colorama>=0.4.3,<0.4.7",
47-
"pathspec>=0.9.0,<0.12.2",
48-
"tomli>=2.0,<2.3",
49-
"rich_click>=1.4,<1.8.6",
50-
"jinja2>=3.1.3,<4.0",
46+
"colorama>=0.4.3",
47+
"pathspec>=0.9.0",
48+
"tomli>=2.0",
49+
"rich_click>=1.4",
50+
"jinja2>=3.1.3",
5151
],
5252
extras_require={
5353
"dev": [

tests/atest/transformers/GenerateDocumentation/test_transformer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def test_invalid_template_path(self):
5252
f"Error: {self.TRANSFORMER_NAME}: Invalid 'doc_template' parameter value: '{template_path}'. "
5353
f"The template path does not exist or cannot be found.\n"
5454
)
55-
assert expected_output == result.output
55+
assert expected_output in result.output
5656

5757
def test_invalid_template(self):
5858
template_path = Path(__file__).parent / "source" / "invalid_template.jinja"
@@ -65,4 +65,4 @@ def test_invalid_template(self):
6565
f"Failed to load the template: Unexpected end of template. Jinja was looking for the "
6666
f"following tags: 'endfor' or 'else'. The innermost block that needs to be closed is 'for'.\n"
6767
)
68-
assert expected_output == result.output
68+
assert expected_output in result.output

tests/atest/transformers/MergeAndOrderSections/test_merge_and_order_sections.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def test_invalid_order_parameter(self, parameter):
6969
"Custom order should be provided in comma separated list with all section names:\n"
7070
"order=comments,settings,variables,testcases,tasks,variables\n"
7171
)
72-
assert expected_output == result.output
72+
assert expected_output in result.output
7373

7474
def test_inline_if(self):
7575
self.compare(source="inline_if.robot", not_modified=True)

tests/atest/transformers/NormalizeAssignments/test_transformer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def test_invalid_equal_sign_type(self, param_name):
4848
f"Error: {self.TRANSFORMER_NAME}: Invalid '=' parameter value: '{param_name}'. "
4949
"Possible values:\n remove\n equal_sign\n space_and_equal_sign\n"
5050
)
51-
assert expected_output == result.output
51+
assert expected_output in result.output
5252

5353
def test_disablers(self):
5454
self.compare(source="disablers.robot", not_modified=True)

tests/atest/transformers/NormalizeTags/test_transformer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def test_wrong_case(self):
3232
f"Error: {self.TRANSFORMER_NAME}: Invalid 'case' parameter value: 'invalid'. "
3333
f"Supported cases: lowercase, uppercase, titlecase.\n"
3434
)
35-
assert expected_output == result.output
35+
assert expected_output in result.output
3636

3737
def test_only_remove_duplicates(self):
3838
self.compare(source="duplicates.robot", config=f":normalize_case=False")

tests/atest/transformers/OrderSettings/test_order_settings.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def test_custom_order_invalid_param(self):
6060
f" Custom order should be provided in comma separated list with valid setting names: "
6161
f"arguments,documentation,return,setup,tags,teardown,timeout\n"
6262
)
63-
assert result.output == expected_output
63+
assert expected_output in result.output
6464

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

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

9494
def test_translated(self):
9595
self.compare(source="translated.robot", target_version=">=6")

tests/atest/transformers/OrderSettingsSection/test_transformer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def test_invalid_group(self):
6464
"Custom order should be provided in comma separated list with valid group names:\n"
6565
"('documentation', 'imports', 'settings', 'tags')\n"
6666
)
67-
assert expected_output == result.output
67+
assert expected_output in result.output
6868

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

8989
def test_remote_library_as_external(self):
9090
self.compare(source="remote_library.robot", config=":imports_order=library,resource,variables")

tests/atest/transformers/RenameKeywords/test_transformer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def test_invalid_pattern(self):
4141
rf"Error: {self.TRANSFORMER_NAME}: Invalid 'replace_pattern' parameter value: '[\911]'. "
4242
"It should be a valid regex expression. Regex error: 'bad escape \\9'\n"
4343
)
44-
assert expected_output == result.output
44+
assert expected_output in result.output
4545

4646
def test_with_library_name_ignore(self):
4747
self.compare(source="with_library_name.robot")

tests/atest/transformers/RenameTestCases/test_transformer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def test_invalid_pattern(self):
4444
rf"Error: {self.TRANSFORMER_NAME}: Invalid 'replace_pattern' parameter value: '[\911]'. "
4545
"It should be a valid regex expression. Regex error: 'bad escape \\9'\n"
4646
)
47-
assert expected_output == result.output
47+
assert expected_output in result.output
4848

4949
def test_disablers(self):
5050
self.compare(source="disablers.robot", not_modified=True)

tests/atest/transformers/RenameVariables/test_transformer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def test_invalid_param(self, param_name, allowed):
8282
f"Error: {self.TRANSFORMER_NAME}: Invalid '{param_name}' parameter value: 'invalid'. "
8383
f"Invalid case type. Allowed case types are: {allowed}\n"
8484
)
85-
assert expected_output == result.output
85+
assert expected_output in result.output
8686

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

9999
def test_excluded_and_env_vars(self):
100100
self.compare(source="excluded_vars.robot")

tests/atest/transformers/Translate/test_transformer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def test_bdd_alternative_invalid(self):
5454
f"Error: {self.TRANSFORMER_NAME}: Invalid 'but_alternative' parameter value: 'chyba'. "
5555
"Provided BDD keyword alternative does not exist in the destination language. Select one of: Ale\n"
5656
)
57-
assert expected_output == result.output
57+
assert expected_output in result.output
5858

5959
def test_add_language_header(self):
6060
config = ":language=pl:add_language_header=True"

tests/utest/test_cli.py

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def test_transform_not_existing_transformer(self, name, similar):
5858
)
5959
args = f"--transform {name} --transform MissingTransformer --transform DiscardEmptySections -".split()
6060
result = run_tidy(args, exit_code=1)
61-
assert expected_output == result.output
61+
assert expected_output in result.output
6262

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

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

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

9494
def test_not_existing_configurable(self):
9595
expected_output = (
@@ -100,7 +100,7 @@ def test_not_existing_configurable(self):
100100

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

105105
def test_not_existing_configurable_skip(self):
106106
expected_args = [
@@ -123,7 +123,7 @@ def test_not_existing_configurable_skip(self):
123123
)
124124
args = "--transform AlignTestCasesSection:invalid=True -".split()
125125
result = run_tidy(args, exit_code=1)
126-
assert result.output == expected_output
126+
assert expected_output in result.output
127127

128128
def test_invalid_configurable_usage(self):
129129
expected_output = (
@@ -132,7 +132,7 @@ def test_invalid_configurable_usage(self):
132132
)
133133
args = "--transform DiscardEmptySections=allow_only_comments=False -".split()
134134
result = run_tidy(args, exit_code=1)
135-
assert result.output == expected_output
135+
assert expected_output in result.output
136136

137137
def test_too_many_arguments_for_transform(self):
138138
expected_output = (
@@ -141,7 +141,7 @@ def test_too_many_arguments_for_transform(self):
141141
)
142142
args = "--transform DiscardEmptySections:allow_only_comments:False -".split()
143143
result = run_tidy(args, exit_code=1)
144-
assert result.output == expected_output
144+
assert expected_output in result.output
145145

146146
def test_invalid_argument_type_for_transform(self):
147147
expected_output = (
@@ -151,7 +151,7 @@ def test_invalid_argument_type_for_transform(self):
151151
)
152152
args = "--transform AlignVariablesSection:up_to_column=1a -".split()
153153
result = run_tidy(args, exit_code=1)
154-
assert result.output == expected_output
154+
assert expected_output in result.output
155155

156156
def test_find_project_root_from_src(self):
157157
src = TEST_DATA_DIR / "nested" / "test.robot"
@@ -267,7 +267,8 @@ def test_list_transformers_filter_disabled(self, flag):
267267
def test_list_transformers_invalid_filter_value(self, flag):
268268
cmd = [flag, "RenameKeywords"]
269269
result = run_tidy(cmd, exit_code=2)
270-
error = self.normalize_cli_error(result.stderr)
270+
# Click bug, ignored due to Robotidy deprecation
271+
error = self.normalize_cli_error(result.stderr + result.stdout)
271272
assert (
272273
"Invalid value for '--list' / '-l': Not allowed value. Allowed values are: all, enabled, disabled"
273274
) in error
@@ -331,7 +332,7 @@ def test_check(self, source, return_status, expected_output):
331332
exit_code=return_status,
332333
)
333334
mock_writer.assert_not_called()
334-
assert result.output == expected_output
335+
assert expected_output in result.output
335336

336337
@pytest.mark.parametrize(
337338
"source, return_status, expected_output",
@@ -353,7 +354,7 @@ def test_check_overwrite(self, source, return_status, expected_output):
353354
mock_writer.assert_called()
354355
else:
355356
mock_writer.assert_not_called()
356-
assert result.output == expected_output
357+
assert expected_output in result.output
357358

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

468469
@pytest.mark.parametrize("source", [1, 2])
469470
def test_empty_configuration(self, source):
@@ -483,14 +484,15 @@ def test_loading_from_stdin(self):
483484
)
484485
args = "--transform DiscardEmptySections -".split()
485486
result = run_tidy(args, std_in=input_file)
486-
assert result.output == expected_output
487+
assert expected_output in result.output
487488

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

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

0 commit comments

Comments
 (0)