For the latest updates and improvements, see the latest Cloud documentation instead.
Error caused by incompatible line endings¶
Codacy executes the git diff
command when analyzing new commits and pull requests to identify the lines of code that were changed. Codacy then uses this information to display the issues that were caused by the changes introduced by the commits or pull requests.
If you have files in your repository that use the carriage return (CR) as the line end control character, the command git diff
doesn't correctly identify line endings in the changed files. Because of this, Codacy is unable to use the output of the command and you will see the following error in the your commit or pull request analysis logs:
We found an error caused by incompatible line endings while comparing changes with git diff.
The CR line end control character was used by older Classic Mac OS systems, and for the sake of interoperability it's recommended that you update the line endings in your source code files to use either the control characters:
- LF, if primarily using Unix-like systems such as Linux or the newer macOS operating system
- CRLF, if primarily using the Microsoft Windows operating system
See also¶
After converting the line endings in your source code files, you may also want to check the following external resources for help on standardizing the line endings on your repositories and how to configure Git to correctly handle line endings:
- What's the recommended way to store files in Git?
- Customizing Git - Formatting and Whitespace
- Configuring Git to handle line endings
- Mind the End of Your Line
Share your feedback 📢
Did this page help you?
Thanks for the feedback! Is there anything else you'd like to tell us about this page?
255 characters left
We're sorry to hear that. Please let us know what we can improve:
255 characters left
Alternatively, you can create a more detailed issue on our GitHub repository.
Thanks for helping improve the Codacy documentation.
If you have a question or need help please contact support@codacy.com.