-
Notifications
You must be signed in to change notification settings - Fork 21
STYLE: Code linting #216
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
base: main
Are you sure you want to change the base?
STYLE: Code linting #216
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request focuses on Python code linting and formatting improvements across the mssql-python codebase. The changes enhance code readability, improve parameter naming consistency, and align with Python style guidelines while maintaining functional equivalence.
- Improves code formatting by breaking long lines and adjusting string quoting style
- Standardizes parameter naming (e.g.,
tableType
→table_type
) - Adds proper module documentation and copyright headers where missing
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
tests/test_004_cursor.py | Updates parameter name from tableType to table_type in cursor.tables() calls |
mssql_python/type.py | Breaks long function signature and error message formatting into multiple lines |
mssql_python/testing_ddbc_bindings.py | Removes unused import and reformats long function calls across multiple lines |
mssql_python/row.py | Adds module header and reformats long lines with proper indentation |
mssql_python/pooling.py | Adds comprehensive module documentation and docstrings for all methods |
mssql_python/mssql_python.pyi | Breaks long function signature into multiple lines for better readability |
mssql_python/logging_config.py | Updates string quoting style and improves code formatting consistency |
mssql_python/helpers.py | Reorganizes imports and removes inline import statements |
mssql_python/exceptions.py | Reformats exception instantiation calls for better readability |
mssql_python/ddbc_bindings.py | Updates string quoting style and reformats conditional logic |
mssql_python/db_connection.py | Breaks long function signature and adds proper spacing |
mssql_python/cursor.py | Extensive formatting improvements including line breaks, string quoting, and parameter naming |
mssql_python/constants.py | Adds spacing between enum class definitions |
mssql_python/connection.py | Reformats imports, breaks long lines, and improves string quoting consistency |
mssql_python/bcp_options.py | Adds module header and improves error message formatting |
mssql_python/auth.py | Reformats imports and improves code formatting throughout |
mssql_python/init.py | Reorganizes imports and uncomments documentation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…sql-python into jahnvi/code_linting
Work Item / Issue Reference
Summary
This pull request introduces several improvements to code quality enforcement, connection handling, and code clarity across the codebase. The main changes include adding automated linting workflows for Python and C++ code, enhancing connection pooling configuration, improving exception handling and validation, and refining code formatting and documentation.
Automated Code Quality Enforcement:
.github/workflows/code-quality-check.yml
) to automatically run Python (pylint
) and C++ (cpplint
) linters on pull requests, with clear status reporting and PR commenting for failed checks..pre-commit-config.yml
to enable pre-commit linting for both Python and C++ files, ensuring code quality before commits are made.cpplint.cfg
to configure C++ linting rules, such as line length and file exclusions.Connection and Pooling Enhancements:
pooling
function inmssql_python/__init__.py
by adding a proper docstring and clarifying default behavior and arguments.PoolingManager
is imported at the module level for better clarity and reliability.Code Quality, Validation, and Documentation:
bcp_options.py
, including improved error messages inBCPOptions
andColumnFormat
classes.mssql_python/auth.py
for better formatting, exception handling, and parameter validation, including improved error messages and code style.Connection Class and Exception Handling:
mssql_python/connection.py
to import and expose all DB-API 2.0 exception classes as attributes of theConnection
class, allowing users to catch exceptions viaconnection.Error
,connection.ProgrammingError
, etc.Connection
class, and clarified weak reference handling for cursors.