Incremental diffs are sometimes too small

On a couple of occasions recently, Codacy (via pylint) has reported errors which I cannot reproduce locally. I suspect this is due to the diff that codacy produces.

On one occasion the error raised was:

Unused NativeRange imported from datatypes

however NativeRange was no longer imported or used anywhere in the file.
I managed to get the expected result by adding the import back on that line and then removing it again.

The import was originally removed here, and the error began to appear at this commit
The import was originally added in this PR so NativeRange also did not appear in the diff tab on codacy. I can only guess that the incremental diff fed to pylint was not large enough for pylint to recognise that the problem had been resolved (the import was done over multiple lines, which may have had an impact)

Hi there Emily, wellcome to our community!

I just took a look at your project and it seems that no issue is being reported on your file pyccel/ast/variable.py.

Once a PR is merged Codacy can no longer update it, so the issues that were found at the time will remain on the PR, but that information might be incorrect, as in this case. Can you please check your issues tab and confirm if you are still getting any strange results there?

1 Like

Hi Ivo,

This issue was blocking the merging of my PR so, as I mentioned, I fixed it on my end by adding the import back on the line reporting the error and then removing it again. I assume that this ‘reinitialised’ the diff. So there will be no trace of it in Codacy anymore. Sorry

The best I can give you to reproduce the error is the information in the PR. The commits referenced above show the point at which the problem appeared. With this and this being my fix. The PR is quite complicated though so it’s probably not the best to work with. If you can manage to reproduce the problem from something simpler that would make your life much easier