Skip to content
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

improve lint ci #160

Merged
merged 2 commits into from
Dec 24, 2024
Merged

improve lint ci #160

merged 2 commits into from
Dec 24, 2024

Conversation

cp-sidhdhi-p
Copy link
Collaborator

@cp-sidhdhi-p cp-sidhdhi-p commented Dec 24, 2024

Add Code Format in lint CI

Summary by CodeRabbit

  • New Features
    • Enhanced handling of Firebase and Google service configurations with new environment variables.
    • Added a button for adding team members in the TeamDetailMemberContent class.
  • Bug Fixes
    • Improved error handling in the HTTP request method to provide more context on failures.
  • Documentation
    • Updated ownership transfer logic in the MakeTeamAdminScreen for clarity.
  • Refactor
    • Improved readability and organization of various methods and constructors across multiple classes.
  • Style
    • Adjusted formatting and indentation for better code clarity in several files.
  • Chores
    • Minor updates including the addition of newlines and formatting changes for consistency.

Copy link

coderabbitai bot commented Dec 24, 2024

Walkthrough

This pull request encompasses a comprehensive set of changes across multiple files, primarily focusing on code formatting, minor logic refinements, and workflow configuration improvements. The modifications span GitHub Actions workflow configuration, Firebase service management, error handling in network requests, and various UI component and view model adjustments. The changes aim to enhance code readability, improve error reporting, and streamline configuration management without introducing significant functional alterations.

Changes

File Change Summary
.github/workflows/analyze.yml Added Firebase and Google service configuration environment variables, updated decoding commands, restructured linting process
data/lib/api/network/client.dart Enhanced error handling in req method to throw SomethingWentWrongError for non-successful HTTP responses
data/lib/service/auth/auth_service.dart Streamlined import organization, simplified callback function handling using null-aware call operator
Multiple files in data/, khelo/, and style/ Numerous formatting improvements, parameter alignment, and minor code style adjustments

Poem

🐰 Code flows like a river, neat and clean,
Formatting tweaks make our codebase serene
Workflows dance, errors take flight
With every change, our project shines bright!
Rabbit's code review: precise and light 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@cp-sidhdhi-p cp-sidhdhi-p force-pushed the sidhdhi/improve-lint-ci branch from fc47f84 to 6bb8427 Compare December 24, 2024 04:32
@cp-sidhdhi-p cp-sidhdhi-p marked this pull request as ready for review December 24, 2024 05:03
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (5)
khelo/lib/ui/flow/team/team_list_view_model.dart (1)

52-53: LGTM! Consider enhancing error logging.

The formatting change improves readability by breaking the stream chain into logical segments. While the error handling is comprehensive, consider enhancing the error logging to include stack traces for better debugging.

       }, onError: (e, stack) {
         state = state.copyWith(loading: false, error: e);
-        debugPrint("TeamListViewNotifier: error while loading team list -> $e");
+        debugPrint("TeamListViewNotifier: error while loading team list -> $e\n$stack");
       });
data/lib/service/auth/auth_service.dart (2)

73-73: Check if verificationId is needed elsewhere.
The verificationId is used for verifyOTP, but if you need it for custom logging or analytics, ensure you store it or dispatch it in a separate callback if needed.


75-75: Timeout callback verification.
The usage of onCodeAutoRetrievalTimeout preserves clarity through the null-aware call, but consider also logging or painting a UI message if the user is still waiting.

.github/workflows/analyze.yml (2)

22-24: Add quotes for base64 variables to adhere to shellcheck guidelines.
This helps prevent word splitting issues.

Apply the following diff:

- echo $GOOGLE_SERVICE_INFO_PLIST_BASE64 | base64 --decode > ios/Runner/GoogleService-Info.plist
- echo $FIREBASE_JSON_BASE64 | base64 --decode > firebase.json
- echo $GOOGLE_SERVICES_JSON_BASE64 | base64 --decode > android/app/google-services.json
+ echo "$GOOGLE_SERVICE_INFO_PLIST_BASE64" | base64 --decode > ios/Runner/GoogleService-Info.plist
+ echo "$FIREBASE_JSON_BASE64" | base64 --decode > firebase.json
+ echo "$GOOGLE_SERVICES_JSON_BASE64" | base64 --decode > android/app/google-services.json

