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

FEATURE: Allow external set of MaxFileSizeInKilobytes #2578

Merged
merged 1 commit into from
Nov 29, 2022

Conversation

shaopeng-gh
Copy link
Collaborator

The SDK user https://github.com/microsoft/sarif-website is not able to set the MaxFileSizeInKilobytes.
It is limited to 1024KB.
With this enabled, SDK users should be able to set it as needed.
e.g.

var validateOptions = new ValidateOptions
                {
                    OutputFilePath = outputFilePath,
                    Force = true,
                    PrettyPrint = true,
                    Level = new FailureLevel[] {
                        FailureLevel.Error, FailureLevel.Warning, FailureLevel.Note
                    },
                    Kind = new ResultKind[] {
                        ResultKind.Fail, ResultKind.Informational, ResultKind.NotApplicable, ResultKind.Open, ResultKind.Open, ResultKind.Pass, ResultKind.Review
                    },
                    ConfigurationFilePath = configFilePath,
                    TargetFileSpecifiers = new string[] { inputFilePath },
                    // MaxFileSizeInKilobytes = XXX,
                };

@shaopeng-gh shaopeng-gh changed the title * FEATURE: Allow external set of MaxFileSizeInKilobytes FEATURE: Allow external set of MaxFileSizeInKilobytes Nov 17, 2022
@@ -119,6 +119,6 @@ public abstract class AnalyzeOptionsBase : CommonOptionsBase
"max-file-size-in-kb",
HelpText = "The maximum file size (in kilobytes) that will be analyzed.",
Default = 1024)]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

1024

I also have a question here, we probably have a context so we added this parameter.

The other way is,
unless user specifically limit it, we don't put limit.
If so the default can be int.Max.

Or a reasonable bigger default value like 128MB.

Let me know if you like to change it and what value I can update the PR.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think changing the default would be a breaking change. So perhaps just making the setter public is the right fix.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think changing the default would be a breaking change --- Yes!

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:

@michaelcfanning michaelcfanning merged commit 3fa7f43 into main Nov 29, 2022
@michaelcfanning michaelcfanning deleted the users/shaopeng-gh/allowchangesizelimit branch November 29, 2022 21:57
This was referenced Feb 21, 2023
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.

None yet

3 participants