Skip to content
This documentation applies to Codacy Self-hosted v9.0.0

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'll see an error in the Diff step of your commit or pull request analysis logs:

Viewing the 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:

  1. Find the files in your repository that include CR line endings.

    Tip

    On *nix operating systems including macOS, you can use the command file to detect files in your repository that use CR line endings. For example, run the following command on the root of your repository:

    find . -type f -exec file {} \; | grep "CR line"
    
  2. 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

    Tip

    This article on Wikipedia includes examples on how to convert the line endings in your files.

  3. After converting the line endings in your source code files, you may also want to check the following resources for help on standardizing the line endings on your repositories and how to configure Git to correctly handle line endings:

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?

We're sorry to hear that. Please let us know what we can improve:

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.

Last modified May 19, 2022