Skip to content

Commit

Permalink
Merged by Peril
Browse files Browse the repository at this point in the history
Initial support to swift 5.0
  • Loading branch information
peril-staging[bot] committed Mar 22, 2019
2 parents 2141d44 + 3f7c25e commit 0456d98
Show file tree
Hide file tree
Showing 6 changed files with 289 additions and 215 deletions.
18 changes: 12 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,18 @@ matrix:
- make install
script:
- swift test
# - DEBUG="*" danger process .build/x86_64-apple-macosx10.10/debug/danger-swift
# - DEBUG="*" danger ci --process .build/x86_64-apple-macosx10.10/debug/danger-swift
# - sudo chmod -R a+rwx /usr/local/Cellar/
# - DEBUG="*" danger-swift ci
# - DEBUG="*" .build/x86_64-apple-macosx10.10/debug/danger-swift ci
- .build/x86_64-apple-macosx10.10/debug/danger-swift ci
- danger-swift ci

- os: osx
name: Swift 5.0
osx_image: xcode10.2
install:
- node -v
- npm install -g danger
- make install
script:
- swift test
- danger-swift ci

- os: osx
osx_image: xcode10
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

## Master

- Support swift 5.0 on OSX [@f-meloni][] - [#210](https://github.com/danger/swift/pull/210)

## 1.5.0
- Support custom danger-js path [@f-meloni][] - [#206](https://github.com/danger/swift/pull/206)
- Fix running SwiftLint plugin when system shell is fish [@JosephDuffy][] - [#207](https://github.com/danger/swift/pull/207)
Expand Down
16 changes: 8 additions & 8 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"repositoryURL": "https://github.com/thoughtbot/Curry.git",
"state": {
"branch": null,
"revision": "b6bf27ec9d711f607a8c7da9ca69ee9eaa201a22",
"version": "4.0.1"
"revision": "4331dd50bc1db007db664a23f32e6f3df93d4e1a",
"version": "4.0.2"
}
},
{
Expand Down Expand Up @@ -195,17 +195,17 @@
"repositoryURL": "https://github.com/nicklockwood/SwiftFormat",
"state": {
"branch": null,
"revision": "8e0f9569415605082d0b6306f0b3dbde4facb74d",
"version": "0.39.3"
"revision": "543df82383ebfae4696c70809ae36ff3df63e9c6",
"version": "0.39.5"
}
},
{
"package": "SwiftLint",
"repositoryURL": "https://github.com/Realm/SwiftLint",
"state": {
"branch": null,
"revision": "b2d428a4e24abd4f7cfeb0cd610b1656fb48c4a9",
"version": "0.30.1"
"revision": "26c0048cf4567f0e96f97e2c567ce1c05209e476",
"version": "0.31.0"
}
},
{
Expand All @@ -231,8 +231,8 @@
"repositoryURL": "https://github.com/drmohundro/SWXMLHash.git",
"state": {
"branch": null,
"revision": "9ba116841126f6c63435beef21a4cd247c32d2e7",
"version": "4.7.6"
"revision": "0d6bb315528888edde0dafe93564f074669c44e9",
"version": "4.8.0"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Sources/RunnerLib/Files Import/DangerFileGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public final class DangerFileGenerator {
importsRegex.enumerateMatches(in: content, options: [], range: NSRange(location: 0, length: content.count), using: { result, _, _ in
// Adjust the result to have the correct range also after dangerContent is modified
guard let result = result?.adjustingRanges(offset:
dangerContent.endIndex.encodedOffset - content.endIndex.encodedOffset) else { return }
dangerContent.utf16.count - content.utf16.count) else { return }
let url = importsRegex.replacementString(for: result, in: dangerContent, offset: 0, template: "$1")

guard let fileContent = try? String(contentsOfFile: url),
Expand Down
282 changes: 159 additions & 123 deletions Tests/DangerTests/XCTestManifests.swift
Original file line number Diff line number Diff line change
@@ -1,141 +1,177 @@
import XCTest
#if !canImport(ObjectiveC)
import XCTest

extension BitBucketServerTests {
static let __allTests = [
("testItParsesTheBitBucketActivities", testItParsesTheBitBucketActivities),
("testItParsesTheBitBucketComments", testItParsesTheBitBucketComments),
("testItParsesTheBitBucketCommits", testItParsesTheBitBucketCommits),
("testItParsesTheBitBucketMetadata", testItParsesTheBitBucketMetadata),
("testItParsesTheBitBucketPullRequest", testItParsesTheBitBucketPullRequest),
]
}
extension BitBucketServerTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__BitBucketServerTests = [
("testItParsesTheBitBucketActivities", testItParsesTheBitBucketActivities),
("testItParsesTheBitBucketComments", testItParsesTheBitBucketComments),
("testItParsesTheBitBucketCommits", testItParsesTheBitBucketCommits),
("testItParsesTheBitBucketMetadata", testItParsesTheBitBucketMetadata),
("testItParsesTheBitBucketPullRequest", testItParsesTheBitBucketPullRequest),
]
}

extension DangerDSLTests {
static let __allTests = [
("testDangerfileResults", testDangerfileResults),
("testFileMapWorksCorrectly", testFileMapWorksCorrectly),
("testGithubFixtureDSL", testGithubFixtureDSL),
("testItParsesCorrectlyTheDangerDSLWhenThePRIsOnBitBucketServer", testItParsesCorrectlyTheDangerDSLWhenThePRIsOnBitBucketServer),
("testItParsesCorrectlyTheDangerDSLWhenThePRIsOnGithubEnterprise", testItParsesCorrectlyTheDangerDSLWhenThePRIsOnGithubEnterprise),
]
}
extension DangerDSLTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__DangerDSLTests = [
("testDangerfileResults", testDangerfileResults),
("testFileMapWorksCorrectly", testFileMapWorksCorrectly),
("testGithubFixtureDSL", testGithubFixtureDSL),
("testItParsesCorrectlyTheDangerDSLWhenThePRIsOnBitBucketServer", testItParsesCorrectlyTheDangerDSLWhenThePRIsOnBitBucketServer),
("testItParsesCorrectlyTheDangerDSLWhenThePRIsOnGithubEnterprise", testItParsesCorrectlyTheDangerDSLWhenThePRIsOnGithubEnterprise),
]
}

extension DangerSwiftLintTests {
static let __allTests = [
("testDoNotExecuteSwiftlintWhenNoFilesToCheck", testDoNotExecuteSwiftlintWhenNoFilesToCheck),
("testExecutesSwiftLintWhenLintingAllFiles", testExecutesSwiftLintWhenLintingAllFiles),
("testExecutesSwiftLintWhenLintingAllFilesWithDirectoryPassed", testExecutesSwiftLintWhenLintingAllFilesWithDirectoryPassed),
("testExecutesSwiftLintWithConfigWhenPassed", testExecutesSwiftLintWithConfigWhenPassed),
("testExecutesSwiftLintWithDirectoryPassed", testExecutesSwiftLintWithDirectoryPassed),
("testExecutesTheShell", testExecutesTheShell),
("testExecutesTheShellWithCustomSwiftLintPath", testExecutesTheShellWithCustomSwiftLintPath),
("testExecuteSwiftLintInInlineMode", testExecuteSwiftLintInInlineMode),
("testExecuteSwiftWithStructAndInlineMode", testExecuteSwiftWithStructAndInlineMode),
("testFiltersOnSwiftFiles", testFiltersOnSwiftFiles),
("testMarkdownReporting", testMarkdownReporting),
("testMarkdownReportingInStrictMode", testMarkdownReportingInStrictMode),
("testPrintsNoMarkdownIfNoViolations", testPrintsNoMarkdownIfNoViolations),
("testQuotesPathArguments", testQuotesPathArguments),
("testViolations", testViolations),
]
}
extension DangerSwiftLintTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__DangerSwiftLintTests = [
("testDoNotExecuteSwiftlintWhenNoFilesToCheck", testDoNotExecuteSwiftlintWhenNoFilesToCheck),
("testExecutesSwiftLintWhenLintingAllFiles", testExecutesSwiftLintWhenLintingAllFiles),
("testExecutesSwiftLintWhenLintingAllFilesWithDirectoryPassed", testExecutesSwiftLintWhenLintingAllFilesWithDirectoryPassed),
("testExecutesSwiftLintWithConfigWhenPassed", testExecutesSwiftLintWithConfigWhenPassed),
("testExecutesSwiftLintWithDirectoryPassed", testExecutesSwiftLintWithDirectoryPassed),
("testExecutesTheShell", testExecutesTheShell),
("testExecutesTheShellWithCustomSwiftLintPath", testExecutesTheShellWithCustomSwiftLintPath),
("testExecuteSwiftLintInInlineMode", testExecuteSwiftLintInInlineMode),
("testExecuteSwiftWithStructAndInlineMode", testExecuteSwiftWithStructAndInlineMode),
("testFiltersOnSwiftFiles", testFiltersOnSwiftFiles),
("testMarkdownReporting", testMarkdownReporting),
("testMarkdownReportingInStrictMode", testMarkdownReportingInStrictMode),
("testPrintsNoMarkdownIfNoViolations", testPrintsNoMarkdownIfNoViolations),
("testQuotesPathArguments", testQuotesPathArguments),
("testViolations", testViolations),
]
}

extension DangerUtilsLineSearchTests {
static let __allTests = [
("testItReturnsAnEmptyArrayIfNoResultsAreFound", testItReturnsAnEmptyArrayIfNoResultsAreFound),
("testItReturnsTheCorrectResultsIfTheSearchedStringIsPresent", testItReturnsTheCorrectResultsIfTheSearchedStringIsPresent),
]
}
extension DangerUtilsLineSearchTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__DangerUtilsLineSearchTests = [
("testItReturnsAnEmptyArrayIfNoResultsAreFound", testItReturnsAnEmptyArrayIfNoResultsAreFound),
("testItReturnsTheCorrectResultsIfTheSearchedStringIsPresent", testItReturnsTheCorrectResultsIfTheSearchedStringIsPresent),
]
}

extension DateFormatterExtensionTests {
static let __allTests = [
("test_DateFormatter_dateFromString", test_DateFormatter_dateFromString),
("test_DateFormatter_nilFromInvalidString", test_DateFormatter_nilFromInvalidString),
]
}
extension DateFormatterExtensionTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__DateFormatterExtensionTests = [
("test_DateFormatter_dateFromString", test_DateFormatter_dateFromString),
("test_DateFormatter_nilFromInvalidString", test_DateFormatter_nilFromInvalidString),
]
}

extension FileTests {
static let __allTests = [
("test_fileType_forHFile", test_fileType_forHFile),
("test_fileType_forJSON", test_fileType_forJSON),
("test_fileType_forM", test_fileType_forM),
("test_fileType_forMarkdown", test_fileType_forMarkdown),
("test_fileType_forMM", test_fileType_forMM),
("test_fileType_forPbxproj", test_fileType_forPbxproj),
("test_fileType_forPlist", test_fileType_forPlist),
("test_fileType_forStoryboard", test_fileType_forStoryboard),
("test_fileType_forSwift", test_fileType_forSwift),
("test_fileType_forXCScheme", test_fileType_forXCScheme),
("test_fileType_forYAML", test_fileType_forYAML),
("test_fileType_forYML", test_fileType_forYML),
("test_fileType_withMultipleDots", test_fileType_withMultipleDots),
]
}
extension FileTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__FileTests = [
("test_fileType_forHFile", test_fileType_forHFile),
("test_fileType_forJSON", test_fileType_forJSON),
("test_fileType_forM", test_fileType_forM),
("test_fileType_forMarkdown", test_fileType_forMarkdown),
("test_fileType_forMM", test_fileType_forMM),
("test_fileType_forPbxproj", test_fileType_forPbxproj),
("test_fileType_forPlist", test_fileType_forPlist),
("test_fileType_forStoryboard", test_fileType_forStoryboard),
("test_fileType_forSwift", test_fileType_forSwift),
("test_fileType_forXCScheme", test_fileType_forXCScheme),
("test_fileType_forYAML", test_fileType_forYAML),
("test_fileType_forYML", test_fileType_forYML),
("test_fileType_withMultipleDots", test_fileType_withMultipleDots),
]
}

