Skip to content

Commit

Permalink
build: edit git hooks to not block pushing (#374)
Browse files Browse the repository at this point in the history
  • Loading branch information
levibostian committed Aug 29, 2023
1 parent 2938fb9 commit f7c456a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
14 changes: 5 additions & 9 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,12 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Install swiftformat
run: brew install swiftformat || brew upgrade swiftformat
- name: Install swiftformat and swiftlint
run: |
brew update # verifies brew knows latest versions of all CLIs
brew install swiftformat || brew upgrade swiftformat
brew install swiftlint || brew upgrade swiftlint
- name: Run swiftformat. Fail if any errors.
run: make format && git diff --exit-code

SwiftLint:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Install swiftlint
run: brew install swiftlint || brew upgrade swiftlint
- name: Run swiftlint. Fail if any errors.
run: make lint
2 changes: 1 addition & 1 deletion Sources/Common/Store/QueueInventoryMemoryStore.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

// In-memory store of the BQ inventory. This acts as a cache to unnecessary reading the file system from the file system.
internal protocol QueueInventoryMemoryStore {
protocol QueueInventoryMemoryStore {
var inventory: [QueueTaskMetadata]? { get set }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,12 +391,12 @@ extension DIGraph {
}

// QueueInventoryMemoryStore (singleton)
internal var queueInventoryMemoryStore: QueueInventoryMemoryStore {
var queueInventoryMemoryStore: QueueInventoryMemoryStore {
getOverriddenInstance() ??
sharedQueueInventoryMemoryStore
}

internal var sharedQueueInventoryMemoryStore: QueueInventoryMemoryStore {
var sharedQueueInventoryMemoryStore: QueueInventoryMemoryStore {
// Use a DispatchQueue to make singleton thread safe. You must create unique dispatchqueues instead of using 1 shared one or you will get a crash when trying
// to call DispatchQueue.sync{} while already inside another DispatchQueue.sync{} call.
DispatchQueue(label: "DIGraph_QueueInventoryMemoryStore_singleton_access").sync {
Expand Down
3 changes: 2 additions & 1 deletion lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ pre-push:
commands:
lint:
# Run linter giving you errors to fix.
run: make lint
# By using `|| echo "..."`, we do not block you from pushing code. Running lint in a git hooks is to warn you about lint errors early, but not block you from pushing code with errors if you decide to push.
run: make lint || echo -e "\n\n ⚠️ Linting contains errors that will prevent you from merging a pull request. Fix errors above if you are planning on making a pull request."

0 comments on commit f7c456a

Please sign in to comment.