flake8-raise icon indicating copy to clipboard operation
flake8-raise copied to clipboard

[feature request] Missing parentheses on raised exception

Open m-aciek opened this issue 5 years ago • 1 comments

I would like to propose another check.

R103 Missing parentheses on raised exception

It would be off by default, but could be activated for projects that want to follow convention with having always parentheses (see google style docs).

if something:
    raise PermissionDenied

Will result in the error: R103 Missing parentheses on raised exception

To fix, change to:

if something:
    raise PermissionDenied()

By the way, thanks for the plugin :)

m-aciek avatar Jan 27 '20 14:01 m-aciek

As an alternative both R102 and R103 could be ignored by default, as it is done with W503 and W504.

m-aciek avatar Jan 27 '20 15:01 m-aciek