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

Discard phase control if controlled branch is null or open #177

Merged
merged 3 commits into from
Dec 7, 2020

Conversation

annetill
Copy link
Member

@annetill annetill commented Dec 3, 2020

Signed-off-by: Anne Tilloy anne.tilloy@rte-france.com

Please check if the PR fulfills these requirements (please use '[x]' to check the checkboxes, or submit the PR and then click the checkboxes)

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Does this PR already have an issue describing the problem ? If so, link to this issue using '#XXX' and skip the rest

No check is done.

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

Two checks have been added and in case of null controlled branch or open controlled branch, the phase control is not created.

What is the current behavior? (You can also link to an open issue here)

What is the new behavior (if this is a feature change)?

Does this PR introduce a breaking change or deprecate an API? If yes, check the following:

  • The Breaking Change or Deprecated label has been added
  • The migration guide has been updated in the github wiki (What changes might users need to make in their application due to this PR?)

Other information:

(if any of the questions/checkboxes don't apply, please delete them entirely)

Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
@annetill annetill requested a review from flo-dup December 3, 2020 16:02
annetill and others added 2 commits December 4, 2020 15:50
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 4, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

LOGGER.warn("Phase controlled branch {} is null: no phase control created", controlledBranchId);
return;
}
if (controlledBranch.getBus1() == null || controlledBranch.getBus2() == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this check really useful? It seems equivalent to the one at line 265 ptc.getRegulationTerminal().getBusView().getBus() == null. In the tests at least there's no counterexample. Thus we never go through the line 266 anymore in the tests.

Copy link
Member Author

Choose a reason for hiding this comment

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

The controlled branch could be open at one side: it could be the side of the regulating terminal or the other one.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok. But then we should remove the test of line 265 which is useless. And it would be maybe better to add such a test of a null branch on the other side? Indeed if I comment out the lines 256-259 all tests stay passed, which shows that when it's null it's always on the regulating side.

@annetill annetill merged commit 9580c42 into master Dec 7, 2020
@annetill annetill deleted the branch-phase-controlled branch December 7, 2020 10:41
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