Giter Club home page Giter Club logo

Comments (3)

michaelcfanning avatar michaelcfanning commented on July 22, 2024

?. In this case, context.FailureLevels should be set properly and used in the Initialize method, correct? I thought you'd found a bug in our context override logic and wrote the beginning of a test for this scenario, but it doesn't fail.

microsoft/sarif-sdk#2707

from binskim.

shaopeng-gh avatar shaopeng-gh commented on July 22, 2024

@michaelcfanning

image

See comment with "Shaopeng" below:

// First, we initialize data values that impact loggers, so that we can
            // pass accurate values to the console logger.
            context.Quiet = options.Quiet != null ? options.Quiet.Value : context.Quiet;
            context.ResultKinds = options.Kind != null ? options.ResultKinds : context.ResultKinds;
            context.FailureLevels = options.Level != null ? options.FailureLevels : context.FailureLevels;
// Shaopeng: here we override with command line, we now will have Note, but it is too early.

            // We initialize a temporary console logger that's used strictly to emit
            // diagnostics output while we load/initialize various configurations settings.
            IAnalysisLogger savedLogger = context.Logger;
            context.Logger = new ConsoleLogger(quietConsole: true,
                                               levels: BaseLogger.ErrorWarningNote,
                                               kinds: BaseLogger.Fail,
                                               toolName: Tool.Driver.Name);

            // Next, we initialize ourselves from disk-based configuration, 
            // if specified. This allows users to operate against configuration
            // XML but to override specific settings within it via options.
            context = InitializeConfiguration(options.ConfigurationFilePath, context);
// Shaopeng: This re-creates context, from disk setting which is not including Note.


            // Now that our context if fully initialized, we can create
            // the actual loggers used to complete analysis.
            context.Logger = savedLogger;
            context.Logger ??= InitializeLogger(context);
// Shaopeng: the savedLogger is NULL, so we re-create, and the context is not including Note, from previous comment. Then it leads to the screenshot.

The full config file is

<?xml version="1.0" encoding="utf-8"?>
<Properties Type="PropertiesDictionary">
	<Properties Key="CoreSettings.Options" Type="PropertiesDictionary">
		<!--One or more failure levels to persist to loggers. Valid values include Error, Warning, and Informational. Defaults to 'Error' and 'Warning'.-->
		<Property Key="FailureLevels" Type="FailureLevelSet">
			<Item>Warning</Item>
			<Item>Error</Item>
		</Property>
	</Properties>
</Properties>

from binskim.

michaelcfanning avatar michaelcfanning commented on July 22, 2024

Oh, I see. Will take a look.

from binskim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.