How to silence issues on DeepSource?

There are some occurrences in my code where I do not want DeepSource to raise issues. What should I do?

There are a couple of ways to do that.

Using skipcq in source code

Add skipcq as a comment with the issue’s short-code at the end of the line, or one the line above it to silence the issue.

More details here -

Using dashboard

Ignore issue for a specific file pattern or across the repository from the dashboard.

Adding onto @jai’s answer, if you believe that DeepSource is raising an error when it shouldn’t raise one – you can use the “Ignore…” button on the issue and select “This is a false positive.”. This will let the team know of your feedback. In most cases, we are able to resolve issues within a week. In any case, an engineer from DeepSource would get in touch and let you know about it.

I have such code:

message = item_meta.message.format(
    obj_name=getattr(obj, item_meta.title_field)

This raises PTC-W0034 (unnecessary use of getattr). I tried putting skipcq pragma both before that lines and on logical end of line - ater closing bracket - this does not work, the issue is still reported. Am I doing something wrong?

@zgoda skipcq should be on the same line where the issue is raised.

This would work for you:

message = item_meta.message.format(
    obj_name=getattr(obj, item_meta.title_field)  #skipcq: PTC-W0034

Thanks, I thought most code analyzers for Python are ast-based nowadays.