-
Notifications
You must be signed in to change notification settings - Fork 550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code Quality Improvements Based on Pylint Report #576
Comments
I have also implemented a test file for vscode@e7bce794d2b3:/workspaces/tinydb/tests$ pytest test_database.py -v
============================================================================= test session starts =============================================================================
platform linux -- Python 3.10.6, pytest-8.2.2, pluggy-1.5.0 -- /usr/bin/python
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/workspaces/tinydb/tests/.hypothesis/examples')
rootdir: /workspaces/tinydb
configfile: pytest.ini
plugins: cov-6.0.0, rerunfailures-11.1.2, xdoctest-1.0.2, shard-0.1.2, hypothesis-5.35.1, xdist-3.3.1
collected 7 items
Running 7 items in this shard: tests/test_database.py::test_table_creation, tests/test_database.py::test_insert_and_read, tests/test_database.py::test_drop_table, tests/test_database.py::test_drop_all_tables, tests/test_database.py::test_len_and_iteration, tests/test_database.py::test_context_manager, tests/test_database.py::test_repr
test_database.py::test_table_creation PASSED [ 14%]
test_database.py::test_insert_and_read PASSED [ 28%]
test_database.py::test_drop_table PASSED [ 42%]
test_database.py::test_drop_all_tables PASSED [ 57%]
test_database.py::test_len_and_iteration PASSED [ 71%]
test_database.py::test_context_manager PASSED [ 85%]
test_database.py::test_repr PASSED [100%]
---------- coverage: platform linux, python 3.10.6-final-0 -----------
Name Stmts Miss Cover
--------------------------------------------------------------
/workspaces/tinydb/tinydb/__init__.py 5 0 100%
/workspaces/tinydb/tinydb/database.py 56 2 96%
/workspaces/tinydb/tinydb/middlewares.py 33 0 100%
/workspaces/tinydb/tinydb/mypy_plugin.py 25 25 0%
/workspaces/tinydb/tinydb/operations.py 24 24 0%
/workspaces/tinydb/tinydb/queries.py 128 86 33%
/workspaces/tinydb/tinydb/storages.py 60 8 87%
/workspaces/tinydb/tinydb/table.py 219 128 42%
/workspaces/tinydb/tinydb/utils.py 73 34 53%
/workspaces/tinydb/tinydb/version.py 1 0 100%
--------------------------------------------------------------
TOTAL 624 307 51%
============================================================================== 7 passed in 0.10s ============================================================================== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, Markus Siemens & TinyDB team!
I ran a Pylint analysis on the TinyDB codebase, and I identified some areas where code quality could be improved. Below is a summary of the findings, of the code block for the function
def __repr__(self)
, along with suggestions for addressing each category. These changes should enhance code readability, maintainability, and adherence to Python's best practices.Enhanced f-String Usage:
__repr__
method uses.format()
, which can be less readable than f-strings..format()
with f-strings. For example:The text was updated successfully, but these errors were encountered: