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

Fix #1629: Page command shouldn't throw on options error. #1654

Merged
2 commits merged into from
Aug 21, 2019

Conversation

ghost
Copy link

@ghost ghost commented Aug 19, 2019

There's a big comment in PageCommandTests.cs that explains the rationale for the change (the comment is there because it's also the rationale for why I arranged the tests as I did), so I won't reproduce it here. See also the description of Issue #1629.


if (optionValue < 0)
{
string optionDescription = CommandUtilities.GetOptionDescription<T>(optionName);
Copy link
Author

@ghost ghost Aug 19, 2019

Choose a reason for hiding this comment

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

CommandUtilities [](start = 43, length = 16)

I have another PR out that moves this method into DriverUtilities, so whoever gets in second will have a small merge conflict to resolve. #Pending


// Load the JsonMap, if previously built and up-to-date, or rebuild it
JsonMapNode root = LoadOrRebuildMap(options);

// Write the desired page from the Sarif file
ExtractPage(options, root);

return 1;
return 0;
Copy link
Author

@ghost ghost Aug 19, 2019

Choose a reason for hiding this comment

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

0 [](start = 19, length = 1)

This was just a bug :-) #ByDesign

@@ -50,7 +50,7 @@ internal class PageOptions
"force",
Default = true,
HelpText = "Force overwrite of output file if it exists.")]
public bool Force { get; set; } = true;
Copy link
Author

@ghost ghost Aug 19, 2019

Choose a reason for hiding this comment

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

There is a bug #1630, "Multitool page command --force defaults to true and can't be changed". This change does not fix that bug!

Rather, this change makes it easier to write my new unit tests in PageCommandTests. Without this change, I had to explicitly set Force = false in every one of my test cases except for the single case where Force needed to be true.

It makes sense to remove this initialization; I don't think there's a single other property in any of the options classes that's initialized like this. It also makes sense to fix #1630 by removing the Default = true on line 51, but I don't want to do that in this PR because it's a command line behavior change and I want to validate it with you first.

Note that with Default = true, not only do I think it's the wrong default, but there's no way to specify the value "false" on the command line! There's nothing like PowerShell's -mySwitch:false syntax to turn it off. #ByDesign

@ghost
Copy link
Author

ghost commented Aug 19, 2019

@michaelcfanning is added to the review. #Closed

@ghost
Copy link
Author

ghost commented Aug 19, 2019

@rtaket is added to the review. #Closed

@ghost
Copy link
Author

ghost commented Aug 19, 2019

@harleenkohli is added to the review. #Closed

@ghost
Copy link
Author

ghost commented Aug 19, 2019

@SurbhiMS is added to the review. #Closed

@ghost
Copy link
Author

ghost commented Aug 20, 2019

@cfaucon is added to the review. #Closed

Copy link
Member

@michaelcfanning michaelcfanning left a comment

Choose a reason for hiding this comment

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

:shipit:

@ghost ghost merged commit eb34625 into master Aug 21, 2019
@ghost ghost deleted the users/lgolding/bug-1629 branch August 21, 2019 15:35
This pull request was closed.
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.

1 participant