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

(fix) Cleanup unused imports across the project #1174

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Asbeiru
Copy link
Contributor

@Asbeiru Asbeiru commented Jan 16, 2025

Problem

This PR removes unused import statements across the SOFA-JRaft codebase. These unused imports were identified using IntelliJ IDEA's "Inspect Code" tool. Removing these imports helps improve code readability and maintainability without affecting functionality.

Changes

The following files were updated to remove unused imports:

  1. AbstractClientService.java

    • Line 48: import com.alipay.sofa.jraft.util.Utils;
  2. AtomicStateMachine.java

    • Line 50: import com.alipay.sofa.jraft.util.Utils;
  3. BoltRpcServer.java

    • Line 25: import com.alipay.remoting.config.switches.GlobalSwitch;
  4. ClosureQueueTest.java

    • Line 23: import com.alipay.sofa.jraft.util.ThreadPoolsFactory;
    • Line 24: import com.codahale.metrics.MetricRegistry;
  5. IteratorTest.java

    • Line 24: import org.junit.After;
  6. ReadOnlyServiceImpl.java

    • Line 32: import com.alipay.sofa.jraft.entity.EnumOutter;
  7. ThreadPoolsFactoryTest.java

    • Line 24: import org.junit.Before;
  8. UtilsTest.java

    • Line 20: import java.util.concurrent.CountDownLatch;
    • Line 25: import com.alipay.sofa.jraft.Closure;
    • Line 26: import com.alipay.sofa.jraft.Status;
    • Line 27: import com.alipay.sofa.jraft.error.RaftError;
    • Line 30: import static org.junit.Assert.assertFalse;
    • Line 32: import static org.junit.Assert.assertTrue;

Verification

  • Verified locally by running mvn clean compile and mvn clean test.
  • Confirmed no build or test failures after the changes.

Related Issue

Fixes #1173

Summary by CodeRabbit

  • Refactor
    • Removed unused import statements across multiple files in the JRaft project
    • Cleaned up unnecessary class imports in core, test, and utility classes
    • Simplified import management without changing core functionality

@sofastack-cla sofastack-cla bot added bug Something isn't working cla:yes size/S labels Jan 16, 2025
Copy link
Contributor

coderabbitai bot commented Jan 16, 2025

Walkthrough

This pull request focuses on cleaning up unused import statements across multiple files in the JRaft project. The changes involve removing import statements that are not being used in their respective Java files, which helps improve code readability and reduces unnecessary dependencies. The modifications span several files in the jraft-core and jraft-test modules, targeting test and implementation classes.

Changes

File Change Summary
jraft-core/src/main/java/com/alipay/sofa/jraft/core/ReadOnlyServiceImpl.java Removed import for EnumOutter
jraft-core/src/main/java/com/alipay/sofa/jraft/rpc/impl/AbstractClientService.java Removed import for Utils
jraft-core/src/main/java/com/alipay/sofa/jraft/rpc/impl/BoltRpcServer.java Removed import for GlobalSwitch
jraft-core/src/test/java/com/alipay/sofa/jraft/closure/ClosureQueueTest.java Removed imports for ThreadPoolsFactory and MetricRegistry
jraft-core/src/test/java/com/alipay/sofa/jraft/core/IteratorTest.java Removed import for org.junit.After
jraft-core/src/test/java/com/alipay/sofa/jraft/util/ThreadPoolsFactoryTest.java Removed import for org.junit.Before
jraft-core/src/test/java/com/alipay/sofa/jraft/util/UtilsTest.java Removed multiple unused imports
jraft-test/src/main/java/com/alipay/sofa/jraft/test/atomic/server/AtomicStateMachine.java Removed import for Utils

Assessment against linked issues

Objective Addressed Explanation
Remove unused imports in specified files [#1173]
Verify changes by compiling and testing Requires manual verification

Possibly related PRs

Suggested labels

size/XS, cla:no, First-time contributor

Suggested reviewers

  • fengjiachun

Poem

🐰 Imports dancing, now they're gone
Cleaner code, a fresh new dawn
No more clutter, just pure delight
JRaft's codebase, now shining bright!
Hop, hop, hooray for clean code today! 🌟


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9029048 and c572af8.

📒 Files selected for processing (8)
  • jraft-core/src/main/java/com/alipay/sofa/jraft/core/ReadOnlyServiceImpl.java (0 hunks)
  • jraft-core/src/main/java/com/alipay/sofa/jraft/rpc/impl/AbstractClientService.java (0 hunks)
  • jraft-core/src/main/java/com/alipay/sofa/jraft/rpc/impl/BoltRpcServer.java (0 hunks)
  • jraft-core/src/test/java/com/alipay/sofa/jraft/closure/ClosureQueueTest.java (0 hunks)
  • jraft-core/src/test/java/com/alipay/sofa/jraft/core/IteratorTest.java (0 hunks)
  • jraft-core/src/test/java/com/alipay/sofa/jraft/util/ThreadPoolsFactoryTest.java (0 hunks)
  • jraft-core/src/test/java/com/alipay/sofa/jraft/util/UtilsTest.java (1 hunks)
  • jraft-test/src/main/java/com/alipay/sofa/jraft/test/atomic/server/AtomicStateMachine.java (0 hunks)
💤 Files with no reviewable changes (7)
  • jraft-core/src/test/java/com/alipay/sofa/jraft/core/IteratorTest.java
  • jraft-core/src/test/java/com/alipay/sofa/jraft/closure/ClosureQueueTest.java
  • jraft-core/src/main/java/com/alipay/sofa/jraft/core/ReadOnlyServiceImpl.java
  • jraft-test/src/main/java/com/alipay/sofa/jraft/test/atomic/server/AtomicStateMachine.java
  • jraft-core/src/main/java/com/alipay/sofa/jraft/rpc/impl/BoltRpcServer.java
  • jraft-core/src/test/java/com/alipay/sofa/jraft/util/ThreadPoolsFactoryTest.java
  • jraft-core/src/main/java/com/alipay/sofa/jraft/rpc/impl/AbstractClientService.java
✅ Files skipped from review due to trivial changes (1)
  • jraft-core/src/test/java/com/alipay/sofa/jraft/util/UtilsTest.java
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: test_storage_java_impl
  • GitHub Check: test_rheakv_pd
  • GitHub Check: test_rpc_grpc_impl
  • GitHub Check: test_jraft_core
  • GitHub Check: test_rheakv_core

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cla:yes size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal: Cleanup unused imports across the project
1 participant