-
Notifications
You must be signed in to change notification settings - Fork 0
Contributors表示 #400
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?
Contributors表示 #400
Conversation
…vice GitHubContributorServiceを作成
…wState GitHubContributorViewStateを作成
* Create GitHubContributorVieeModel * Create githubContributorViewModelTest * Refactor GithubContributorViewmodel to use a class-level service instance for improved code clarity and efficiency (#417) --------- Co-authored-by: Kanta Oikawa <[email protected]>
* Create GitHubContributorVieeModel * Create githubContributorViewModelTest * Create githubContributorScreen * Fix Copilot error * Transition from the Settings Screen to the GitHub Contributor Screen * Fix copilot error * Fix the classname GitHubContributorViewModelProvider * Display usename * Update lib/feature/setting/settings.dart Co-authored-by: Kanta Oikawa <[email protected]> * Refactor GithubContributorViewmodel to use a class-level service instance for improved code clarity and efficiency (#417) --------- Co-authored-by: Kanta Oikawa <[email protected]>
Generated by 🚫 Danger |
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 PR implements a GitHub Contributors display feature that fetches and shows the list of contributors from the GitHub API. It follows clean architecture principles with domain, repository, service, and presentation layers, and includes comprehensive test coverage.
- Adds a complete GitHub contributors feature with clean architecture separation
- Implements UI screen with pull-to-refresh functionality
- Includes comprehensive unit tests for service and viewmodel layers
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/domain/github_profile.dart | Defines the domain model for GitHub profile data with JSON serialization |
| lib/repository/github_contoributor_repository.dart | Implements repository layer to fetch contributors from GitHub API |
| lib/feature/github_contributor/github_contributor_service.dart | Service layer that wraps repository calls |
| lib/feature/github_contributor/github_contributor_viewmodel.dart | ViewModel managing state and business logic for contributors screen |
| lib/feature/github_contributor/github_contributor_viewstate.dart | View state model holding contributors list |
| lib/feature/github_contributor/github_contributor_screen.dart | UI screen displaying contributors with pull-to-refresh |
| lib/feature/setting/settings.dart | Adds navigation to contributors screen from settings |
| test/feature/github_contributors/github_contributor_service_test.dart | Unit tests for service layer |
| test/feature/github_contributors/github_contributor_viewmodel_test.dart | Unit tests for viewmodel layer |
| test/feature/github_contributors/github_contributor_service_test.mocks.dart | Generated mocks for service tests |
| test/feature/github_contributors/github_contributor_viewmodel_test.mocks.dart | Generated mocks for viewmodel tests |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,13 @@ | |||
| import 'package:dotto/domain/github_profile.dart'; | |||
| import 'package:dotto/repository/github_contoributor_repository.dart'; | |||
Copilot
AI
Dec 25, 2025
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.
The import path contains a typo: "contoributor" should be "contributor".
| import 'package:dotto/repository/github_contoributor_repository.dart'; | |
| import 'package:dotto/repository/github_contributor_repository.dart'; |
| final GitHubContributorServiceProvider = Provider<GitHubContributorService>( | ||
| GitHubContributorService.new, | ||
| ); |
Copilot
AI
Dec 25, 2025
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.
Provider naming should follow Dart naming conventions. Variable names should use lowerCamelCase, not UpperCamelCase. This should be gitHubContributorServiceProvider instead of GitHubContributorServiceProvider.
| ).thenAnswer((_) async => testGitHubProfiles); | ||
|
|
||
| final container = createContainer(); | ||
| final service = container.read(githubContributionRepositoryProvider); |
Copilot
AI
Dec 25, 2025
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.
Inconsistent provider usage. Line 54 uses githubContributionRepositoryProvider which is the repository provider, but the test should be reading the service provider. This appears to be testing the repository directly instead of the service layer.
| final service = container.read(githubContributionRepositoryProvider); | |
| final service = container.read(GitHubContributorServiceProvider); |
| import 'github_contributor_viewmodel_test.mocks.dart'; | ||
|
|
||
| abstract interface class Listener<T> { | ||
| void call(T? previous, T next); |
Copilot
AI
Dec 25, 2025
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.
The signature for the Listener interface is inconsistent. The call method expects T next (non-nullable) but the mock implementation at line 58 uses T? next (nullable). This creates a mismatch between the interface and its implementation.
| throw Exception('Failed to get contributors'); | ||
| } | ||
|
|
||
| final data = response.data; | ||
| if (data == null || data is! List) { | ||
| throw Exception('Failed to get contributors'); |
Copilot
AI
Dec 25, 2025
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.
The error messages for different failure scenarios are identical, making debugging difficult. Consider providing more specific error messages for different cases: status code != 200 vs invalid response data structure.
| throw Exception('Failed to get contributors'); | |
| } | |
| final data = response.data; | |
| if (data == null || data is! List) { | |
| throw Exception('Failed to get contributors'); | |
| throw Exception( | |
| 'Failed to get contributors: HTTP ${response.statusCode}', | |
| ); | |
| } | |
| final data = response.data; | |
| if (data == null || data is! List) { | |
| throw Exception('Failed to get contributors: invalid response format'); |
| @@ -0,0 +1,46 @@ | |||
| import 'package:dotto/domain/github_profile.dart'; | |||
Copilot
AI
Dec 25, 2025
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.
The filename contains a typo: "contoributor" should be "contributor". This affects the import path used throughout the codebase.
| import 'package:dotto/domain/github_profile.dart'; | ||
| import 'package:dotto/feature/github_contributor/github_contributor_viewmodel.dart'; | ||
| import 'package:dotto/feature/github_contributor/github_contributor_viewstate.dart'; | ||
| import 'package:dotto/repository/github_contoributor_repository.dart'; |
Copilot
AI
Dec 25, 2025
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.
The import path contains a typo: "contoributor" should be "contributor".
| import 'package:dotto/repository/github_contoributor_repository.dart'; | |
| import 'package:dotto/repository/github_contributor_repository.dart'; |
| @@ -0,0 +1,98 @@ | |||
| import 'package:dotto/domain/github_profile.dart'; | |||
| import 'package:dotto/feature/github_contributor/github_contributor_service.dart'; | |||
| import 'package:dotto/repository/github_contoributor_repository.dart'; | |||
Copilot
AI
Dec 25, 2025
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.
The import path contains a typo: "contoributor" should be "contributor".
| import 'package:dotto/repository/github_contoributor_repository.dart'; | |
| import 'package:dotto/repository/github_contributor_repository.dart'; |
| @override | ||
| Future<List<GitHubProfile>> getContributors() async { | ||
| try { | ||
| final dio = Dio(); |
Copilot
AI
Dec 25, 2025
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.
A new Dio instance is created on every API call, which is inefficient and prevents proper configuration reuse (headers, timeouts, interceptors). The Dio instance should be injected as a dependency or created once and reused.
概要
やったこと
関連する Issue
確認したこと
UI 差分
コメント
メモ