danger / danger/swift

Getting dataCorrupted from SwiftLint

Open
#339 13 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
1.1k
Forks
152
Avg merge
9h 54m
Merged PRs (30d)
2

Description

Here is my danger.yml:
```name: Danger
on:
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest
name: "Run Danger"
steps:
- uses: actions/checkout@v1
- name: Danger
uses: danger/swift@3.0.0
with:
args: --failOnErrors --no-publish-check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

Here is my Dangerfile.swift:
```
import Danger

let danger = Danger()

SwiftLint.lint(swiftlintPath: "./Pods/SwiftLint/swiftlint")

// Ensure no copyright header
let editedFiles = danger.git.modifiedFiles + danger.git.createdFiles
let swiftFilesWithCopyright = editedFiles.filter {
$0.contains("Copyright") && ($0.fileType == .swift || $0.fileType == .m)
}
for file in swiftFilesWithCopyright {
fail(message: "Please remove this copyright header", file: file, line: 0)
}

// Encourage smaller PRs
var bigPRThreshold = 600;
if (danger.github.pullRequest.additions! + danger.github.pullRequest.deletions! > bigPRThreshold) {
warn("> Pull Request size seems relatively large. If this Pull Request contains multiple changes, please split each into separate PR will helps faster, easier review.");
}
```

I'm not sure why this is happening or how to fix it. I tried the SwiftLint action here (https://github.com/norio-nomura/action-swiftlint) and everything worked fine. Just the Danger SwiftLint plugin seems to barf every time :(

Here is a related issue: https://github.com/danger/swift/issues/266
I tried to open that issue but I didn't see a button to open it.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the workflow from danger.yml with the Dangerfile.swift call to SwiftLint.lint, then read the related issue #266 and the 13-comment thread for existing diagnosis. Compare the failing Danger SwiftLint plugin invocation with the working SwiftLint action; done means the workflow runs without dataCorrupted and reports SwiftLint results correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, swift
Domain
ci-cd, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.