Contributing Guide
Guidelines and best practices for contributing to MiyoList
๐ Getting Started
Thank you for considering contributing to MiyoList! We welcome contributions from the community.
- Fork the repository on GitHub
- Clone your fork locally
- Create a new branch for your feature/fix
- Make your changes following our guidelines
- Test thoroughly before submitting
- Submit a pull request with clear description
๐ Code Style Guidelines
Dart/Flutter Conventions
- Follow Effective Dart style guide
- Use
lowerCamelCasefor variables and methods - Use
UpperCamelCasefor classes - Use
snake_casefor file names - Always use
constconstructors when possible - Prefer
finalovervarwhen variable won't change
Code Organization
- Keep files under 500 lines when possible
- One class per file (with exceptions for small helper classes)
- Group imports: dart libraries, package imports, relative imports
- Use meaningful variable and function names
- Add comments for complex logic
Example Code Style
// Good โ
class AnimeService {
final ApiClient _apiClient;
const AnimeService(this._apiClient);
Future<List<Anime>> fetchAnimeList({
required String userId,
int page = 1,
}) async {
try {
final response = await _apiClient.query(query);
return response.map((e) => Anime.fromJson(e)).toList();
} catch (e) {
throw ApiException('Failed to fetch anime list: $e');
}
}
}
// Bad โ
class anime_service {
var apiClient;
anime_service(this.apiClient);
fetchAnimeList(userId, page) async {
var response = await apiClient.query(query);
return response.map((e) => Anime.fromJson(e)).toList();
}
} โจ Feature Development
Before Starting
- Check if there's an existing issue or discussion about the feature
- Create a new issue to discuss major features before implementing
- Make sure the feature aligns with project goals
- Review existing similar features for consistency
Feature Structure
lib/features/your_feature/
โโโ data/
โ โโโ models/ # Data models
โ โโโ repositories/ # Data repositories
โ โโโ services/ # API services
โโโ presentation/
โ โโโ pages/ # UI pages
โ โโโ widgets/ # Feature-specific widgets
โ โโโ providers/ # State management
โโโ domain/
โโโ usecases/ # Business logic State Management
MiyoList uses Riverpod for state management:
final animeListProvider = FutureProvider.autoDispose
.family<List<Anime>, String>((ref, userId) async {
final service = ref.read(animeServiceProvider);
return service.fetchAnimeList(userId: userId);
}); ๐งช Testing Requirements
All new features and bug fixes should include tests:
Unit Tests
- Test business logic and data models
- Mock external dependencies
- Aim for 80%+ code coverage
test('Anime.fromJson creates valid object', () {
final json = {'id': 1, 'title': 'Test Anime'};
final anime = Anime.fromJson(json);
expect(anime.id, 1);
expect(anime.title, 'Test Anime');
}); Widget Tests
- Test UI components and interactions
- Verify correct rendering
- Test user input handling
Running Tests
# Run all tests
flutter test
# Run specific test file
flutter test test/features/anime/anime_test.dart
# Run with coverage
flutter test --coverage ๐ค Pull Request Guidelines
PR Checklist
- โ Code follows project style guidelines
- โ All tests pass locally
- โ New code is covered by tests
- โ Documentation is updated
- โ Commit messages are clear and descriptive
- โ PR description explains changes and motivation
- โ No merge conflicts with main branch
PR Title Format
type(scope): brief description
Examples:
feat(anime): add advanced filtering options
fix(auth): resolve OAuth redirect issue
docs(readme): update installation instructions
refactor(search): improve query performance
test(manga): add unit tests for MangaService Types
feat- New featurefix- Bug fixdocs- Documentation changesstyle- Code style changes (formatting, etc.)refactor- Code refactoringtest- Adding or updating testschore- Maintenance tasks
๐ฟ Branch Strategy
main- Stable release branchdevelop- Development branch (if exists)feature/feature-name- New featuresfix/bug-description- Bug fixesdocs/documentation-update- Documentation
Creating a Branch
git checkout -b feature/advanced-search
# Make your changes
git add .
git commit -m "feat(search): add advanced filtering"
git push origin feature/advanced-search ๐ Code Review Process
All contributions go through code review:
- Maintainers will review your PR within 3-5 days
- Address feedback and requested changes
- Keep discussions constructive and respectful
- Be open to suggestions and alternative approaches
- Update PR based on review comments
๐ก Tip
Break large features into smaller, reviewable PRs. This speeds up the review process and makes it easier to merge.
๐ค Community Guidelines
- Be respectful and professional
- Welcome newcomers and help them contribute
- Provide constructive feedback
- Keep discussions on-topic
- Follow our Code of Conduct