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

SLVS-1433 Add credentials uri to the ServerConnection model #5660

Merged

Conversation

gabriela-trutan-sonarsource
Copy link
Contributor

@gabriela-trutan-sonarsource gabriela-trutan-sonarsource commented Sep 2, 2024

SLVS-1433

This PR targets this PR, because both of them are preparation for the server connection repository

{
public string OrganizationKey { get; } = organizationKey;
public const string Organizations = "organizations";

Choose a reason for hiding this comment

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

not sure if it was necessary to create a constant just for one usage

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am also referencing it in the tests. I think it is better to be a constant. If we ever update this, than it will also be updated in the tests

Choose a reason for hiding this comment

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

Should it be automatically updated in the tests? I get the argument for things like UI strings, but this feels like a value that should only change intentionally and we should strictly prohibit any unintentional changes to URIs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think anybody is changing "unintentionally" constants in code. But sure, I can make it hard-coded instead (although hard-coded strings are usually against clean code principles)

sonarCloud.ServerUri.Should().Be(new Uri("https://sonarcloud.io"));
sonarCloud.Settings.Should().BeSameAs(serverConnectionSettings);
sonarCloud.Credentials.Should().BeSameAs(credentials);
sonarCloud.CredentialsUri.Should().Be(new Uri(expectedServerUri, $"{SonarCloud.Organizations}/{sonarCloud.OrganizationKey}"));

Choose a reason for hiding this comment

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

this feels like a copy paste of the implementation. using a hardcoded string here could be safer

Base automatically changed from gt/delete-credentials to feature/new-connected-mode September 3, 2024 08:51
@gabriela-trutan-sonarsource gabriela-trutan-sonarsource marked this pull request as ready for review September 3, 2024 08:57
Copy link

sonarqubecloud bot commented Sep 3, 2024

@gabriela-trutan-sonarsource gabriela-trutan-sonarsource merged commit b546045 into feature/new-connected-mode Sep 3, 2024
2 checks passed
@gabriela-trutan-sonarsource gabriela-trutan-sonarsource deleted the gt/add-credentials-uri branch September 3, 2024 09:08
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