invalid-syntax
What it does
Section titled “What it does”Reports code that Python rejects when it compiles the file although the grammar allows it, such as a duplicate parameter, nonlocal at module level or await in a function that is not async.
Why it matters
Section titled “Why it matters”Python raises a SyntaxError for the file, so none of the code in it runs, and the error shows up only when the module is imported or compiled.
To fix, follow the message and correct the statement.
Example
Section titled “Example”...await x
def f():...Configuration
Section titled “Configuration”python: lint: rules: invalid-syntax: error # off, warn, error (default)Suppress one line with sudsy-disable-next-line invalid-syntax in a comment of the file’s language.