Update Development

2025-11-12 15:58:33 +00:00
parent acdca2c3fd
commit 0cbf7b5fc1

@@ -1,15 +1,15 @@
# Development # Development
### Development Environment Setup ## Development Environment Setup
#### Prerequisites ### Prerequisites
- **Python**: 3.9, 3.10, or 3.11 - **Python**: 3.9, 3.10, or 3.11
- **Git**: For version control - **Git**: For version control
- **Docker**: (Optional) For containerized testing - **Docker**: (Optional) For containerized testing
- **IDE**: VS Code, PyCharm, or similar with Python support - **IDE**: VS Code, PyCharm, or similar with Python support
#### Initial Setup ### Initial Setup
1. **Clone the repository:** 1. **Clone the repository:**
```bash ```bash
@@ -44,7 +44,7 @@
# Edit config.ini with your development credentials # Edit config.ini with your development credentials
``` ```
### Project Structure ## Project Structure
``` ```
pterodactyl-discord-bot/ pterodactyl-discord-bot/
@@ -74,9 +74,9 @@ pterodactyl-discord-bot/
└── LICENSE # GPL-3.0 License └── LICENSE # GPL-3.0 License
``` ```
### Development Workflow ## Development Workflow
#### 1. Feature Development ### 1. Feature Development
```bash ```bash
# Create feature branch # Create feature branch
@@ -98,7 +98,7 @@ git commit -m "feat: add your feature description"
git push origin feature/your-feature-name git push origin feature/your-feature-name
``` ```
#### 2. Bug Fixes ### 2. Bug Fixes
```bash ```bash
# Create bugfix branch # Create bugfix branch
@@ -124,7 +124,7 @@ git add .
git commit -m "fix: resolve bug description" git commit -m "fix: resolve bug description"
``` ```
#### 3. Testing Changes ### 3. Testing Changes
```bash ```bash
# Run all tests # Run all tests
@@ -143,9 +143,9 @@ make test-quick
make watch make watch
``` ```
### Testing Infrastructure ## Testing Infrastructure
#### Test Suite Organization ### Test Suite Organization
```python ```python
# test_pterodisbot.py structure # test_pterodisbot.py structure
@@ -196,7 +196,7 @@ make watch
└── test_metrics_collection └── test_metrics_collection
``` ```
#### Running Tests Locally ### Running Tests Locally
```bash ```bash
# Using Makefile (recommended) # Using Makefile (recommended)
@@ -218,7 +218,7 @@ pytest -m "not slow" -v # Skip slow tests
pytest --lf # Run last failed tests only pytest --lf # Run last failed tests only
``` ```
#### Coverage Goals ### Coverage Goals
- **Minimum**: 70% overall coverage - **Minimum**: 70% overall coverage
- **Target**: 85% overall coverage - **Target**: 85% overall coverage
@@ -227,7 +227,7 @@ pytest --lf # Run last failed tests only
- Pterodactyl API client - Pterodactyl API client
- Metrics tracking system - Metrics tracking system
#### Viewing Coverage Reports ### Viewing Coverage Reports
```bash ```bash
# Generate HTML report # Generate HTML report
@@ -241,9 +241,9 @@ python -m http.server --directory htmlcov 8000
pytest --cov=pterodisbot --cov-report=term-missing pytest --cov=pterodisbot --cov-report=term-missing
``` ```
### Code Quality Standards ## Code Quality Standards
#### Linting and Formatting ### Linting and Formatting
```bash ```bash
# Check all quality standards # Check all quality standards
@@ -259,7 +259,7 @@ black --check --line-length=120 pterodisbot.py
isort --check-only --profile black pterodisbot.py isort --check-only --profile black pterodisbot.py
``` ```
#### Style Guidelines ### Style Guidelines
**PEP 8 Compliance:** **PEP 8 Compliance:**
- Maximum line length: 120 characters - Maximum line length: 120 characters
@@ -303,9 +303,9 @@ def complex_function(arg1: str, arg2: int) -> dict:
- Complex algorithms should have explanatory comments - Complex algorithms should have explanatory comments
- TODO comments should include ticket references - TODO comments should include ticket references
### Security Best Practices ## Security Best Practices
#### Running Security Scans ### Running Security Scans
```bash ```bash
# All security checks # All security checks
@@ -317,7 +317,7 @@ safety check # Dependency vulnerabilities
pip-audit # Package auditing pip-audit # Package auditing
``` ```
#### Security Checklist ### Security Checklist
- [ ] No hardcoded credentials in code - [ ] No hardcoded credentials in code
- [ ] API keys stored in config.ini (gitignored) - [ ] API keys stored in config.ini (gitignored)
@@ -327,9 +327,9 @@ pip-audit # Package auditing
- [ ] Error messages don't leak sensitive info - [ ] Error messages don't leak sensitive info
- [ ] Logs don't contain API keys or tokens - [ ] Logs don't contain API keys or tokens
### Debugging Tips ## Debugging Tips
#### Logging Levels ### Logging Levels
```python ```python
# Add debug logging # Add debug logging
@@ -345,7 +345,7 @@ logger.warning(f"API rate limit approaching")
logger.error(f"Failed to update embed: {str(e)}") logger.error(f"Failed to update embed: {str(e)}")
``` ```
#### Common Debugging Commands ### Common Debugging Commands
```bash ```bash
# View logs in real-time # View logs in real-time
@@ -362,7 +362,7 @@ pytest test_pterodisbot.py::test_name --pdb # Drop into debugger on failure
pytest test_pterodisbot.py -vv --showlocals # Show local variables pytest test_pterodisbot.py -vv --showlocals # Show local variables
``` ```
#### VS Code Launch Configuration ### VS Code Launch Configuration
```json ```json
{ {
@@ -393,9 +393,9 @@ pytest test_pterodisbot.py -vv --showlocals # Show local variables
} }
``` ```
### CI/CD Integration ## CI/CD Integration
#### Automated Workflows ### Automated Workflows
The project uses Gitea Actions for continuous integration and deployment: The project uses Gitea Actions for continuous integration and deployment:
@@ -409,7 +409,7 @@ The project uses Gitea Actions for continuous integration and deployment:
- Steps: Test → Build Docker → Push Registry → Report - Steps: Test → Build Docker → Push Registry → Report
- Features: Multi-arch builds, automatic versioning - Features: Multi-arch builds, automatic versioning
#### Local CI Simulation ### Local CI Simulation
```bash ```bash
# Run full CI pipeline locally # Run full CI pipeline locally
@@ -424,7 +424,7 @@ make ci
# 6. Generate reports # 6. Generate reports
``` ```
#### Branch Protection Rules ### Branch Protection Rules
Recommended settings for `main` branch: Recommended settings for `main` branch:
- ✅ Require status checks to pass - ✅ Require status checks to pass
@@ -435,7 +435,7 @@ Recommended settings for `main` branch:
- ✅ Require pull request reviews (1+ approvals) - ✅ Require pull request reviews (1+ approvals)
- ✅ Dismiss stale reviews on new commits - ✅ Dismiss stale reviews on new commits
### Performance Testing ## Performance Testing
```bash ```bash
# Profile the application # Profile the application
@@ -451,9 +451,9 @@ pip install memory_profiler
python -m memory_profiler pterodisbot.py python -m memory_profiler pterodisbot.py
``` ```
### Documentation ## Documentation
#### Generating API Documentation ### Generating API Documentation
```bash ```bash
# Install documentation tools # Install documentation tools
@@ -466,7 +466,7 @@ pdoc --html --output-dir docs pterodisbot.py server_metrics_graphs.py
python -m http.server --directory docs 8080 python -m http.server --directory docs 8080
``` ```
#### Updating Documentation ### Updating Documentation
When adding new features: When adding new features:
1. Update inline code comments 1. Update inline code comments