Django Smelly Tokens
It is sometimes possible to tell that code stinks even without looking at it. This Django app tries to accomplish that.
Installation
pip install django-smelly-tokens
Usage
In your settings.py define SMELLY_TOKENS_APPLICATIONS list with packages you want to inspect.
In a package with code quality tests (e.g. test_tokens.py) import tests you want to check your apps against:
from smelly_tokens.test_smelly_tokens import (
EvalTokenTestCase,
PdbTokenTestCase,
)
Run django-admin.py test or ./manage.py test or py.test or nose or whatever runner you’re using.
Exceptions
To silence known errors PEP8-style noqa comment can be used in the beginning of a file:
# smelly_tokens: noqa
Or in-line:
eval('print 123') # noqa
To exclude an entire directory add it’s path to SMELLY_TOKENS_EXCLUDE_DIRS list in settings.
Adding your own tokens
To create a new type of smelly token test case, inherit SmellyTokensTestCase and override _tokens list:
from django.test import TestCase
from smelly_tokens.test_smelly_tokens import SmellyTokensTestCase
class OOPTokensTestCase(SmellyTokensTestCase, TestCase):
""" OOP hater. """
_tokens = ['class', 'object', 'Object']
References
Changelog
0.5.0 (2022-06-06)
Use pathlib for path manipulation.
0.4.6 (2020-09-21)
Better directory exclusion.
0.4.5 (2020-09-21)
New pkgutil.get_loader fix.
0.4.4 (2018-06-06)
#movingtogitlab
0.4 (2017-05-06)
Introduced zest.releaser.
Released to PyPI.
Documentation.
0.3 (2017-05-02)
Python 2 / 3 compatibility.
Multiple tokens per class.
Metadata
Release files for django-smelly-tokens 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django-smelly-tokens-0.5.0.tar.gz | 7.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_smelly_tokens-0.5.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 11.3 kB
Release files / django-smelly-tokens-0.5.0.tar.gz
| Download URL | django-smelly-tokens-0.5.0.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9b092cc5176fcbdb97d6d6b2573b6fc6e72c1f09f11f8f70dd3c23c9ebc3aec6
|
|
BLAKE2b-256 checksum How to use checksums |
ca2208d4a6270c0449e40ee4518c77a84d421e69441fb715229a596b8dfc598e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.4
|
Release files / django_smelly_tokens-0.5.0-py2.py3-none-any.whl
| Download URL | django_smelly_tokens-0.5.0-py2.py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
b6ba75d411de9de057466e5f62c7b30265f41e0b3ace4c54ace4367a2bb825d6
|
|
BLAKE2b-256 checksum How to use checksums |
b20c2203789acc9893612eadc265fc5e1de89e71954cb05b13ab130431b53a81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.4
|
Security for django-smelly-tokens 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.