File tree Expand file tree Collapse file tree 4 files changed +32
-3
lines changed
Expand file tree Collapse file tree 4 files changed +32
-3
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.
44## [ Unreleased]
55
66## Added
7+ - Updating pre-commit hook rules
8+ - Added in Pull Request [ #5 ] ( https://github.com/space-code/atomic/pull/5 ) .
79
810- Integrate ` CodeCov `
911 - Added in Pull Request [ #4 ] ( https://github.com/space-code/atomic/pull/4 ) .
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ public final class Atomic<Value> {
6868
6969extension Atomic : Equatable where Value: Equatable {
7070 public static func == ( lhs: Atomic < Value > , rhs: Atomic < Value > ) -> Bool {
71- lhs. read { left in rhs. read { right in left == right } }
71+ lhs. read { left in rhs. read { right in left == right } }
7272 }
7373}
7474
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ final class UnfairLock {
1717 // MARK: Initialization
1818
1919 /// Initializes an UnfairLock instance.
20- public init ( ) {
20+ init ( ) {
2121 unfairLock = . allocate( capacity: 1 )
2222 unfairLock. initialize ( to: os_unfair_lock ( ) )
2323 }
Original file line number Diff line number Diff line change @@ -8,4 +8,31 @@ git diff --diff-filter=d --staged --name-only | grep -e '\.swift$' | while read
88 fi
99done
1010
11- swiftlint
11+ LINT=$( which mint)
12+ if [[ -e " ${LINT} " ]]; then
13+ # Export files in SCRIPT_INPUT_FILE_$count to lint against later
14+ count=0
15+ while IFS= read -r file_path; do
16+ export SCRIPT_INPUT_FILE_$count =" $file_path "
17+ count=$(( count + 1 ))
18+ done < <( git diff --name-only --cached --diff-filter=d | grep " .swift$" )
19+ export SCRIPT_INPUT_FILE_COUNT=$count
20+
21+ if [ " $count " -eq 0 ]; then
22+ echo " No files to lint!"
23+ exit 0
24+ fi
25+
26+ echo " Found $count lintable files! Linting now.."
27+ mint run swiftlint --use-script-input-files --strict --config .swiftlint.yml
28+ RESULT=$? # swiftline exit value is number of errors
29+
30+ if [ $RESULT -eq 0 ]; then
31+ echo " 🎉 Well done. No violation."
32+ fi
33+ exit $RESULT
34+ else
35+ echo " ⚠️ WARNING: SwiftLint not found"
36+ echo " ⚠️ You might want to edit .git/hooks/pre-commit to locate your swiftlint"
37+ exit 0
38+ fi
You can’t perform that action at this time.
0 commit comments