Skip to main content

flake8 plugin for enforcing few rules

Project description

Description

This flake8 plugin enforces trailing commas in tuples and do few other things. It hasn't settings so far. In near future it will be renamed.

New error messages:

  • CMA100 trailing comma in tuple is missing

Examples

Code below is invalid:

a = (
    1, 2, 3
)

And this is a valid version:

a = (
    1, 2, 3,
)
  • CMA200 message of ValidationError should end with dot

Enforces ValidationError (both rest_framework and django) to have dot in the end of message/messages:

Invalid:

raise ValidationError(_('Error without dot'))

Valid

raise ValidationError(_('Error with dot.'))
  • CMA201 message of ValidationError should be wrapped in _

Enforces all messages of ValidationError to be wrapped in call of function _ (it could be gettext or gettext_lazy)

Invalid

raise ValidationError('Not internationalized')

Valid

raise ValidationError(_('Internationalized'))

Known bugs

  • CMA100 incorrectly handles return/yield with multiple parameters
  • CMA201 can't handle case of error message, defined outside ValidationError yet

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flake8_tuple_trailing_commas-0.1.3.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distributions

flake8_tuple_trailing_commas-0.1.3-py3.8.egg (5.6 kB view hashes)

Uploaded Source

flake8_tuple_trailing_commas-0.1.3-py2.py3-none-any.whl (4.4 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page