Skip to content

Commit

Permalink
Add support for Robot Framework files with robotidy (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
scop authored Nov 28, 2023
1 parent 5e894a2 commit 5665172
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 0 deletions.
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

0 comments on commit 5665172

Please sign in to comment.