extension FileTypeTests {
static let __allTests = [
("test_extension_matchesRawValue", test_extension_matchesRawValue),
]
}
extension FileTypeTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__FileTypeTests = [
("test_extension_matchesRawValue", test_extension_matchesRawValue),
]
}

extension GitHubTests {
static let __allTests = [
("test_GitHub_decode", test_GitHub_decode),
("test_GitHubCommit_decode", test_GitHubCommit_decode),
("test_GitHubIssue_decode", test_GitHubIssue_decode),
("test_GitHubIssueLabel_decode", test_GitHubIssueLabel_decode),
("test_GitHubMergeRef_decode", test_GitHubMergeRef_decode),
("test_GitHubMilestone_decodeWithAllParameters", test_GitHubMilestone_decodeWithAllParameters),
("test_GitHubMilestone_decodeWithSomeParameters", test_GitHubMilestone_decodeWithSomeParameters),
("test_GitHubPR_decode", test_GitHubPR_decode),
("test_GitHubRepo_decode", test_GitHubRepo_decode),
("test_GitHubReview_decode", test_GitHubReview_decode),
("test_GitHubTeam_decode", test_GitHubTeam_decode),
("test_GitHubUser_decode", test_GitHubUser_decode),
]
}
extension GitHubTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__GitHubTests = [
("test_GitHub_decode", test_GitHub_decode),
("test_GitHubCommit_decode", test_GitHubCommit_decode),
("test_GitHubIssue_decode", test_GitHubIssue_decode),
("test_GitHubIssueLabel_decode", test_GitHubIssueLabel_decode),
("test_GitHubMergeRef_decode", test_GitHubMergeRef_decode),
("test_GitHubMilestone_decodeWithAllParameters", test_GitHubMilestone_decodeWithAllParameters),
("test_GitHubMilestone_decodeWithSomeParameters", test_GitHubMilestone_decodeWithSomeParameters),
("test_GitHubPR_decode", test_GitHubPR_decode),
("test_GitHubRepo_decode", test_GitHubRepo_decode),
("test_GitHubReview_decode", test_GitHubReview_decode),
("test_GitHubTeam_decode", test_GitHubTeam_decode),
("test_GitHubUser_decode", test_GitHubUser_decode),
]
}

