Skip to content

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.

View analysis logs

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:

Last update: October 6, 2020