Ejemplo n.º 1
0
        /// <summary>
        /// Converts a Semmle log file in CSV format to a SARIF log file.
        /// </summary>
        /// <param name="input">
        /// Input stream from which to read the Semmle log.
        /// </param>
        /// <param name="output">
        /// Output string to which to write the SARIF log.
        /// </param>
        /// <param name="dataToInsert">Optionally emitted properties that should be written to log.</param>
        /// <exception cref="ArgumentNullException">
        /// Thrown when one or more required arguments are null.
        /// </exception>
        public override void Convert(Stream input, IResultLogWriter output, OptionallyEmittedData dataToInsert)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            if (output == null)
            {
                throw new ArgumentNullException(nameof(output));
            }

            _toolNotifications = new List <Notification>();

            var results = GetResultsFromStream(input);

            PersistResults(output, results);

            if (_toolNotifications.HasAtLeastOneNonNullValue())
            {
                output.WriteInvocations(
                    new[] { new Invocation
                            {
                                ToolExecutionNotifications = _toolNotifications
                            } });
            }
        }