-
Notifications
You must be signed in to change notification settings - Fork 537
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #398 from Vkt0r/danger
Integrate Danger and Swiftlint to the project
- Loading branch information
Showing
35 changed files
with
695 additions
and
522 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,21 @@ | ||
|
||
identifier_name: | ||
min_length: # only min_length | ||
warning: 2 | ||
error: 2 # only error | ||
excluded: # excluded via string array | ||
- ok | ||
- Name | ||
- DEFAULT_MIME_TYPE | ||
- sin_port | ||
- no_sig_pipe | ||
|
||
disabled_rules: | ||
- line_length | ||
- statement_position | ||
- trailing_whitespace | ||
- variable_name_min_length | ||
|
||
excluded: # paths to ignore during linting. Takes precedence over `included`. | ||
- LinuxMain.swift | ||
- Tests/XCTestManifests.swift | ||
- Package.swift |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# send a welcome message for the user | ||
message "Hey, @#{github.pr_author} 👋." | ||
|
||
# Just to let people know | ||
warn("PR is classed as Work in Progress.") if github.pr_title.include? "[WIP]" | ||
|
||
# Warn when there is a big PR | ||
warn("Big PR") if git.lines_of_code > 500 | ||
|
||
# ensure there is a summary for a PR | ||
fail "Please provide a summary in the Pull Request description." if github.pr_body.length < 5 | ||
|
||
# Changelog entries are required for changes to library files. | ||
fail("Please include a CHANGELOG entry. You can find it at [CHANGELOG.md](https://github.com/httpswift/swifter/blob/stable/CHANGELOG.md).") unless git.modified_files.include?("CHANGELOG.md") || git.added_files.include?("CHANGELOG.md") | ||
|
||
# Don't accept PR on master for now | ||
fail "Please re-submit this PR to stable, you're trying to merge the PR on master." if github.branch_for_base == "master" | ||
|
||
# If these are all empty something has gone wrong, better to raise it in a comment | ||
if git.modified_files.empty? && git.added_files.empty? && git.deleted_files.empty? | ||
fail "This PR has no changes at all, this is likely a developer issue." | ||
end | ||
|
||
# Run SwiftLint | ||
swiftlint.config_file = '.swiftlint.yml' | ||
swiftlint.lint_files | ||
|
||
# Warn when new tests are added but the XCTestManifests wasn't updated to run on Linux | ||
tests_added_or_modified = git.modified_files.grep(/XCode\/Tests/).empty? || git.added_files.grep(/XCode\/Tests/).empty? | ||
xc_manifest_updated = !git.modified_files.grep(/XCode\/Tests\/XCTestManifests.swift/).empty? | ||
if tests_added_or_modified && !xc_manifest_updated | ||
warn("It seems like you've added new tests to the library. If that's the case, please update the [XCTestManifests.swift](https://github.com/httpswift/swifter/blob/stable/XCode/Tests/XCTestManifests.swift) file running in your terminal the command `swift test --generate-linuxmain`.") | ||
|
||
# This is a temporary warning to remove the entry for the failed test until we solve the issue in Linux | ||
warn("If you ran the command `swift test --generate-linuxmain` in your terminal, please remove the line `testCase(IOSafetyTests.__allTests__IOSafetyTests),` from `public func __allTests() -> [XCTestCaseEntry]` in the bottom of the file. For more reference see [#366](https://github.com/httpswift/swifter/issues/366).") | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# frozen_string_literal: true | ||
|
||
source "https://rubygems.org" | ||
|
||
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } | ||
|
||
gem 'danger' | ||
gem 'danger-swiftlint' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
addressable (2.5.2) | ||
public_suffix (>= 2.0.2, < 4.0) | ||
claide (1.0.2) | ||
claide-plugins (0.9.2) | ||
cork | ||
nap | ||
open4 (~> 1.3) | ||
colored2 (3.1.2) | ||
cork (0.3.0) | ||
colored2 (~> 3.1) | ||
danger (6.0.6) | ||
claide (~> 1.0) | ||
claide-plugins (>= 0.9.2) | ||
colored2 (~> 3.1) | ||
cork (~> 0.1) | ||
faraday (~> 0.9) | ||
faraday-http-cache (~> 1.0) | ||
git (~> 1.5) | ||
kramdown (~> 2.0) | ||
kramdown-parser-gfm (~> 1.0) | ||
no_proxy_fix | ||
octokit (~> 4.7) | ||
terminal-table (~> 1) | ||
danger-swiftlint (0.20.1) | ||
danger | ||
rake (> 10) | ||
thor (~> 0.19) | ||
faraday (0.15.4) | ||
multipart-post (>= 1.2, < 3) | ||
faraday-http-cache (1.3.1) | ||
faraday (~> 0.8) | ||
git (1.5.0) | ||
kramdown (2.1.0) | ||
kramdown-parser-gfm (1.0.1) | ||
kramdown (~> 2.0) | ||
multipart-post (2.0.0) | ||
nap (1.1.0) | ||
no_proxy_fix (0.1.2) | ||
octokit (4.14.0) | ||
sawyer (~> 0.8.0, >= 0.5.3) | ||
open4 (1.3.4) | ||
public_suffix (3.0.3) | ||
rake (12.3.2) | ||
sawyer (0.8.1) | ||
addressable (>= 2.3.5, < 2.6) | ||
faraday (~> 0.8, < 1.0) | ||
terminal-table (1.8.0) | ||
unicode-display_width (~> 1.1, >= 1.1.1) | ||
thor (0.20.3) | ||
unicode-display_width (1.5.0) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
danger | ||
danger-swiftlint | ||
|
||
BUNDLED WITH | ||
1.16.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.