Skip to content

Marge Feature/sonarqube sushan to main branch - #1

Merged
janinduprab merged 5 commits into
mainfrom
feature/sonarqube-sushan
Jun 16, 2026
Merged

Marge Feature/sonarqube sushan to main branch#1
janinduprab merged 5 commits into
mainfrom
feature/sonarqube-sushan

Conversation

@klsdfernando

Copy link
Copy Markdown
Owner

Fix error and did some changes to best practice by using SonerQube plugin in IntelliJ IDEA.

Copilot AI review requested due to automatic review settings June 16, 2026 11:19

Copilot AI left a comment

Copy link
Copy Markdown

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 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 ConsumerFactory APIs (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

  • ConsumerTypeHelper is a static-method-only helper. To align with common Java/SonarQube utility-class rules (prevent instantiation), make it final and 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) {
@janinduprab

Copy link
Copy Markdown
Collaborator

all of the committed changes are acceptable

@janinduprab
janinduprab merged commit 6d07397 into main Jun 16, 2026
1 check passed
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.

3 participants