Skip to content

Conversation

@martinrrm
Copy link
Contributor

Bug

Fixes: https://github.com/NuGet/Client.Engineering/issues/1170

Regression? Last working version:

Description

Removing suppressions for CA1305, I'm also changing the rule action to be Warning but this is causing some error on ReadOnly files, I added file suppressions for these ones since I cannot modify them.

PR Checklist

  • PR has a meaningful title

  • PR has a linked issue.

  • Described changes

  • Tests

    • Automated tests added
    • OR
    • Test exception
    • OR
    • N/A
  • Documentation

    • Documentation PR or issue filled
    • OR
    • N/A

@martinrrm martinrrm requested a review from a team as a code owner August 11, 2022 17:07
Copy link
Contributor

@dominoFire dominoFire left a comment

Choose a reason for hiding this comment

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

Some comments to start.

@martinrrm martinrrm requested a review from dominoFire August 12, 2022 17:40
@martinrrm
Copy link
Contributor Author

@dominoFire With your comment, I looked again at the changes and updated some of the suppressions to InvariantCulture when it is about URLs

_solutionEvents.ProjectRenamed += OnEnvDTEProjectRenamed;

var vSStd97CmdIDGUID = VSConstants.GUID_VSStandardCommandSet97.ToString("B", CultureInfo.CurrentCulture);
var vSStd97CmdIDGUID = VSConstants.GUID_VSStandardCommandSet97.ToString("B", CultureInfo.InvariantCulture);
Copy link
Member

Choose a reason for hiding this comment

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

I left a comment in a previous PR after it had been merged (mb), I think we should ignore the warnings raised for Guid ToString as this has the potential to break eeventually.

Copy link
Contributor Author

@martinrrm martinrrm Aug 16, 2022

Choose a reason for hiding this comment

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

I thought you mean to change it to InvariantCulture but I can add the suppressions for this. Or I can pass null to the method call. https://docs.microsoft.com/en-us/dotnet/api/system.guid.tostring?view=net-6.0#system-guid-tostring(system-string-system-iformatprovider)

Copy link
Member

Choose a reason for hiding this comment

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

null's fine if we mean to avoid the warning

Copy link
Contributor

@dominoFire dominoFire left a comment

Choose a reason for hiding this comment

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

More partial review, 60% review left.

nkolev92
nkolev92 previously approved these changes Aug 25, 2022
Copy link
Member

@nkolev92 nkolev92 left a comment

Choose a reason for hiding this comment

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

That's a lot of changes :D

Good job getting all tedious work done.

@martinrrm martinrrm force-pushed the dev-martinrrm-remove-CA1305-suppresions-part3 branch from 14aaa04 to cefb350 Compare August 30, 2022 17:01
Copy link
Contributor

@dominoFire dominoFire left a comment

Choose a reason for hiding this comment

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

Good job! Some comments on cases where it could be better to use InvariantCulture

for (int i = 0; i < 10000; i++)
{
sb.AppendLine(i.ToString());
sb.AppendLine(i.ToString(CultureInfo.CurrentCulture));
Copy link
Contributor

Choose a reason for hiding this comment

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

You can append the integer directly

Suggested change
sb.AppendLine(i.ToString(CultureInfo.CurrentCulture));
sb.AppendLine(i);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately, AppendLine only accepts a string

if (flags == SignatureVerificationStatusFlags.NoErrors)
{
issues.Add(SignatureLog.InformationLog(string.Format(CultureInfo.CurrentCulture, Strings.TimestampValue, GeneralizedTime.LocalDateTime.ToString()) + Environment.NewLine));
issues.Add(SignatureLog.InformationLog(string.Format(CultureInfo.CurrentCulture, Strings.TimestampValue, GeneralizedTime.LocalDateTime.ToString(CultureInfo.CurrentCulture)) + Environment.NewLine));
Copy link
Contributor

Choose a reason for hiding this comment

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

There seems no behavior change. I think this is expected?
string.Format(CultureInfo.CurrentCulture, s1, dateTime.ToString()) is equal to
string.Format(CultureInfo.CurrentCulture, s1, dateTime.ToString(CultureInfo.CurrentCulture)), right?

@ghost ghost added the Status:No recent activity PRs that have not had any recent activity and will be closed if the label is not removed label Sep 7, 2022
@ghost
Copy link

ghost commented Sep 7, 2022

This PR has been automatically marked as stale because it has no activity for 7 days. It will be closed if no further activity occurs within another 7 days of this comment. If it is closed, you may reopen it anytime when you're ready again, as long as you don't delete the branch.

@ghost ghost removed the Status:No recent activity PRs that have not had any recent activity and will be closed if the label is not removed label Sep 7, 2022
@martinrrm martinrrm requested a review from dominoFire September 7, 2022 18:08
@martinrrm martinrrm force-pushed the dev-martinrrm-remove-CA1305-suppresions-part3 branch from ea7320d to 39e83fc Compare September 7, 2022 18:08
@martinrrm martinrrm merged commit ee9ef1f into dev Sep 7, 2022
@martinrrm martinrrm deleted the dev-martinrrm-remove-CA1305-suppresions-part3 branch September 7, 2022 21:58
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.

6 participants