Ignore Issues

Although we make every effort to minimize false positives in our code analyses, there may still be instances where it is necessary to permanently ignore certain issues.

For example, there may be a function that has arguments that are not used anywhere in the function.

def return_as_is(param, an_unused_param):
    return param

This will raise the issue Unused argument, with DeepSource issue code PYL-W0613. However, if the extra argument exists for the sole purpose of API consistency, it is better to ignore this issue. In order to silence this issue permanently in code, use the skipcq: keyword.

def return_as_is(param, an_unused_param):  # skipcq: PYL-W0613
    return param

Silencing a specific issue

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

input = 10  # skipcq: PYL-W0622
# skipcq: PYL-W0622
input = 10

Silencing multiple issues

To silence multiple issues on a line, add a comma separated list of issue short-codes after the skipcq: keyword.

def function(input, an_argument_not_used):  # skipcq: PYL-W0622, PYL-W0613
    pass
# skipcq: PYL-W0622, PYL-W0613
def function(input, an_argument_not_used):
    pass

Silencing all issues on a line

To silence all issues that could be raised on a line, use the keyword skipcq in the comment corresponding to the line.

except Exception:  # skipcq
    pass
# skipcq
except Exception:
    pass

📘

This would prevent all issues from being raised on this line, which is probably not desired. We recommend using the keyword explicitly for the issues to be suppressed.

In conjunction with existing comments

Add skipcq at the end of the comment for the line.

class Klass:
    def __init__(self):
        pass

    def func(self, x):  # This function does not use `self`. Hence an issue will be raised. Lets ignore it. skipcq
        return x ** 2

If the skipcq comment is placed above the line, place as many comments or newlines between the skipcq keyword and the concerned line as needed.

class Klass:
    def __init__(self):
        pass

    # skipcq
    # This function does not use `self`.
    # Hence an issue will be raised. Lets ignore it.
    def func(self, x):
        return x ** 2

Universality

While all the examples above are for Python, the skipcq keyword can be used for all analyzers.

This is the general format:

a line of code that raises an issue <comment identifier> skipcq: <issue code 1>, <issue code 2>

For example, to silence an issue on a line of Go code:

x := true
// The next line will raise an issue stating that negating a boolean twice is pointless.
// But we want to keep it, and not have any issues raised by DeepSource. Hence, `skipcq`
y := !!y // skipcq: SSC-SA4010