extension GitTests {
static let __allTests = [
("test", test),
]
}
extension GitTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__GitTests = [
("test", test),
]
}

extension NSRegularExpressionExtensionsTests {
static let __allTests = [
("test_firstMatchingString_failingRegex", test_firstMatchingString_failingRegex),
("test_firstMatchingString_passingRegex", test_firstMatchingString_passingRegex),
]
}
extension NSRegularExpressionExtensionsTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__NSRegularExpressionExtensionsTests = [
("test_firstMatchingString_failingRegex", test_firstMatchingString_failingRegex),
("test_firstMatchingString_passingRegex", test_firstMatchingString_passingRegex),
]
}

extension SwiftlintDefaultPathTests {
static let __allTests = [
("testItReturnsTheSPMCommandIfThePackageContainsTheSwiftlintDependency", testItReturnsTheSPMCommandIfThePackageContainsTheSwiftlintDependency),
("testItReturnsTheSwiftlintCLICommandIfThePackageContainsTheSwiftlintDependency", testItReturnsTheSwiftlintCLICommandIfThePackageContainsTheSwiftlintDependency),
]
}
extension SwiftlintDefaultPathTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__SwiftlintDefaultPathTests = [
("testItReturnsTheSPMCommandIfThePackageContainsTheSwiftlintDependency", testItReturnsTheSPMCommandIfThePackageContainsTheSwiftlintDependency),
("testItReturnsTheSwiftlintCLICommandIfThePackageContainsTheSwiftlintDependency", testItReturnsTheSwiftlintCLICommandIfThePackageContainsTheSwiftlintDependency),
]
}

