[2.6.0] - 2023-08-06
Updated 2023/08/13: This release required the graphviz
Python library to be installed, but this library was not listed as a project dependency. graphviz
has been moved to be an optional dependency in 2.6.1.
Enhancements
- Can now create control flow graphs using
python_ta.control_flow_graphs
to visualize the execution paths of Python code. forbidden-top-level-code
andforbidden-global-variables
now allow top-level type alias assignment statements.- The
trailing-whitespace
error message now highlights the trailing whitespace. - The
unnecessary-indexing
error now checks for a greater variety of loop/comprehension indexes. - Provided configuration files are now merged with PythonTA defaults, so you now only need to specify options that you want to be overridden. To ignore PythonTA defaults (the old behaviour), pass
load_default_config=False
tocheck_errors
andcheck_all
. - Improved the code snippets for the
pep8-errors
"blank line" messages. Extra blank lines are now highlighted, and suggestions are added when blank lines are missing. - The default value of the
pyta-number-of-messages
configuration option is now 0 (changed from 5) This causes all error occurrences to be displayed. - Improved efficiency of the contract-checking custom
setattr
for classes. - Added new function
python_ta.contracts.validate_invariants
to manually check contracts for an object. - Updated to pycodestyle v2.11.
Bug Fixes
- Fixed bug where running
python3 -m python_ta --generate-config
yields aFileNotFoundError
. - Fixed bug in how PythonTA reports error messages that occur when parsing configuration files.
- Ensured some config file parsing errors no longer display incorrect lines in the error report.
- Fixed bug where the
HTMLReporter
andJSONReporter
would ignore thepyta-number-of-messages
option and always display all error occurrences. - Fixed bug in
check_contracts
where imported classes were not correctly resolved when checking types. - Fixed bug for class contract-checking when assigning an instance attribute that violates a class type constraint or representation invariant. Previously, the instance attribute changed to the new value after the error was raised, but now is correctly restored to the original value.
- Remove line double-spacing in PlainReporter and ColorReporter output code snippets.
New checkers
Custom checkers:
invalid-name-checker
: Provide beginner-friendly error messages when reporting variable names that violate Python naming conventions. This replaces pylint's C0103 check.
Pylint checkers v2.16:
pointless-exception-statement
shadowed-import
unbalanced-dict-unpacking
nested-min-max
invalid-slice-step
Pylint checkers v2.17:
bad-chained-comparison
For more information on these checkers, please see the Pylint release notes. Note that the above list only contains the Pylint checkers enabled by default in PythonTA.