Skip to main content

A Flake8 plugin to validate ASCII characters in Python source code

Project description

flake8-ascii-validator

Test Status PyPI version Python Support License: MIT

Flake8 plugin to validate ASCII characters in Python source code.

Installation

pip install flake8-ascii-validator

Usage

flake8 your_file.py

Example output:

example.py:3:5: ASC001 Non-ASCII character 'é' (U+00E9) found in source code
example.py:4:15: ASC002 Non-ASCII character 'ø' (U+00F8) found in string literal
example.py:5:10: ASC003 Non-ASCII character 'ñ' (U+00F1) found in comment

Error Codes

Code Description
ASC001 Non-ASCII character found in source code (variable names, function names, etc.)
ASC002 Non-ASCII character found in string literal
ASC003 Non-ASCII character found in comment

Configuration

Ignore specific error codes:

flake8 --extend-ignore=ASC002

Or in your configuration file:

[flake8]
extend-ignore = ASC002

Examples

Valid ASCII code:

def hello_world():
    message = "Hello, World!"
    return message

Invalid non-ASCII code:

def función():  # ASC001: 'ó' in function name
    variável = "café"  # ASC001: 'á' in variable, ASC002: 'é' in string
    # Commentário  # ASC003: 'á' in comment
    return variável

Why Use This Plugin?

  • Team Consistency: Ensure code works across different environments
  • Legacy Compatibility: Support systems that don't handle Unicode well
  • Debugging: ASCII characters are easier to search and debug
  • Code Standards: Enforce ASCII-only policies in your codebase

Requirements

  • Python 3.7+
  • Flake8 3.0.0+

License

MIT License

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_ascii_validator-1.0.2.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flake8_ascii_validator-1.0.2-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file flake8_ascii_validator-1.0.2.tar.gz.

File metadata

  • Download URL: flake8_ascii_validator-1.0.2.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for flake8_ascii_validator-1.0.2.tar.gz
Algorithm Hash digest
SHA256 5e045325ff572b5bc6246fd8e7d388e0ed1cd54396001f5d2348627123baea79
MD5 364bf60f6e36eb2f358f1392d8ab6c78
BLAKE2b-256 1cc3a0e9803ee2bfe56e193621facb96c7eee028a98e00a67568d959492f257c

See more details on using hashes here.

Provenance

The following attestation bundles were made for flake8_ascii_validator-1.0.2.tar.gz:

Publisher: publish.yml on shivkumar0757/flake8-ascii-validator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file flake8_ascii_validator-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for flake8_ascii_validator-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ad29b1ab1cfa9b102b2f89cb9dc8765dd9dc0b37254281780da4fdf44b07f8bb
MD5 fcfa48f5ad01c3b4d609c2b7864f4d14
BLAKE2b-256 86ef45a8924048ef69d527da1af4e93e523fdc5771925d99a712519267bb24e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for flake8_ascii_validator-1.0.2-py3-none-any.whl:

Publisher: publish.yml on shivkumar0757/flake8-ascii-validator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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