extension ViolnationTests {
static let __allTests = [
("testDecoding", testDecoding),
]
}
extension ViolnationTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__ViolnationTests = [
("testDecoding", testDecoding),
]
}

#if !os(macOS)
public func __allTests() -> [XCTestCaseEntry] {
return [
testCase(BitBucketServerTests.__allTests),
testCase(DangerDSLTests.__allTests),
testCase(DangerSwiftLintTests.__allTests),
testCase(DangerUtilsLineSearchTests.__allTests),
testCase(DateFormatterExtensionTests.__allTests),
testCase(FileTests.__allTests),
testCase(FileTypeTests.__allTests),
testCase(GitHubTests.__allTests),
testCase(GitTests.__allTests),
testCase(NSRegularExpressionExtensionsTests.__allTests),
testCase(SwiftlintDefaultPathTests.__allTests),
testCase(ViolnationTests.__allTests),
testCase(BitBucketServerTests.__allTests__BitBucketServerTests),
testCase(DangerDSLTests.__allTests__DangerDSLTests),
testCase(DangerSwiftLintTests.__allTests__DangerSwiftLintTests),
testCase(DangerUtilsLineSearchTests.__allTests__DangerUtilsLineSearchTests),
testCase(DateFormatterExtensionTests.__allTests__DateFormatterExtensionTests),
testCase(FileTests.__allTests__FileTests),
testCase(FileTypeTests.__allTests__FileTypeTests),
testCase(GitHubTests.__allTests__GitHubTests),
testCase(GitTests.__allTests__GitTests),
testCase(NSRegularExpressionExtensionsTests.__allTests__NSRegularExpressionExtensionsTests),
testCase(SwiftlintDefaultPathTests.__allTests__SwiftlintDefaultPathTests),
testCase(ViolnationTests.__allTests__ViolnationTests),
]
}
#endif
Loading

0 comments on commit 0456d98

Please sign in to comment.