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

Run Danger with GitHub Actions #163

Merged
merged 9 commits into from
Mar 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 28 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Danger Swift
uses: maxdesiatov/danger-swift@swiftlint-docker
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions Dangerfile.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Danger

SwiftLint.lint(inline: true, configFile: ".swiftlint.yml", strict: true)
2 changes: 1 addition & 1 deletion Sources/XMLCoder/Decoder/XMLDecoderImplementation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class XMLDecoderImplementation: Decoder {
}

public func container<Key>(keyedBy keyType: Key.Type) throws -> KeyedDecodingContainer<Key> {
if let keyed = try self.topContainer() as? SharedBox<KeyedBox> {
if let keyed = try topContainer() as? SharedBox<KeyedBox> {
return KeyedDecodingContainer(XMLKeyedDecodingContainer<Key>(
referencing: self,
wrapping: keyed
Expand Down
2 changes: 1 addition & 1 deletion Sources/XMLCoder/Decoder/XMLKeyedDecodingContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ extension XMLKeyedDecodingContainer {
_ type: T.Type,
forKey key: Key
) throws -> T {
guard let strategy = self.decoder.nodeDecodings.last else {
guard let strategy = decoder.nodeDecodings.last else {
preconditionFailure(
"""
Attempt to access node decoding strategy from empty stack.
Expand Down
8 changes: 4 additions & 4 deletions Sources/XMLCoder/Decoder/XMLUnkeyedDecodingContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct XMLUnkeyedDecodingContainer: UnkeyedDecodingContainer {
public mutating func decodeNil() throws -> Bool {
guard !isAtEnd else {
throw DecodingError.valueNotFound(Any?.self, DecodingError.Context(
codingPath: decoder.codingPath + [XMLKey(index: self.currentIndex)],
codingPath: decoder.codingPath + [XMLKey(index: currentIndex)],
debugDescription: "Unkeyed container is at end."
))
}
Expand All @@ -75,7 +75,7 @@ struct XMLUnkeyedDecodingContainer: UnkeyedDecodingContainer {
_ type: T.Type,
decode: (XMLDecoderImplementation, Box) throws -> T?
) throws -> T {
guard let strategy = self.decoder.nodeDecodings.last else {
guard let strategy = decoder.nodeDecodings.last else {
preconditionFailure("Attempt to access node decoding strategy from empty stack.")
}
decoder.codingPath.append(XMLKey(index: currentIndex))
Expand All @@ -90,7 +90,7 @@ struct XMLUnkeyedDecodingContainer: UnkeyedDecodingContainer {
}
guard !isAtEnd else {
throw DecodingError.valueNotFound(type, DecodingError.Context(
codingPath: decoder.codingPath + [XMLKey(index: self.currentIndex)],
codingPath: decoder.codingPath + [XMLKey(index: currentIndex)],
debugDescription: "Unkeyed container is at end."
))
}
Expand Down Expand Up @@ -128,7 +128,7 @@ struct XMLUnkeyedDecodingContainer: UnkeyedDecodingContainer {

guard let decoded: T = value else {
throw DecodingError.valueNotFound(type, DecodingError.Context(
codingPath: decoder.codingPath + [XMLKey(index: self.currentIndex)],
codingPath: decoder.codingPath + [XMLKey(index: currentIndex)],
debugDescription: "Expected \(type) but found null instead."
))
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/XMLCoder/Encoder/XMLKeyedEncodingContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ struct XMLKeyedEncodingContainer<K: CodingKey>: KeyedEncodingContainerProtocol {
_ = self.encoder.nodeEncodings.removeLast()
self.encoder.codingPath.removeLast()
}
guard let strategy = self.encoder.nodeEncodings.last else {
guard let strategy = encoder.nodeEncodings.last else {
preconditionFailure(
"Attempt to access node encoding strategy from empty stack."
)
Expand Down
3 changes: 1 addition & 2 deletions lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ set -e
set -o pipefail

brew update
brew install swiftformat swiftlint
brew install swiftformat

swiftformat --lint --verbose .
swiftlint