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.
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.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.