-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit 6b63700
Use formatter script in CI workflow
The repository includes a script that formats the code in the example sketches.
Previously, this script was only provided to make it easy for contributors to achieve compliant code formatting while
preparing a pull request.
In addition to this effort to facilitate compliance, enforcement is implemented by a GitHub Actions workflow.
Since the formatter tool does not have the directory tree recursion capability needed to process all the files in the
repository, it is necessary to implement such capability using a `find` command. Previously this was done both in the
script and the workflow.
`find` is ridiculously complex and unintuitive, prone to confusing bugs. For this reason, it will be best to avoid
maintaining redundant code for recursing through the example code files. This is accomplished by simply running the
script from the workflow. Even though the two have different goals (making formatting compliant vs checking whether
formatting is compliant), the two are easily aligned by formatting the files in the workflow, then checking for a diff.
This approach has been widely used in other Arduino Tooling Team formatting check workflows and I find the diff is very
effective at communicating which changes are required, likely more so than the approach previously used in the workflow.1 parent 124bead commit 6b63700
1 file changed
+11
-18
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4 | 4 |
| |
5 | 5 |
| |
6 | 6 |
| |
7 | + | ||
7 | 8 |
| |
8 | 9 |
| |
9 | 10 |
| |
10 | 11 |
| |
12 | + | ||
11 | 13 |
| |
12 | 14 |
| |
13 | 15 |
| |
| |||
37 | 39 |
| |
38 | 40 |
| |
39 | 41 |
| |
42 | + | ||
43 | + | ||
44 | + | ||
40 | 45 |
| |
41 | - | ||
42 | - | ||
46 | + | ||
47 | + | ||
48 | + | ||
49 | + | ||
43 | 50 |
| |
44 | - | ||
45 | - | ||
46 | - | ||
47 | - | ||
48 | - | ||
49 | - | ||
50 | - | ||
51 | - | ||
52 | - | ||
53 | - | ||
54 | - | ||
55 | - | ||
56 | - | ||
57 | - | ||
58 | - | ||
51 | + | ||
59 | 52 |
| |
60 | 53 |
| |
61 | 54 |
| |
55 | + | ||
62 | 56 |
| |
63 | - |
0 commit comments