Skip to content

Commit

Permalink
Add support for Robot Framework files with robotidy
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed Nov 26, 2023
1 parent 01ca22b commit 1b96528
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog].

## Unreleased

### Formatters
* [`robotidy`](https://robotidy.readthedocs.io) for Robot Framework files.

## 4.0 (released 2023-11-23)
### Breaking changes
* The order of entries in `apheleia-mode-alist` is no longer as
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" inplace
(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 ***
23 changes: 23 additions & 0 deletions test/formatters/samplecode/robotidy/out.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
*** 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 1b96528

Please sign in to comment.