Getting started
Thank you for considering contributing to Tweet Audit Tool! This guide will help you get started with contributing code, documentation, and improvements.Before you begin
Set up your environment
Follow the development setup guide to configure your local environment.
Familiarize yourself with the codebase
Read through the project structure and understand the code organization:
- Each file has a single responsibility (models, config, storage, analyzer, application, main)
- Tests mirror the source code structure
- All tests should follow the Arrange-Act-Assert pattern
Pull request process
Create a feature branch
Create a descriptive branch name for your changes:
Use prefixes:
feature/, fix/, docs/, refactor/, test/, or chore/Make your changes
Follow the coding standards and best practices outlined below. Key points:
- Write tests for new functionality
- Update documentation if needed
- Follow existing code style and conventions
- Keep commits focused and atomic
Run quality checks
Before committing, ensure all checks pass:All tests should pass and coverage should meet the guidelines:
- Core logic: 80%+
- Utilities: 60%+
- CLI: 40%+
Commit your changes
Write clear, descriptive commit messages following the conventional commits format:See commit message format below for details.
Commit message format
Follow the conventional commits specification:Commit types
- feat - New feature
- fix - Bug fix
- docs - Documentation only changes
- style - Code style changes (formatting, etc.)
- refactor - Code restructuring without changing behavior
- test - Adding or updating tests
- chore - Maintenance tasks (dependencies, build, etc.)
Examples
Code style guidelines
Imports
Organize imports in three groups:Type hints
Always use type hints for function parameters and return values:Naming conventions
- Classes:
PascalCase(e.g.,TweetAnalyzer,CSVWriter) - Functions/methods:
snake_case(e.g.,analyze_tweet,write_results) - Constants:
UPPER_SNAKE_CASE(e.g.,MAX_RETRIES,DEFAULT_BATCH_SIZE) - Private methods:
_leading_underscore(e.g.,_build_prompt,_rate_limit)
Docstrings
Write docstrings for public functions and classes:Context managers
Use context managers for resource management:Fail fast
Validate inputs early and raise clear exceptions:Development workflow
Adding new features
Follow this workflow when adding functionality:Common tasks
Add new analysis criteria type
Add new analysis criteria type
- Update
Criteriamodel inconfig.py - Update
_build_promptinanalyzer.pyto include new criteria - Update
config.example.jsonwith example - Add tests in
test_analyzer.py - Update README.md with new criteria explanation
Change Gemini model
Change Gemini model
Update the model in Or programmatically in
.env:config.py:Add progress bar
Add progress bar
Install tqdm:Use in
application.py:Testing guidelines
Test-driven development
Always write tests before or alongside implementation:- Write a failing test that defines the desired behavior
- Run the test to verify it fails (red)
- Implement the minimal code to make it pass (green)
- Refactor while keeping tests green
- Repeat
Test coverage
Ensure adequate test coverage:Writing good tests
Test one thing
Each test should verify a single behavior or scenario
Use descriptive names
Test names should clearly describe what’s being tested
Mock external dependencies
Mock APIs, file systems, and external services
Test edge cases
Include tests for error conditions and boundary cases
Code review process
When reviewing or submitting code:What reviewers look for
- Functionality - Does the code work as intended?
- Tests - Are there adequate tests with good coverage?
- Code style - Does it follow project conventions?
- Documentation - Are changes documented appropriately?
- Performance - Are there any obvious performance issues?
- Security - Are there any security concerns?
Responding to feedback
- Address all review comments
- Ask for clarification if feedback is unclear
- Push additional commits to the same branch
- Re-request review when ready
Be open to feedback and remember that code review improves code quality and helps everyone learn.
Documentation contributions
Documentation improvements are highly valued:- Fix typos or unclear explanations
- Add examples or use cases
- Improve API documentation
- Write tutorials or guides
- Update outdated information
Best practices
Keep functions small
Keep functions small
Each function should do one thing well:
Write self-documenting code
Write self-documenting code
Use clear variable and function names:
Avoid premature optimization
Avoid premature optimization
Focus on correctness and clarity first:
- Make it work (correctness)
- Make it right (clean code)
- Make it fast (only if needed)
Handle errors explicitly
Handle errors explicitly
Don’t silently ignore errors:
Resources
- Python Style Guide (PEP 8)
- Pytest Documentation
- Ruff Documentation
- Google Gemini API Docs
- Conventional Commits
Getting help
If you need help:- Read the docs - Check DEVELOPMENT.md and README.md
- Review tests - Tests show usage examples
- Ask questions - Open a GitHub discussion
- Report bugs - Open a GitHub issue with details