From 49431dbd567da8593f85c3bf2a17f19e0e9e9a13 Mon Sep 17 00:00:00 2001 From: Tatu Aalto Date: Fri, 29 Mar 2024 22:25:15 +0200 Subject: [PATCH] Add RoboTidy --- pyproject.toml | 10 ++++++++++ tasks.py | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 264f679..7236270 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -61,3 +61,13 @@ lint.select = [ testpaths = ["utest"] log_format = "%(asctime)s %(levelname)s %(message)s" log_date_format = "%Y-%m-%d %H:%M:%S" + +[tool.robotidy] +lineseparator = "unix" +configure = [ + "NormalizeAssignments:equal_sign_type=space_and_equal_sign", + "NormalizeAssignments:equal_sign_type_variables=space_and_equal_sign", + "NormalizeNewLines:section_lines=1", + "RenameTestCases:enabled=True:capitalize_each_word=True", + "RenameKeywords:enabled=True", +] diff --git a/tasks.py b/tasks.py index 8691917..369368c 100644 --- a/tasks.py +++ b/tasks.py @@ -1,3 +1,5 @@ +import os + from invoke import task @@ -12,6 +14,14 @@ def lint(ctx, fix=False): if fix: ruff_cmd = f"{ruff_cmd} --fix" ctx.run(ruff_cmd) + in_ci = os.getenv("GITHUB_WORKFLOW") + print(f"Lint Robot files {'in ci' if in_ci else ''}") + cmd = ["robotidy", "atest"] + if in_ci: + cmd.insert(1, "--check") + cmd.insert(1, "--diff") + print(cmd) + ctx.run(" ".join(cmd)) @task