Skip to content

Commit 5034774

Browse files
committed
ci: lint for common file formatting issues
Extends the pre-commit configuration to lint for missing newlines at EOF, trailing whitespace, merge conflict markers etc.
1 parent 28a090d commit 5034774

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
lines changed

.github/workflows/linting.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Code linting
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
pre-commit:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
- uses: actions/setup-python@v4
12+
- uses: pre-commit/[email protected]

.pre-commit-config.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@ default_install_hook_types:
33
- pre-commit
44
- commit-msg
55
repos:
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: v4.4.0
8+
hooks:
9+
- id: trailing-whitespace
10+
- id: end-of-file-fixer
11+
- id: check-toml
12+
- id: check-yaml
13+
- id: check-added-large-files
14+
- id: check-merge-conflict
15+
- id: check-symlinks
16+
- id: fix-byte-order-marker
17+
- id: mixed-line-ending
18+
- id: trailing-whitespace
619
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
720
rev: v9.4.0
821
hooks:

model-server/build.gradle.kts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,10 @@ spotless {
158158
""" * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY""" + "\n" +
159159
""" * KIND, either express or implied. See the License for the""" + "\n" +
160160
""" * specific language governing permissions and limitations""" + "\n" +
161-
""" * under the License. """ + "\n" +
162-
" */\n"+
163-
"\n")
161+
""" * under the License.""" + "\n" +
162+
" */\n" +
163+
"\n",
164+
)
164165
/*licenseHeader '/*\n' +
165166
' * Licensed under the Apache License, Version 2.0 (the "License");\n' +
166167
' * you may not use this file except in compliance with the License.\n' +
@@ -173,9 +174,8 @@ spotless {
173174
' * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n' +
174175
' * KIND, either express or implied. See the License for the\n' +
175176
' * specific language governing permissions and limitations\n' +
176-
' * under the License. \n' +
177+
' * under the License.\n' +
177178
' */\n' +
178179
'\n'*/
179180
}
180181
}
181-

0 commit comments

Comments
 (0)