Unexpected Errors in Unmodified Code After Merging Development Branch

Hello,

We need clarification regarding an issue we have observed in our project analysis. We maintain a main branch that represents our current running version, and we create separate branches from it to develop new features or refactor code. In these development branches, we ensure that the newly written code is completely error-free before merging back into the main branch.
Our process involves a clean merge without any conflicts or manual modifications. In other words, we simply overlay the new, error-free code onto the main branch without editing any existing files. However, after merging, we sometimes notice that additional errors appear in files that were not modified.
For example, consider the following scenario:

  • In the main branch, there is a class called Person that contains 100 lines of code.

  • We then create a new branch (a direct copy of Person) and add a new class called Student with an additional 100 lines of code.

  • In the new branch, we fix all errors, so both Person and Student are error-free.

  • After merging the new branch back into the main branch, we suddenly see that 5 errors appear in the Person class—even though it was not modified during the merge.

Could you please advise if this behavior is expected? Is there a configuration option or best practice to ensure that only the new or modified code is analyzed without generating additional errors in unchanged parts of the code?

Best Regards,
Yordan.

Hi Yordan,

Welcome to the community!

This is a known issue: PR analysis only reports issues on code that was added/edited in the PR. Unfortunately, that means that if your changes have ripple effects they won’t be caught until after merge.

 
Ann