Skip to main content

Additional checkers for pylint that are used by the FS-CFEL-1 team

Project description

cfel-pylint-checkers

Installation

Just pip install cfel-pylint-checkers should suffice. Then you can enable the appropriate checkers as plugins by editing your .pylintrc file, extending the load-plugins line. For example:

load-plugins=cfel_pylint_checkers.no_direct_dict_access

Checkers

no-direct-dict-access

This disallows the use of dictionary access using the [] operator for reading. Meaning, this is no longer allowed:

mydict = { "foo": 3 }

print(mydict["bar"])

As you can see, this code produces an error, since we’re accessing "bar" but the mydict dictionary only contains the key "foo". You have to use .get to make this safe:

mydict = { "foo": 3 }

print(mydict.get("bar"))

Which produces None if the key doesn’t exist. You can even specify a default value:

mydict = { "foo": 3 }

print(mydict.get("bar", 0))

Mutating use of operator[] is, of course, still possible. This is fine:

mydict = { "foo": 3 }

mydict["bar"] = 4

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

cfel-pylint-checkers-1.0.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

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

cfel_pylint_checkers-1.0-py3-none-any.whl (26.3 kB view details)

Uploaded Python 3

File details

Details for the file cfel-pylint-checkers-1.0.tar.gz.

File metadata

  • Download URL: cfel-pylint-checkers-1.0.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Linux/5.15.0-37-generic

File hashes

Hashes for cfel-pylint-checkers-1.0.tar.gz
Algorithm Hash digest
SHA256 465ec515b01f8c6bbe7f561471bd312c8470f23baff7e894c6b9efea3a7b6b06
MD5 ec3eba1f62fe6a10d223ca6a590d7098
BLAKE2b-256 a8c50ffacf8d9ed383280421dffa7f035911aa8e65aa69f1bf7f676eb8c52756

See more details on using hashes here.

File details

Details for the file cfel_pylint_checkers-1.0-py3-none-any.whl.

File metadata

  • Download URL: cfel_pylint_checkers-1.0-py3-none-any.whl
  • Upload date:
  • Size: 26.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Linux/5.15.0-37-generic

File hashes

Hashes for cfel_pylint_checkers-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2b1f3a8093c1c664310da48c09ebf0dc1d5cf0627f9c25f18bf9e73531bcb05b
MD5 d0127477533429eab1445682341b77ac
BLAKE2b-256 e009de8c0954966218342ab50506c2e6f079bab2a034782cd58ec7dc7920d3dc

See more details on using hashes here.

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