Skip to content

Commit

Permalink
Merge pull request #160 from drmohundro/swiftlint-for-package.swift
Browse files Browse the repository at this point in the history
Add swiftlint for Package.swift
  • Loading branch information
drmohundro authored Oct 19, 2017
2 parents 5de7d41 + 8eaaf6d commit 24929e9
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 21 deletions.
1 change: 1 addition & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
included:
- Source
- Tests
- ./Package.swift
opt_in_rules:
- attributes
- closure_end_indentation
Expand Down
60 changes: 43 additions & 17 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,22 +1,48 @@
// swift-tools-version:4.0

//
// SWXMLHash.swift
// SWXMLHash
//
// Copyright (c) 2014 David Mohundro
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

import PackageDescription

let package = Package(
name: "SWXMLHash",
products: [
.library(
name: "SWXMLHash",
targets: ["SWXMLHash"]
)
],
targets: [
.target(
name: "SWXMLHash",
path: "Source"
),
.testTarget(
name: "SWXMLHashTests",
dependencies: ["SWXMLHash"]
)
]
name: "SWXMLHash",
products: [
.library(
name: "SWXMLHash",
targets: ["SWXMLHash"]
)
],
targets: [
.target(
name: "SWXMLHash",
path: "Source"
),
.testTarget(
name: "SWXMLHashTests",
dependencies: ["SWXMLHash"]
)
]
)
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ end
desc 'Clean, build and test SWXMLHash'
task :test do |_t|
# xctool_build_cmd = './scripts/build.sh'
xcode_build_cmd = 'xcodebuild -workspace SWXMLHash.xcworkspace -scheme "SWXMLHash iOS" -destination "OS=11.0,name=iPhone 7" clean build test -sdk iphonesimulator | xcpretty'
xcode_build_cmd = 'xcodebuild -workspace SWXMLHash.xcworkspace -scheme "SWXMLHash iOS" -destination "OS=11.0.1,name=iPhone 7" clean build test -sdk iphonesimulator'

#if system('which xctool')
#run xctool_build_cmd
Expand Down
6 changes: 3 additions & 3 deletions Source/SWXMLHash.swift
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ extension XMLParserDelegate {
didStartElement elementName: String,
namespaceURI: String?,
qualifiedName qName: String?,
attributes attributeDict: [String : String]) { }
attributes attributeDict: [String: String]) { }

func parser(_ parser: Foundation.XMLParser,
didEndElement elementName: String,
Expand Down Expand Up @@ -641,7 +641,7 @@ public enum XMLIndexer {
return .list(match)
}
}
fallthrough
return .xmlError(IndexingError.key(key: key))
default:
throw IndexingError.key(key: key)
}
Expand Down Expand Up @@ -684,7 +684,7 @@ public enum XMLIndexer {
if index == 0 {
return .element(elem)
}
fallthrough
return .xmlError(IndexingError.index(idx: index))
default:
return .xmlError(IndexingError.index(idx: index))
}
Expand Down

0 comments on commit 24929e9

Please sign in to comment.