danger / swift

⚠️ Stop saying "you forgot to …" in code review
https://danger.systems/swift/
MIT License
1.04k stars 135 forks source link

Fix a decode error with BitBucket server #553

Closed pepix closed 1 year ago

pepix commented 1 year ago

Issue

I faced a decode error when I run $ danger-swift pr <pr_url> for a certain pull request in GitBucket Server. As my investigation, it seems they don't return public field if that repository is forked by someone. After I made it optional, it works.

error

ERROR: Failed to parse JSON: keyNotFound(CodingKeys(stringValue: "public", intValue: nil), Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "danger", intValue: nil), CodingKeys(stringValue: "bitbucket_server", intValue: nil), CodingKeys(stringValue: "pr", intValue: nil), CodingKeys(stringValue: "fromRef", intValue: nil), CodingKeys(stringValue: "repository", intValue: nil), CodingKeys(stringValue: "project", intValue: nil)], debugDescription: "No value associated with key CodingKeys(stringValue: \"public\", intValue: nil) (\"public\").", underlyingError: nil))

ERROR: Dangerfile eval failed at Dangerfile.swift ERROR: Could not get the results JSON file at /var/folders//clhhlm6d5fg7h0syj9vmtw0000gv/T/danger-response.json

pepix commented 1 year ago

I can't find why CI failed though got no errors locally..

pepix commented 1 year ago

Posted issue since I found an issue on CI pipeline https://github.com/danger/swift/issues/556

f-meloni commented 1 year ago

I have made few changes to reduce the noise made from swiftlint and swiftformat, I will merge this so that it can make it in the release and work on swiftlint as a separated issue.