Skip to content

Commit 26a834b

Browse files
committed
ci: set up linting on ci
1 parent 0993c2d commit 26a834b

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

.github/workflows/pull_request.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ name: Pull Requst
33
on: [pull_request]
44

55
jobs:
6+
lint:
7+
name: Lint Formatting
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- name: Lint Formatting
12+
run: swift format lint --recursive --strict .
13+
614
test-ubuntu-latest:
715
name: Test Swift ${{ matrix.swift }} Ubuntu Latest
816
strategy:

.swift-format

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"fileScopedDeclarationPrivacy" : {
3+
"accessLevel" : "private"
4+
},
5+
"indentation" : {
6+
"spaces" : 4
7+
},
8+
"indentConditionalCompilationBlocks" : false,
9+
"indentSwitchCaseLabels" : true,
10+
"lineLength" : 140,
11+
"rules" : {
12+
"AllPublicDeclarationsHaveDocumentation" : true,
13+
"NeverForceUnwrap" : true,
14+
"NeverUseForceTry" : true,
15+
"NeverUseImplicitlyUnwrappedOptionals" : true,
16+
"NoAccessLevelOnExtensionDeclaration" : true,
17+
"NoLeadingUnderscores" : true,
18+
"OmitExplicitReturns" : true,
19+
"UseEarlyExits" : true,
20+
"UseWhereClausesInForLoops" : true,
21+
"ValidateDocumentationComments" : true
22+
},
23+
"spacesAroundRangeFormationOperators" : true,
24+
"version" : 1
25+
}

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,15 @@
22
## Getting Started
33

44
## Contributing
5+
### Code Formatting
6+
This package makes use of [swift-format](https://github.com/swiftlang/swift-format), which is built directly into the swift toolchain as of
7+
swift 6. To apply formatting rules to all files, which you should do before submitting a PR, run from the root of the repository:
58

6-
## Additional Resources
9+
```sh
10+
swift format --in-place --recursive .
11+
```
12+
13+
Formatting is validated with the `--strict` flag on every PR
14+
15+
16+
## Additional Resources

0 commit comments

Comments
 (0)