27-27: Remove trailing spaces for YAML compliance.
Yamllint flagged trailing spaces on line 27; consider removing them to maintain a cleaner file.

- echo $FIREBASE_OPTIONS_BASE64 | base64 --decode > lib/firebase_options.dart··
+ echo $FIREBASE_OPTIONS_BASE64 | base64 --decode > lib/firebase_options.dart
🧰 Tools
🪛 yamllint (1.35.1)

[error] 27-27: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 243f5e8 and 6bb8427.

📒 Files selected for processing (27)
  • .github/workflows/analyze.yml (2 hunks)
  • data/lib/api/ball_score/ball_score_model.dart (1 hunks)
  • data/lib/api/leaderboard/leaderboard_model.dart (1 hunks)
  • data/lib/api/match_event/match_event_model.dart (1 hunks)
  • data/lib/api/network/client.dart (0 hunks)
  • data/lib/api/partnership/partnership_model.dart (2 hunks)
  • data/lib/service/auth/auth_service.dart (2 hunks)
  • data/lib/service/team/team_service.dart (1 hunks)
  • data/lib/storage/provider/preferences_provider.dart (3 hunks)
  • data/lib/utils/combine_latest.dart (1 hunks)
  • khelo/lib/components/country_code_view.dart (1 hunks)
  • khelo/lib/ui/flow/home/search/search_view_model.dart (1 hunks)
  • khelo/lib/ui/flow/matches/add_match/components/match_official_selection_view.dart (1 hunks)
  • khelo/lib/ui/flow/matches/add_match/components/over_detail_view.dart (1 hunks)
  • khelo/lib/ui/flow/matches/add_match/select_squad/components/user_detail_sheet.dart (1 hunks)
  • khelo/lib/ui/flow/matches/match_detail/components/match_detail_scorecard_view.dart (1 hunks)
  • khelo/lib/ui/flow/matches/match_list_view_model.dart (1 hunks)
  • khelo/lib/ui/flow/score_board/components/match_complete_sheet.dart (1 hunks)
  • khelo/lib/ui/flow/team/detail/components/team_detail_member_content.dart (0 hunks)
  • khelo/lib/ui/flow/team/detail/make_admin/make_team_admin_screen.dart (3 hunks)
  • khelo/lib/ui/flow/team/search_team/search_team_view_model.dart (1 hunks)
  • khelo/lib/ui/flow/team/team_list_screen.dart (1 hunks)
  • khelo/lib/ui/flow/team/team_list_view_model.dart (1 hunks)
  • khelo/lib/ui/flow/tournament/detail/components/match_group_tag.dart (1 hunks)
  • khelo/lib/ui/flow/tournament/team_selection/team_selection_view_model.dart (1 hunks)
  • style/lib/button/back_button.dart (1 hunks)
  • style/lib/callback/on_visible_callback.dart (1 hunks)
💤 Files with no reviewable changes (2)
  • data/lib/api/network/client.dart
  • khelo/lib/ui/flow/team/detail/components/team_detail_member_content.dart
✅ Files skipped from review due to trivial changes (19)
  • style/lib/callback/on_visible_callback.dart
  • khelo/lib/ui/flow/matches/match_list_view_model.dart
  • khelo/lib/ui/flow/matches/add_match/components/match_official_selection_view.dart
  • khelo/lib/ui/flow/tournament/team_selection/team_selection_view_model.dart
  • data/lib/api/ball_score/ball_score_model.dart
  • khelo/lib/ui/flow/tournament/detail/components/match_group_tag.dart
  • data/lib/api/leaderboard/leaderboard_model.dart
  • khelo/lib/ui/flow/home/search/search_view_model.dart
  • style/lib/button/back_button.dart
  • khelo/lib/components/country_code_view.dart
  • khelo/lib/ui/flow/score_board/components/match_complete_sheet.dart
  • khelo/lib/ui/flow/matches/match_detail/components/match_detail_scorecard_view.dart
  • khelo/lib/ui/flow/matches/add_match/components/over_detail_view.dart
  • data/lib/storage/provider/preferences_provider.dart
  • data/lib/service/team/team_service.dart
  • khelo/lib/ui/flow/team/team_list_screen.dart
  • data/lib/api/match_event/match_event_model.dart
  • khelo/lib/ui/flow/team/search_team/search_team_view_model.dart
  • data/lib/utils/combine_latest.dart
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/analyze.yml

