Skip to content

CI CD test#58

Merged
devikasuresh20 merged 14 commits intoPSMRI:developfrom
ravishanigarapu:develop
Nov 25, 2024
Merged

CI CD test#58
devikasuresh20 merged 14 commits intoPSMRI:developfrom
ravishanigarapu:develop

Conversation

@ravishanigarapu
Copy link
Copy Markdown
Contributor

@ravishanigarapu ravishanigarapu commented Nov 25, 2024

📋 Description

JIRA ID:

Please provide a summary of the change and the motivation behind it. Include relevant context and details.


✅ Type of Change

  • 🐞 Bug fix (non-breaking change which resolves an issue)
  • New feature (non-breaking change which adds functionality)
  • 🔥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 🛠 Refactor (change that is neither a fix nor a new feature)
  • ⚙️ Config change (configuration file or build script updates)
  • 📚 Documentation (updates to docs or readme)
  • 🧪 Tests (adding new or updating existing tests)
  • 🎨 UI/UX (changes that affect the user interface)
  • 🚀 Performance (improves performance)
  • 🧹 Chore (miscellaneous changes that don't modify src or test files)

ℹ️ Additional Information

Please describe how the changes were tested, and include any relevant screenshots, logs, or other information that provides additional context.

Summary by CodeRabbit

  • Chores
    • Updated dependency management approach in the ANC service, transitioning to method-based injection for certain services.
    • Commented out the setter method for ancDoctorServiceImpl, indicating a potential change in its management.

These changes ensure the service continues to function as intended while refining the dependency resolution process.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Nov 25, 2024

Walkthrough

The changes in the ANCServiceImpl class focus on modifying the dependency injection approach for service components. The @Autowired annotations have been removed from the fields ancDoctorServiceImpl, commonNurseServiceImpl, and commonDoctorServiceImpl, transitioning to method-based injection by adding @Autowired annotations to their respective setter methods. The previous setter method for ancDoctorServiceImpl has been commented out, indicating a change in its management. The overall functionality and structure of the service methods remain unchanged.

Changes

File Path Change Summary
src/main/java/com/iemr/mmu/service/anc/ANCServiceImpl.java Removed @Autowired from fields ancDoctorServiceImpl, commonNurseServiceImpl, and commonDoctorServiceImpl; added @Autowired to their setter methods; commented out previous setter for ancDoctorServiceImpl.

Poem

In the service of ANC, changes take flight,
With setters now shining, dependencies bright.
No more fields for the nurse and the doc,
Method-based magic, like a ticking clock.
Oh, how we hop with joy and delight,
In the code's new dance, everything feels right! 🐇✨

Warning

Rate limit exceeded

@ravishanigarapu has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 22 minutes and 17 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between d9ca13b and 30adf4f.


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 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.

Copy link
Copy Markdown

@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: 1

🧹 Outside diff range and nitpick comments (2)
src/main/java/com/iemr/mmu/service/anc/ANCServiceImpl.java (2)

100-102: Good architectural improvement moving from field to setter injection!

Moving from field-level @Autowired to setter injection is a better practice as it:

  • Makes dependencies more explicit and easier to manage
  • Improves testability by allowing mock injection
  • Follows Spring's recommended approach for dependency injection

Line range hint 1-1000: Consider further architectural improvements

While the dependency injection changes are good, there are several architectural improvements that could be made:

  1. The class has too many responsibilities and dependencies, violating the Single Responsibility Principle
  2. Methods like saveANCDoctorData and updateANCDoctorData are very long and handle multiple concerns
  3. Error handling could be more consistent and centralized

Consider:

  1. Breaking down the class into smaller, focused services
  2. Extracting common validation and error handling logic
  3. Using builder pattern for complex object construction
  4. Adding comprehensive logging for better monitoring
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between b24b978 and b796957.

📒 Files selected for processing (1)
  • src/main/java/com/iemr/mmu/service/anc/ANCServiceImpl.java (2 hunks)

Comment on lines +128 to +132
@Autowired
public void setANCDoctorServiceImpl(ANCDoctorServiceImpl ancDoctorServiceImpl) {
this.ancDoctorServiceImpl = ancDoctorServiceImpl;
}
*/
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

Inconsistent dependency injection pattern for ancDoctorServiceImpl

The setter method is commented out but the field still has @Autowired annotation. This creates an inconsistency in the dependency injection approach:

  • ancDoctorServiceImpl is still using field injection while other dependencies moved to setter injection
  • This mixed approach could cause confusion and maintenance issues

Consider either:

  1. Keeping the setter method and removing field-level @Autowired:
-@Autowired
private ANCDoctorServiceImpl ancDoctorServiceImpl;

-/*
@Autowired
public void setANCDoctorServiceImpl(ANCDoctorServiceImpl ancDoctorServiceImpl) {
    this.ancDoctorServiceImpl = ancDoctorServiceImpl;
}
-*/
  1. Or document why this specific dependency needs a different injection approach

Committable suggestion skipped: line range outside the PR's diff.

Copy link
Copy Markdown

@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

🧹 Outside diff range and nitpick comments (3)
src/main/java/com/iemr/mmu/service/anc/ANCServiceImpl.java (3)

98-102: Consider using constructor injection instead of setter injection.

While moving from field injection to setter injection is an improvement, constructor injection would be even better as it:

  • Makes dependencies explicit and required
  • Ensures immutability
  • Makes testing easier by enforcing dependency provision at instantiation time

Example refactor:

-private ANCDoctorServiceImpl ancDoctorServiceImpl;
-private CommonNurseServiceImpl commonNurseServiceImpl;
-private CommonDoctorServiceImpl commonDoctorServiceImpl;

-@Autowired
-public void setANCDoctorServiceImpl(ANCDoctorServiceImpl ancDoctorServiceImpl) {
-    this.ancDoctorServiceImpl = ancDoctorServiceImpl;
-}

+private final ANCDoctorServiceImpl ancDoctorServiceImpl;
+private final CommonNurseServiceImpl commonNurseServiceImpl;
+private final CommonDoctorServiceImpl commonDoctorServiceImpl;

+@Autowired
+public ANCServiceImpl(ANCDoctorServiceImpl ancDoctorServiceImpl,
+                     CommonNurseServiceImpl commonNurseServiceImpl,
+                     CommonDoctorServiceImpl commonDoctorServiceImpl) {
+    this.ancDoctorServiceImpl = ancDoctorServiceImpl;
+    this.commonNurseServiceImpl = commonNurseServiceImpl;
+    this.commonDoctorServiceImpl = commonDoctorServiceImpl;
+}

Also applies to: 128-131


127-127: Remove commented out code.

Commented out code should be removed as it:

  • Adds noise to the codebase
  • Can become outdated and misleading
  • Is still available in version control if needed

Line range hint 98-131: Update PR title and description to reflect actual changes.

The PR title "CI CD test" and empty description don't match the actual code changes which focus on improving dependency injection patterns. Please:

  1. Update the PR title to something like "Refactor: Improve dependency injection in ANCServiceImpl"
  2. Fill out the PR description explaining:
    • What changes were made
    • Why the changes were made
    • How the changes were tested
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between b796957 and d9ca13b.

📒 Files selected for processing (1)
  • src/main/java/com/iemr/mmu/service/anc/ANCServiceImpl.java (2 hunks)

private ANCNurseServiceImpl ancNurseServiceImpl;
// private NurseServiceImpl nurseServiceImpl;
@Autowired
//@Autowired
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pls remove commented lines.

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown

@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: 1

🧹 Outside diff range and nitpick comments (1)
src/main/java/com/iemr/mmu/service/anc/ANCServiceImpl.java (1)

123-123: Remove commented code block

The commented code block for setter methods should be removed as it's no longer needed and adds unnecessary clutter.

Apply this diff to remove the commented code:

-/*	@Autowired
-	public void setLabTechnicianServiceImpl(LabTechnicianServiceImpl labTechnicianServiceImpl) {
-		this.labTechnicianServiceImpl = labTechnicianServiceImpl;
-	}
-
-	@Autowired
-	public void setCommonBenStatusFlowServiceImpl(CommonBenStatusFlowServiceImpl commonBenStatusFlowServiceImpl) {
-		this.commonBenStatusFlowServiceImpl = commonBenStatusFlowServiceImpl;
-	}
-*/
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d9ca13b and 30adf4f.

📒 Files selected for processing (1)
  • src/main/java/com/iemr/mmu/service/anc/ANCServiceImpl.java (1 hunks)

Comment on lines +124 to +127
@Autowired
public void setANCDoctorServiceImpl(ANCDoctorServiceImpl ancDoctorServiceImpl) {
this.ancDoctorServiceImpl = ancDoctorServiceImpl;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codebase verification

Based on the code shown in the file content, I can generate the final response:

Dependency injection pattern needs review

The class shows inconsistent dependency injection patterns:

  • Some dependencies use field-level @Autowired injection (e.g. ancNurseServiceImpl, commonBenStatusFlowServiceImpl)
  • Only a few dependencies use setter injection with @Autowired
  • Some commented out setter methods indicate incomplete refactoring
🔗 Analysis chain

Verify dependency injection consistency

The dependency injection pattern has been updated to use setter injection with @Autowired annotation. This is consistent with the changes mentioned in the AI summary and aligns with the other setter methods in the class.

Let's verify the dependency injection pattern consistency across the class:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining field-level @Autowired annotations
# and verify setter injection pattern consistency

rg -A 1 "@Autowired\s+private" src/main/java/com/iemr/mmu/service/anc/ANCServiceImpl.java

# Check for setter methods with @Autowired
rg -A 3 "@Autowired\s+public void set" src/main/java/com/iemr/mmu/service/anc/ANCServiceImpl.java

Length of output: 191


Script:

#!/bin/bash
# Let's try to get the full content of the file to analyze the dependency injection patterns
cat src/main/java/com/iemr/mmu/service/anc/ANCServiceImpl.java

# As a backup, let's also search for any @Autowired annotations with more flexible pattern
rg "@Autowired" src/main/java/com/iemr/mmu/service/anc/ANCServiceImpl.java

Length of output: 75843


Script:

#!/bin/bash
# Let's check for all setter injection methods in the class to verify consistency
ast-grep --pattern $'@Autowired\s+public void set$_($_ $_) {\s+$$$\s+}'

# Also check for field level injections to see what's not using setter injection
ast-grep --pattern $'@Autowired\s+private $_ $_;\s+'

Length of output: 126

@devikasuresh20 devikasuresh20 merged commit e065cb4 into PSMRI:develop Nov 25, 2024
@coderabbitai coderabbitai Bot mentioned this pull request Apr 7, 2025
10 tasks
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