You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/docs/software/advanced-gradlerio/code-formatting.rst
+25-28Lines changed: 25 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,7 +73,27 @@ Running Spotless
73
73
74
74
Spotless can be ran using ``./gradlew spotlessApply`` which will apply all formatting options. You can also specify a specific task by just adding the name of formatter. An example is ``./gradlew spotlessmiscApply``.
75
75
76
-
Spotless can also be used as a :doc:`CI check <robot-code-ci>`. The check is ran with ``./gradlew spotlessCheck``.
76
+
In addition to formatting code, Spotless can also ensure the code is correctly formatted; this can be used by running ``./gradlew spotlessCheck``. Thus, Spotless can be used as a :doc:`CI check <robot-code-ci>`, as shown in the following GitHub Actions workflow:
77
+
78
+
.. code-block:: yaml
79
+
80
+
on: [push]
81
+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
82
+
jobs:
83
+
spotless:
84
+
# The type of runner that the job will run on
85
+
runs-on: ubuntu-latest
86
+
# Steps represent a sequence of tasks that will be executed as part of the job
87
+
steps:
88
+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
89
+
- uses: actions/checkout@v2
90
+
with:
91
+
fetch-depth: 0
92
+
- uses: actions/setup-java@v3
93
+
with:
94
+
distribution: 'zulu'
95
+
java-version: 17
96
+
- run: ./gradlew spotlessCheck
77
97
78
98
Explanation of Options
79
99
^^^^^^^^^^^^^^^^^^^^^^
@@ -191,31 +211,8 @@ An example styleguide is shown below:
191
211
192
212
.. note:: Teams can adapt ``.styleguide`` and ``.styleguide-license`` however they wish. It's important that these are not deleted, as they are required to run wpiformat!
193
213
194
-
You can turn this into a :doc:`CI check <robot-code-ci>` by running ``git --no-pager diff --exit-code HEAD``. It can be configured with a ``.clang-format`` configuration file. An example configuration file is provided below.
195
-
196
-
Below is an example GitHub Actions check that uses wpiformat
197
-
198
-
.. code-block:: yaml
214
+
You can turn this into a :doc:`CI check <robot-code-ci>` by running ``git --no-pager diff --exit-code HEAD``, as shown in the example GitHub Actions workflow below:
0 commit comments