25-25: shellcheck reported issue in this script: SC2086:info:2:6: Double quote to prevent globbing and word splitting

(shellcheck)


25-25: shellcheck reported issue in this script: SC2086:info:3:6: Double quote to prevent globbing and word splitting

(shellcheck)


25-25: shellcheck reported issue in this script: SC2086:info:4:6: Double quote to prevent globbing and word splitting

(shellcheck)


25-25: shellcheck reported issue in this script: SC2086:info:5:6: Double quote to prevent globbing and word splitting

(shellcheck)

🪛 yamllint (1.35.1)
.github/workflows/analyze.yml

[error] 27-27: trailing spaces

(trailing-spaces)

🔇 Additional comments (10)
khelo/lib/ui/flow/matches/add_match/select_squad/components/user_detail_sheet.dart (1)

19-19: Re-check parameter usage for onButtonTap.

Currently, the code shows “VoidCallback? onButtonTap” but the summary suggests that this parameter might have been changed to be “required”. Ensure consistent usage: if the parameter must always be provided, consider reinforcing it in both the constructor and the static show method signatures. If optional usage is intentional, ensure callers are properly handling cases where it’s null.

data/lib/api/partnership/partnership_model.dart (2)

29-31: Better readability with multiline formatting.

No functional changes were introduced in this part. Splitting the parameters into multiple lines makes the code more readable and consistent with the rest of the file, so this improvement is beneficial.


48-48: Newline at the end of file.

Having a newline at the end of the file is a common best practice to maintain consistency and potentially avoid issues with certain tooling.

khelo/lib/ui/flow/team/detail/make_admin/make_team_admin_screen.dart (3)

125-125: Verify the ownership logic in the ternary condition.

Currently, if the created_by_user.id differs from the state.owner.id, it displays a "remove ownership" title, whereas matching IDs display a "transfer ownership" title. Make sure this reflects the intended flow—i.e., removing ownership from other users vs. transferring from oneself.


137-138: Minor consistency check for empty screen title.

Using ‘common_transfer_ownership’ for the empty screen title aligns well with the ownership transfer context. This looks good; just ensure that all localized text references remain consistent throughout the app.


165-165: Smooth alignment of the owner label.

Displaying "Owner" here appears consistent with the rest of the UI labels. Good use of the existing localization key for better readability and consistency.

data/lib/service/auth/auth_service.dart (3)

4-4: Verify consistently using Riverpod across the auth flow.
The added import for flutter_riverpod is good, but ensure that the rest of this file also follows a consistent pattern of interacting with providers and notifiers.


63-68: Good use of null-aware callback invocation.
This concise approach avoids conditional checks and keeps the code clean.


71-71: Ensure the error structure is unaltered when re-thrown.
Your usage of AppError.fromError(e, e.stackTrace) properly captures the exception details. Confirm that the stack trace is preserved in the final error report, as some wrappers may discard backtrace info.

.github/workflows/analyze.yml (1)

41-52: Great enhancement of the lint process by adding code formatting checks.
Running “dart format . --set-exit-if-changed” before “dart analyze --fatal-infos” ensures code style consistency. If you prefer a more consolidated approach, consider grouping these commands into a single job step or script for each directory.

@cp-sidhdhi-p cp-sidhdhi-p merged commit af0c815 into main Dec 24, 2024
2 checks passed
@cp-sidhdhi-p cp-sidhdhi-p deleted the sidhdhi/improve-lint-ci branch December 24, 2024 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants