Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistent Code Style #37

Merged
merged 27 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e4417b5
add swiftlint & swiftformat
Patrick-Kladek Apr 12, 2024
bc32461
run formatter for while codebase
Patrick-Kladek Apr 12, 2024
75373e7
fix redundant_void_return warnings
Patrick-Kladek Apr 12, 2024
fb4b594
fix void_function_in_ternary warning
Patrick-Kladek Apr 12, 2024
3ea74f4
fix for_where warning
Patrick-Kladek Apr 12, 2024
a3597fe
change property to let
Patrick-Kladek Apr 12, 2024
07aed58
fix unused_optional_binding warning
Patrick-Kladek Apr 12, 2024
291212a
fix multiple_closures_with_trailing_closure
Patrick-Kladek Apr 12, 2024
a4afa44
fix leading_whitespace warning
Patrick-Kladek Apr 12, 2024
56aafda
fix deprecation warning
Patrick-Kladek Apr 12, 2024
211f4ed
add pull request template
Patrick-Kladek Apr 12, 2024
001bbb7
add githook
Patrick-Kladek Apr 12, 2024
c041a85
update contributing
Patrick-Kladek Apr 12, 2024
d731478
remove macOS platform
Patrick-Kladek Apr 12, 2024
803f22f
try iOS12 SwiftLintPlugin
Patrick-Kladek Apr 13, 2024
8203f5b
fix build error
Patrick-Kladek Apr 13, 2024
efafcd3
fix deprecation warning
Patrick-Kladek Apr 15, 2024
926e394
use new Hashable requirement
Patrick-Kladek Apr 15, 2024
a6278c6
remove unused code
Patrick-Kladek Apr 15, 2024
e6ac126
fix warning about wrong api usage
Patrick-Kladek Apr 15, 2024
1f63985
fix duplicated
Patrick-Kladek Apr 15, 2024
ba33a72
ensure self usage via SwiftFormat
Patrick-Kladek Apr 15, 2024
dfe6d14
update contributing
Patrick-Kladek Apr 15, 2024
e2e6541
increase test timeout
Patrick-Kladek Apr 17, 2024
de877e0
remove swiftlint plugin
Patrick-Kladek Apr 17, 2024
a124bf7
add swiftlint to build action
Patrick-Kladek Apr 17, 2024
ef8d2b3
rename workflow
Patrick-Kladek Apr 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

# Will download all dependencies if not already existing
swift package plugin --list

./.tools/git-format-staged --formatter ".build/checkouts/SwiftFormat/CommandLineTool/swiftformat stdin --stdinpath '{}'" "*.swift"
10 changes: 10 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
### Description



### Open Tasks

- [ ]

### Infos for Reviewer

42 changes: 28 additions & 14 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: iOS starter workflow
name: iOS

on:
push:
Expand All @@ -7,22 +7,36 @@ on:
pull_request:

jobs:
build:
name: Build and Test using Xcode 15.3 on iPhone 15 Pro
format:
name: Code Style
runs-on: macos-14
steps:
- name: Install tools
run: brew install swiftlint

- name: Checkout
uses: actions/checkout@v4

- name: Check format
run: swiftlint lint . --reporter github-actions-logging

test:
name: Build and Test
runs-on: macos-14
steps:
- name: Configure Xcode 15.3
run: |
sudo xcode-select -s /Applications/Xcode_15.3.app
- name: Print Xcode Version
run: |
xcode-select --print-path
- name: Install tools
run: brew install xcbeautify

- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Build
run: |
set -o pipefail && xcodebuild build -scheme maplibre-navigation-ios -destination 'platform=iOS Simulator,OS=17.0.1,name=iPhone 15 Pro' | xcbeautify --renderer github-actions
run: set -o pipefail && xcodebuild build -scheme maplibre-navigation-ios -destination 'platform=iOS Simulator,OS=17.0.1,name=iPhone 15 Pro' | xcbeautify --renderer github-actions

- name: Test
run: |
set -o pipefail && xcodebuild test -scheme maplibre-navigation-ios -destination 'platform=iOS Simulator,OS=17.0.1,name=iPhone 15 Pro' | xcbeautify --renderer github-actions
run: set -o pipefail && xcodebuild test -scheme maplibre-navigation-ios -destination 'platform=iOS Simulator,OS=17.0.1,name=iPhone 15 Pro' | xcbeautify --renderer github-actions
85 changes: 85 additions & 0 deletions .swiftformat
Patrick-Kladek marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
--acronyms ID,URL,UUID
--allman false
--anonymousforeach convert
--assetliterals visual-width
--asynccapturing
--beforemarks
--binarygrouping none
--categorymark "MARK: %c"
--classthreshold 0
--closingparen balanced
--closurevoid remove
--commas inline
--conflictmarkers reject
--decimalgrouping 3,6
--doccomments before-declarations
--elseposition same-line
--emptybraces no-space
--enumnamespaces always
--enumthreshold 0
--exponentcase lowercase
--exponentgrouping disabled
--extensionacl on-extension
--extensionlength 0
--extensionmark "MARK: - %t + %c"
--fractiongrouping disabled
--fragment false
--funcattributes preserve
--generictypes
--groupedextension "MARK: %c"
--guardelse auto
--header ignore
--hexgrouping none
--hexliteralcase uppercase
--ifdef no-indent
--importgrouping alpha
--indent 4
--indentcase false
--indentstrings false
--lifecycle
--lineaftermarks true
--linebreaks lf
--markcategories true
--markextensions always
--marktypes always
--maxwidth none
--modifierorder
--nevertrailing
--nospaceoperators
--nowrapoperators
--octalgrouping none
--onelineforeach ignore
--operatorfunc spaced
--organizetypes actor,class,enum,struct
--patternlet hoist
--ranges spaced
--redundanttype infer-locals-only
--self insert
Patrick-Kladek marked this conversation as resolved.
Show resolved Hide resolved
--selfrequired
--semicolons inline
--shortoptionals except-properties
--smarttabs enabled
--someany true
--stripunusedargs closure-only
--structthreshold 0
--tabwidth unspecified
--throwcapturing
--trailingclosures
--trimwhitespace nonblank-lines
--typeattributes preserve
--typeblanklines remove
--typemark "MARK: - %t"
--varattributes preserve
--voidtype void
--wraparguments disabled
--wrapcollections preserve
--wrapconditions preserve
--wrapeffects preserve
--wrapenumcases always
--wrapparameters after-first
--wrapreturntype preserve
--wrapternary default
--wraptypealiases preserve
--xcodeindentation disabled
--yodaswap always
--disable wrapMultilineStatementBraces
22 changes: 22 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
disabled_rules:
- trailing_whitespace
- private_over_fileprivate
- line_length
- force_cast
- function_body_length
- identifier_name
- cyclomatic_complexity
- type_body_length
- file_length
- force_try
excluded: # paths to ignore during linting. Takes precedence over `included`.
- Carthage
- MapboxCoreNavigationTests
- MapboxNavigationTests
- scripts
- .build

identifier_name:
max_length:
warning: 60
error: 100

nesting:
type_level:
warning: 3
error: 6
function_level:
warning: 5
error: 10
Loading
Loading