Skip to main content

Adds coding magic comment checks to flake8

Project description

https://travis-ci.org/tk0miya/flake8-coding.svg?branch=master https://coveralls.io/repos/tk0miya/flake8-coding/badge.svg?branch=master Code Climate

Adds coding magic comment checks (coding:) to flake8.

Install

Install with pip:

$ pip install flake8-coding

You can check that flake8 has picked it up by looking for flake8_coding in the output of --version:

$ flake8 --version
2.5.4 (pep8: 1.7.0, pyflakes: 1.0.0, flake8_coding: 1.1.1, mccabe: 0.4.0) CPython 2.7.11 on Darwin

Options

accept-encodings

A comma-separated list of acceptable source code encodings for the coding: magic comments in files. Default is latin-1, utf-8.

You can pass this as a command-line argument to flake8, e.g. --accept-encodings=utf-8,utf-16, or put it in your config file, e.g.:

[flake8]
accept-encodings = utf-8,utf-16

no-accept-encodings

If activated, this disallows all coding: magic comments, no matter their encoding. This might be useful for Python 3 projects where UTF-8 is the default and you don’t want other encodings used in your project.

You can pass this as a command-line argument to flake8, e.g. --no-accept-encodings, or put it in your config file, e.g.:

[flake8]
no-accept-encodings = True

Rules

C101 Coding magic comment not found

No magic encoding comment was found in the file. As per PEP-263, this must be in the first two lines of the file.

C102 Unknown encoding found in coding magic comment

The encoding found in the magic encoding comment did not match the accept-encodings option.

C103 Coding magic comment present

no-accept-encodings is set, and a magic encoding comment was found in the file.

Requirements

  • Python 2.7, 3.4

  • flake8

License

Apache License 2.0

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-coding-1.3.2.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

flake8_coding-1.3.2-py2.py3-none-any.whl (7.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file flake8-coding-1.3.2.tar.gz.

File metadata

  • Download URL: flake8-coding-1.3.2.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.7

File hashes

Hashes for flake8-coding-1.3.2.tar.gz
Algorithm Hash digest
SHA256 b8f4d5157a8f74670e6cfea732c3d9f4291a4e994c8701d2c55f787c6e6cb741
MD5 252eb677f0e0e30e8d9a7ce5ae92aa02
BLAKE2b-256 e80ecbba2b2da4e0ccf4098e8bd333d39531ff0a6aed91d187bc762ac6b9d263

See more details on using hashes here.

File details

Details for the file flake8_coding-1.3.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for flake8_coding-1.3.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 79704112c44d09d4ab6c8965e76a20c3f7073d52146db60303bce777d9612260
MD5 b6627d83a3ad61c7d8d6350ca454b2d3
BLAKE2b-256 83a80de26928c40727ec29289b4f5c751a75e4cdd639faed9ab01b835fd0883c

See more details on using hashes here.

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