Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent empty SwiftLint violation response from failure #596

Conversation

pouyayarandi
Copy link
Contributor

Problem

In some cases like empty merge request (merge request with no changes) SwiftLint fails as its response is empty and JSONDecoder got Unexpected end of file error.

Error deserializing SwiftLint JSON response (): dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "The given data was not valid JSON.", underlyingError: Optional(Error Domain=NSCocoaErrorDomain Code=3840 "Unexpected end of file" UserInfo={NSDebugDescription=Unexpected end of file})))

Solution

This PR solves the issue with checking whether response is empty or not. If the response is empty it bypasses decoding and returns an empty array of violations.

@pouyayarandi pouyayarandi changed the title Prevent empty violation response from failure Prevent empty SwiftLint violation response from failure Oct 11, 2023
@pouyayarandi
Copy link
Contributor Author

Solves #266

Copy link
Member

@f-meloni f-meloni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you :)

@f-meloni
Copy link
Member

Can you please also update the CHANGELOG?

@pouyayarandi
Copy link
Contributor Author

@f-meloni Done

@f-meloni f-meloni merged commit f76cd15 into danger:master Nov 6, 2023
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants