English | 中文 | Français | Español | العربية | Русский
This document provides detailed information about the development process, code standards, and best practices for contributing to the MCP Database Utilities project.
We use SonarCloud to maintain high code quality standards. All pull requests must pass the following quality gates:
- Code Coverage: ≥ 80%
- Code Quality:
- No blocking or critical issues
- Fewer than 10 major issues
- Code duplication < 3%
- Security:
- No security vulnerabilities
- No security hotspots
Our CI/CD pipeline automatically performs:
- Complete test suite execution
- Code coverage analysis
- SonarCloud static code analysis
- Quality gate validation
Pull requests that don't meet these standards will automatically be blocked from merging.
We use Ruff for code style checking and formatting to ensure code quality and consistency.
- Line Length: Maximum 88 characters
- Indentation: 4 spaces (no tabs)
- Quotes: Double quotes for strings
- Naming Conventions:
- Class names: CamelCase (e.g.,
DatabaseHandler) - Functions and variables: snake_case (e.g.,
execute_query) - Constants: UPPERCASE with underscores (e.g.,
MAX_CONNECTIONS) - Private methods and attributes: Single underscore prefix (e.g.,
_connect)
- Class names: CamelCase (e.g.,
-
Import order:
- Standard library
- Third-party libraries
- Local application/library
-
One blank line between each import group
- Two blank lines between class definitions
- One blank line between method definitions
- Related code should be grouped together
This project uses the following Ruff rule sets:
E: pycodestyle errorsF: pyflakesI: isortN: pep8-namingUP: pyupgradeB: flake8-bugbearC4: flake8-comprehensionsSIM: flake8-simplifyT20: flake8-print
# Install Ruff
uv pip install ruff
# Install pre-commit
uv pip install pre-commit
pre-commit install# Check the entire project
ruff check .
# Automatically fix issues
ruff check --fix .# Check formatting
ruff format --check .
# Automatically format code
ruff format .The project has pre-commit hooks configured to automatically run Ruff checks and formatting when committing code.
# Run pre-commit manually
pre-commit run --all-files# Run tests with coverage
pytest --cov=src/mcp_dbutils --cov-report=xml:coverage.xml tests/- Use SonarLint in your IDE to catch issues early
- View SonarCloud analysis in PR comments
Use comments to ignore specific rules for a line:
# Ignore the entire line
some_code_here # noqa
# Ignore a specific rule
some_code_here # noqa: E501
# Ignore multiple rules
some_code_here # noqa: E501, F401Add to the [tool.ruff] section in pyproject.toml:
ignore = ["E501"]If you have issues with third-party import ordering, configure in pyproject.toml:
[tool.ruff.isort]
known-third-party = ["third_party_lib"]GitHub Actions automatically runs Ruff checks and formatting on every push and PR to ensure code compliance.
Each PR triggers the following automated checks:
- Code Style Verification: Uses Ruff to verify code adheres to project style guidelines
- Unit Tests: Runs all tests to ensure functionality works as expected
- Code Coverage: Ensures test coverage meets requirements
- SonarCloud Analysis: Performs in-depth code quality and security analysis
- Check the "Checks" tab on the GitHub PR page
- Click on specific checks to view detailed information
- For SonarCloud analysis, click the link to view the full report
MCP Database Utilities is regularly updated with new features, performance improvements, and bug fixes. In most cases, the update process is managed automatically by your MCP client, requiring no manual intervention.
-
Using MCP Clients: Most MCP clients (like Claude Desktop, Cursor, etc.) will automatically update to the latest version
-
Manually Checking for Updates:
- Visit the GitHub repository to see the latest version
- Read the release notes to learn about new features and changes
-
Issue Reporting:
- If you encounter issues after updating, please submit an issue