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

sonarcloud bug complain fix #8

Merged
merged 3 commits into from
Sep 14, 2023
Merged

sonarcloud bug complain fix #8

merged 3 commits into from
Sep 14, 2023

Conversation

jpikora-iov
Copy link
Contributor

No description provided.

@jpikora-iov jpikora-iov requested a review from a team as a code owner September 12, 2023 11:16
@@ -281,14 +281,14 @@ describe('RSK Federation change', function() {
await checkFederationAddedNewKeys();
var addResult = await rskClientOldFed.rsk.bridge.methods.addFederatorPublicKeyMultikey('0xaabb', '0xccdd', '0xeeff').call({ from: getRandomFedChangeAddress() });
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
var addResult = await rskClientOldFed.rsk.bridge.methods.addFederatorPublicKeyMultikey('0xaabb', '0xccdd', '0xeeff').call({ from: getRandomFedChangeAddress() });
const addResultFirstCall = await rskClientOldFed.rsk.bridge.methods.addFederatorPublicKeyMultikey('0xaabb', '0xccdd', '0xeeff').call({ from: getRandomFedChangeAddress() });
expect(Number(addResult)).to.equal(1); // First call successful

Sonar is complaining because you declare this variable here but never use it, then declare it again as const.

I think the point of the test is to make the call twice, and check that the second time it fails. So we could also check the result of the first call

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ohh i fixed it before i read this comment, hope my naming is ok for you :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Naming is fine, but I would change it to const and also assert the result the first time

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm i'm not sure i understand, the assert was always there...
expect(Number(addKeysResult)).to.equal(-10); // not a public key

await rskClientOldFed.rsk.bridge.methods.addFederatorPublicKeyMultikey(

const addResult = await rskClientOldFed.rsk.bridge.methods.addFederatorPublicKeyMultikey(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
const addResult = await rskClientOldFed.rsk.bridge.methods.addFederatorPublicKeyMultikey(
const addResultSecondCall = await rskClientOldFed.rsk.bridge.methods.addFederatorPublicKeyMultikey(

@jpikora-iov
Copy link
Contributor Author

pipeline: run

jeremy-then
jeremy-then previously approved these changes Sep 12, 2023
Copy link
Contributor

@jeremy-then jeremy-then left a comment

Choose a reason for hiding this comment

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

LGTM.

@sonarcloud
Copy link

sonarcloud bot commented Sep 13, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

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

No Coverage information No Coverage information
0.0% 0.0% Duplication

@jpikora-iov jpikora-iov merged commit b5a285a into main Sep 14, 2023
4 checks passed
@jpikora-iov jpikora-iov deleted the bug/04_00_02_fedchange branch September 14, 2023 05:01
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.

4 participants