Skip to content
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

Add support for Robot Framework files with robotidy #263

Merged
merged 2 commits into from
Nov 28, 2023
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ The format is based on [Keep a Changelog].
[HTML](https://en.wikipedia.org/wiki/HTML) and
[CSS](https://www.google.com/search?q=css)
([#229])
* [`robotidy`](https://robotidy.readthedocs.io) for Robot Framework files
([#263]).

[#229]: https://github.com/radian-software/apheleia/pull/229
[#263]: https://github.com/radian-software/apheleia/pull/263

## 4.0 (released 2023-11-23)
### Breaking changes
Expand Down
4 changes: 4 additions & 0 deletions apheleia-formatters.el
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@
"--parser=yaml"
(apheleia-formatters-js-indent "--use-tabs" "--tab-width")))
(purs-tidy . ("apheleia-npx" "purs-tidy" "format"))
(robotidy . ("robotidy" "--no-color" "-"
(apheleia-formatters-indent nil "--indent")
(apheleia-formatters-fill-column "--line-length")))
(rubocop . ("rubocop" "--stdin" filepath "--auto-correct"
"--stderr" "--format" "quiet" "--fail-level" "fatal"))
(ruby-standard . ("standardrb" "--stdin" filepath "--fix" "--stderr"
Expand Down Expand Up @@ -306,6 +309,7 @@ rather than using this system."
(purescript-mode . purs-tidy)
(python-mode . black)
(python-ts-mode . black)
(robot-mode . robotidy)
(ruby-mode . prettier-ruby)
(ruby-ts-mode . prettier-ruby)
(rustic-mode . rustfmt)
Expand Down
1 change: 1 addition & 0 deletions apheleia-utils.el
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ always returns nil to defer to the formatter."
(json-mode 'js-indent-level)
(json-ts-mode 'json-ts-mode-indent-offset)
(nxml-mode 'nxml-child-indent)
(robot-mode 'robot-mode-basic-offset)
(scss-mode 'css-indent-offset)
(web-mode 'web-mode-indent-style)
(tsx-ts-mode 'typescript-ts-mode-indent-offset)
Expand Down
2 changes: 2 additions & 0 deletions test/formatters/installers/robotidy.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
apt-get install -y python3-pip
python3 -m pip install robotframework-tidy
22 changes: 22 additions & 0 deletions test/formatters/samplecode/robotidy/in.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Force Tags tags tag2
Library Collections
Resource important.robot
Library MyCustomLibrary.py

Test Setup Setup Keyword


*** test case*
Test1
[ teardown] Teardown Keyword
Keyword
FOR ${var} IN RANGE 10
Run Keyword If ${var}>5 Other Keyword
END
*** Variables ***
${var}= 2
${bit_longer} 10
${var2} a
... b

*** Keywords ***
24 changes: 24 additions & 0 deletions test/formatters/samplecode/robotidy/out.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
*** Comments ***
Force Tags tags tag2
Library Collections
Resource important.robot
Library MyCustomLibrary.py

Test Setup Setup Keyword


*** Variables ***
${var}= 2
${bit_longer} 10
${var2} a
... b


*** Test Cases ***
Test1
Keyword
FOR ${var} IN RANGE 10
IF ${var}>5 Other Keyword
END
[Teardown] Teardown Keyword