private bool LogSuppressableMessage(MessageLevel messageLevel, Suppression suppression, string code, string format, params string[] args)
        {
            if (SuppressionEngine.IsErrorSuppressed(suppression))
            {
                return(false);
            }

            if (BaselineAllErrors)
            {
                SuppressionEngine.AddSuppression(suppression);
                return(false);
            }

            _log.Log(new Message(messageLevel, string.Format(format, args), code));
            return(true);
        }
Beispiel #2
0
        private bool LogSuppressableMessage(bool errorOutput, Suppression suppression, string code, string format, params string[] args)
        {
            if (SuppressionEngine.IsErrorSuppressed(suppression))
            {
                return(false);
            }

            if (BaselineAllErrors)
            {
                SuppressionEngine.AddSuppression(suppression);
                return(false);
            }

            TextWriter textWriter = errorOutput ? System.Console.Error : System.Console.Out;

            textWriter.WriteLine(code + ": " + string.Format(format, args));
            return(true);
        }
Beispiel #3
0
 static void AddSuppression(SuppressionEngine testEngine) => testEngine.AddSuppression("PKG004", "A.B()", "ref/net6.0/mylib.dll", "lib/net6.0/mylib.dll");
Beispiel #4
0
        public void AddingASuppressionTwiceDoesntThrow()
        {
            var testEngine = SuppressionEngine.Create();

            AddSuppression(testEngine);
            AddSuppression(testEngine);
Beispiel #5
0
 public CompatibilityLogger(Logger log, string suppressionsFile, bool baselineAllErrors)
 {
     _log = log;
     _suppressionEngine = baselineAllErrors && !File.Exists(suppressionsFile) ? SuppressionEngine.Create() : SuppressionEngine.CreateFromFile(suppressionsFile);
     _baselineAllErrors = baselineAllErrors;
 }