Skip to content

Skipping refactorings

Brendan Maginnis edited this page Sep 30, 2020 · 2 revisions

Sourcery can be configured to skip refactorings:

Skip Comments

Sourcery can be configured at a function level to skip refactorings.

  • The whole function can be skipped with - # sourcery skip
  • Specific refactorings can be skipped with - # sourcery skip: <refactoring_id1>, <refactoring_id2>

These comments can appear anywhere in the function.

Skip entire function

Sourcery can be disabled on a function with a # sourcery skip comment:

def func(a, b):  # sourcery skip
    c = a + b
    return c

Skip specific refactorings

Sourcery will skip specific refactorings if their ids are included in a skip comment:

def func(a, b):
    # sourcery skip: inline-immediately-returned-variable
    c = a + b
    return c

These refactoring ids are displayed in the plugin suggestions and GitHub Bot comments for easy lookup.

Clone this wiki locally