Updated pylint config and linted everything
This commit is contained in:
parent
69fe9dca75
commit
1530cf9cbf
18 changed files with 30 additions and 52 deletions
55
.pylintrc
55
.pylintrc
|
|
@ -1,6 +1,7 @@
|
|||
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
|
||||
#
|
||||
# SPDX-License-Identifier: Unlicense
|
||||
|
||||
[MASTER]
|
||||
|
||||
# A comma-separated list of package or module names from where C extensions may
|
||||
|
|
@ -8,11 +9,11 @@
|
|||
# run arbitrary code
|
||||
extension-pkg-whitelist=hid
|
||||
|
||||
# Add files or directories to the blacklist. They should be base names, not
|
||||
# Add files or directories to the ignore-list. They should be base names, not
|
||||
# paths.
|
||||
ignore=CVS
|
||||
|
||||
# Add files or directories matching the regex patterns to the blacklist. The
|
||||
# Add files or directories matching the regex patterns to the ignore-list. The
|
||||
# regex matches against base names, not paths.
|
||||
ignore-patterns=
|
||||
|
||||
|
|
@ -22,11 +23,10 @@ ignore-patterns=
|
|||
|
||||
# Use multiple processes to speed up Pylint.
|
||||
jobs=1
|
||||
# jobs=2
|
||||
|
||||
# List of plugins (as comma separated values of python modules names) to load,
|
||||
# usually to register additional checkers.
|
||||
load-plugins=
|
||||
load-plugins=pylint.extensions.no_self_use
|
||||
|
||||
# Pickle collected data for later comparisons.
|
||||
persistent=yes
|
||||
|
|
@ -54,8 +54,8 @@ confidence=
|
|||
# --enable=similarities". If you want to run only the classes checker, but have
|
||||
# no Warning level messages displayed, use"--disable=all --enable=classes
|
||||
# --disable=W"
|
||||
# disable=import-error,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call
|
||||
disable=print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error,bad-continuation,invalid-name
|
||||
# disable=import-error,raw-checker-failed,bad-inline-option,locally-disabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,deprecated-str-translate-call
|
||||
disable=raw-checker-failed,bad-inline-option,locally-disabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,import-error,pointless-string-statement,unspecified-encoding,import-outside-toplevel,too-many-branches,too-many-statements,too-many-public-methods,invalid-name
|
||||
|
||||
# Enable the message, report, category or checker with the given id(s). You can
|
||||
# either give multiple identifier separated by comma (,) or put this option
|
||||
|
|
@ -225,12 +225,6 @@ max-line-length=100
|
|||
# Maximum number of lines in a module
|
||||
max-module-lines=1000
|
||||
|
||||
# List of optional constructs for which whitespace checking is disabled. `dict-
|
||||
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
|
||||
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
|
||||
# `empty-line` allows space-only lines.
|
||||
no-space-check=trailing-comma,dict-separator
|
||||
|
||||
# Allow the body of a class to be on the same line as the declaration if body
|
||||
# contains single statement.
|
||||
single-line-class-stmt=no
|
||||
|
|
@ -249,46 +243,30 @@ ignore-comments=yes
|
|||
ignore-docstrings=yes
|
||||
|
||||
# Ignore imports when computing similarities.
|
||||
ignore-imports=no
|
||||
ignore-imports=yes
|
||||
|
||||
# Minimum lines number of a similarity.
|
||||
min-similarity-lines=80
|
||||
min-similarity-lines=12
|
||||
|
||||
|
||||
[BASIC]
|
||||
|
||||
# Naming hint for argument names
|
||||
argument-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
|
||||
|
||||
# Regular expression matching correct argument names
|
||||
argument-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
|
||||
|
||||
# Naming hint for attribute names
|
||||
attr-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
|
||||
|
||||
# Regular expression matching correct attribute names
|
||||
attr-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
|
||||
|
||||
# Bad variable names which should always be refused, separated by a comma
|
||||
bad-names=foo,bar,baz,toto,tutu,tata
|
||||
|
||||
# Naming hint for class attribute names
|
||||
class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
|
||||
|
||||
# Regular expression matching correct class attribute names
|
||||
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
|
||||
|
||||
# Naming hint for class names
|
||||
# class-name-hint=[A-Z_][a-zA-Z0-9]+$
|
||||
class-name-hint=[A-Z_][a-zA-Z0-9_]+$
|
||||
|
||||
# Regular expression matching correct class names
|
||||
# class-rgx=[A-Z_][a-zA-Z0-9]+$
|
||||
class-rgx=[A-Z_][a-zA-Z0-9_]+$
|
||||
|
||||
# Naming hint for constant names
|
||||
const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$
|
||||
|
||||
# Regular expression matching correct constant names
|
||||
const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
|
||||
|
||||
|
|
@ -296,9 +274,6 @@ const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
|
|||
# ones are exempt.
|
||||
docstring-min-length=-1
|
||||
|
||||
# Naming hint for function names
|
||||
function-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
|
||||
|
||||
# Regular expression matching correct function names
|
||||
function-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
|
||||
|
||||
|
|
@ -309,21 +284,12 @@ good-names=r,g,b,w,i,j,k,n,x,y,z,ex,ok,Run,_
|
|||
# Include a hint for the correct naming format with invalid-name
|
||||
include-naming-hint=no
|
||||
|
||||
# Naming hint for inline iteration names
|
||||
inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$
|
||||
|
||||
# Regular expression matching correct inline iteration names
|
||||
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
|
||||
|
||||
# Naming hint for method names
|
||||
method-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
|
||||
|
||||
# Regular expression matching correct method names
|
||||
method-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
|
||||
|
||||
# Naming hint for module names
|
||||
module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
|
||||
|
||||
# Regular expression matching correct module names
|
||||
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
|
||||
|
||||
|
|
@ -339,9 +305,6 @@ no-docstring-rgx=^_
|
|||
# to this list to register other decorators that produce valid properties.
|
||||
property-classes=abc.abstractproperty
|
||||
|
||||
# Naming hint for variable names
|
||||
variable-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
|
||||
|
||||
# Regular expression matching correct variable names
|
||||
variable-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
|
||||
|
||||
|
|
@ -433,4 +396,4 @@ min-public-methods=1
|
|||
|
||||
# Exceptions that will emit a warning when being caught. Defaults to
|
||||
# "Exception"
|
||||
overgeneral-exceptions=Exception
|
||||
overgeneral-exceptions=builtins.Exception
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ try:
|
|||
except ImportError:
|
||||
raise RuntimeError("No PWM outputs defined for this board") from ImportError
|
||||
|
||||
|
||||
# pylint: disable=unnecessary-pass
|
||||
class PWMError(IOError):
|
||||
"""Base class for PWM errors."""
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ DEBUG = False
|
|||
queues = []
|
||||
procs = []
|
||||
|
||||
|
||||
# The message queues live outside of python space, and must be formally cleaned!
|
||||
def final():
|
||||
"""In case the program is cancelled or quit, we need to clean up the PulseIn
|
||||
|
|
@ -29,6 +30,7 @@ def final():
|
|||
|
||||
atexit.register(final)
|
||||
|
||||
|
||||
# pylint: disable=c-extension-no-member
|
||||
class PulseIn:
|
||||
"""PulseIn Class to read PWM signals"""
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ DEBUG = False
|
|||
queues = []
|
||||
procs = []
|
||||
|
||||
|
||||
# The message queues live outside of python space, and must be formally cleaned!
|
||||
def final():
|
||||
"""In case the program is cancelled or quit, we need to clean up the PulseIn
|
||||
|
|
@ -28,6 +29,7 @@ def final():
|
|||
|
||||
atexit.register(final)
|
||||
|
||||
|
||||
# pylint: disable=c-extension-no-member
|
||||
class PulseIn:
|
||||
"""PulseIn Class to read PWM signals"""
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ DEBUG = False
|
|||
queues = []
|
||||
procs = []
|
||||
|
||||
|
||||
# The message queues live outside of python space, and must be formally cleaned!
|
||||
def final():
|
||||
"""In case the program is cancelled or quit, we need to clean up the PulseIn
|
||||
|
|
@ -29,6 +30,7 @@ def final():
|
|||
|
||||
atexit.register(final)
|
||||
|
||||
|
||||
# pylint: disable=c-extension-no-member
|
||||
class PulseIn:
|
||||
"""PulseIn Class to read PWM signals"""
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ from adafruit_blinka.microcontroller.ftdi_mpsse.mpsse.url import (
|
|||
get_ft2232h_url,
|
||||
)
|
||||
|
||||
|
||||
# pylint: disable=protected-access
|
||||
class SPI:
|
||||
"""Custom SPI Class for FTDI MPSSE"""
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ except ImportError:
|
|||
"https://github.com/adafruit/Raspberry-Pi-Installer-Scripts/blob/master/libgpiod.sh"
|
||||
) from ImportError
|
||||
|
||||
|
||||
# pylint: disable=too-many-branches,too-many-statements
|
||||
class Pin:
|
||||
"""Pins dont exist in CPython so...lets make our own!"""
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import os
|
|||
import errno
|
||||
import time
|
||||
|
||||
|
||||
# pylint: disable=unnecessary-pass
|
||||
class GPIOError(IOError):
|
||||
"""Base class for GPIO errors."""
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
"""SPI Class for Generic MicroPython"""
|
||||
from machine import SPI as _SPI
|
||||
|
||||
|
||||
# pylint: disable=protected-access, no-self-use
|
||||
class SPI:
|
||||
"""SPI Class for Generic MicroPython"""
|
||||
|
|
|
|||
|
|
@ -19,7 +19,9 @@ class Connection:
|
|||
def __init__(self):
|
||||
"""Virtually private constructor."""
|
||||
if Connection.__instance is not None:
|
||||
raise Exception("This class is a singleton!")
|
||||
raise Exception( # pylint: disable=broad-exception-raised
|
||||
"This class is a singleton!"
|
||||
)
|
||||
|
||||
# pylint: disable=import-outside-toplevel
|
||||
from binhoHostAdapter import binhoHostAdapter
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ try:
|
|||
except ImportError:
|
||||
raise RuntimeError("No PWM outputs defined for this board") from ImportError
|
||||
|
||||
|
||||
# pylint: disable=unnecessary-pass
|
||||
class PWMError(IOError):
|
||||
"""Base class for PWM errors."""
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ from machine import SPI as _SPI
|
|||
from machine import Pin
|
||||
from microcontroller.pin import spiPorts
|
||||
|
||||
|
||||
# pylint: disable=protected-access, no-self-use
|
||||
class SPI:
|
||||
"""Custom SPI Class for RP2040"""
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ from machine import UART as _UART
|
|||
from machine import Pin
|
||||
from microcontroller.pin import uartPorts
|
||||
|
||||
|
||||
# pylint: disable=protected-access, no-self-use
|
||||
class UART:
|
||||
"""Custom UART Class for RP2040"""
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ elif detector.chip.AM33XX:
|
|||
from adafruit_blinka.microcontroller.am335x.pin import Pin
|
||||
elif detector.chip.AM65XX:
|
||||
from adafruit_blinka.microcontroller.am65xx.pin import Pin
|
||||
elif detector.chip.JH71x0:
|
||||
elif detector.chip.JH71X0:
|
||||
from adafruit_blinka.microcontroller.starfive.JH71x0.pin import Pin
|
||||
elif detector.chip.DRA74X:
|
||||
from adafruit_blinka.microcontroller.dra74x.pin import Pin
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ elif chip_id == ap_chip.AM33XX:
|
|||
from adafruit_blinka.microcontroller.am335x import *
|
||||
elif chip_id == ap_chip.AM65XX:
|
||||
from adafruit_blinka.microcontroller.am65xx import *
|
||||
elif chip_id == ap_chip.JH71x0:
|
||||
elif chip_id == ap_chip.JH71X0:
|
||||
from adafruit_blinka.microcontroller.starfive.JH71x0 import *
|
||||
elif chip_id == ap_chip.SUN8I:
|
||||
from adafruit_blinka.microcontroller.allwinner.h3 import *
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ elif chip_id == ap_chip.AM33XX:
|
|||
from adafruit_blinka.microcontroller.am335x.pin import *
|
||||
elif chip_id == ap_chip.AM65XX:
|
||||
from adafruit_blinka.microcontroller.am65xx.pin import *
|
||||
elif chip_id == ap_chip.JH71x0:
|
||||
elif chip_id == ap_chip.JH71X0:
|
||||
from adafruit_blinka.microcontroller.starfive.JH71x0.pin import *
|
||||
elif chip_id == ap_chip.SUN8I:
|
||||
from adafruit_blinka.microcontroller.allwinner.h3.pin import *
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import sys
|
|||
|
||||
for module in ["dwc2", "libcomposite"]:
|
||||
if Path("/proc/modules").read_text(encoding="utf-8").find(module) == -1:
|
||||
raise Exception(
|
||||
raise Exception( # pylint: disable=broad-exception-raised
|
||||
"%s module not present in your kernel. did you insmod it?" % module
|
||||
)
|
||||
this = sys.modules[__name__]
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ gc.collect()
|
|||
|
||||
class TestBME280Interactive(TestCase):
|
||||
def test_read_value(self):
|
||||
|
||||
import board
|
||||
|
||||
gc.collect()
|
||||
|
|
|
|||
Loading…
Reference in a new issue