Marge Feature/sonarqube sushan to main branch - #1
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR applies SonarQube-driven cleanup and small API simplifications in the electricity bill calculator, mainly by removing unused parameters/imports and improving naming consistency.
Changes:
- Simplified
ConsumerFactoryAPIs (isValidChoice,createConsumer) by removing unused parameters/generics and updated call sites accordingly. - Removed an unused import in
TariffRate. - Added an IntelliJ IDEA VCS mapping file for the project.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| OOP Mini Project/src/TariffRate.java | Removes an unused import. |
| OOP Mini Project/src/ElecBillCalculator.java | Updates calls to ConsumerFactory after API simplification. |
| OOP Mini Project/src/ConsumerFactory.java | Simplifies factory methods and renames helper class. |
| OOP Mini Project/.idea/vcs.xml | Adds IntelliJ VCS directory mapping configuration. |
Files not reviewed (1)
- OOP Mini Project/.idea/vcs.xml: Generated file
Comments suppressed due to low confidence (1)
OOP Mini Project/src/ConsumerFactory.java:23
ConsumerTypeHelperis a static-method-only helper. To align with common Java/SonarQube utility-class rules (prevent instantiation), make itfinaland add a private constructor.
class ConsumerTypeHelper {
static String getLabel(int choice) {
if (choice == 1) return "Standard Domestic";
return "Time-of-Use (TOU)";
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+3
to
+5
| public static Consumer createConsumer(int choice, String id, String name, double solar, | ||
| double totalUsage, double dayUsage, | ||
| double peakUsage, double offPeakUsage, | ||
| String planName, String tariffCode) { | ||
| double peakUsage, double offPeakUsage) { |
Collaborator
|
all of the committed changes are acceptable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix error and did some changes to best practice by using SonerQube plugin in IntelliJ IDEA.