예제 #1
0
 protected RulePipeline(PipelineContext context, Source[] source, PipelineReader reader, PipelineWriter writer)
 {
     Context = context;
     Source  = source;
     Reader  = reader;
     Writer  = writer;
 }
예제 #2
0
            internal AssertWriter(PSRuleOption option, Source[] source, PipelineWriter inner, PipelineWriter next, OutputStyle style, string resultVariableName, PSCmdlet cmdletContext, EngineIntrinsics executionContext)
                : base(inner, option)
            {
                _InnerWriter        = next;
                _ResultVariableName = resultVariableName;
                _CmdletContext      = cmdletContext;
                _ExecutionContext   = executionContext;
                if (!string.IsNullOrEmpty(resultVariableName))
                {
                    _Results = new List <RuleRecord>();
                }

                if (style == OutputStyle.AzurePipelines)
                {
                    _Formatter = new AzurePipelinesFormatter(source, inner);
                }
                else if (style == OutputStyle.GitHubActions)
                {
                    _Formatter = new GitHubActionsFormatter(source, inner);
                }
                else if (style == OutputStyle.Plain)
                {
                    _Formatter = new PlainFormatter(source, inner);
                }
                else if (style == OutputStyle.Client)
                {
                    _Formatter = new ClientFormatter(source, inner);
                }
            }
 internal HelpWriter(PipelineWriter inner, PSRuleOption option, LanguageMode languageMode, bool inSession, bool online, bool full)
     : base(inner, option)
 {
     _LanguageMode = languageMode;
     _InSession    = inSession;
     _ShouldOutput = !online;
     _TypeName     = full ? OUTPUT_TYPENAME_FULL : null;
 }
예제 #4
0
 protected RulePipeline(PipelineContext context, Source[] source, PipelineReader reader, PipelineWriter writer)
 {
     Pipeline = context;
     Context  = new RunspaceContext(Pipeline, writer);
     Source   = source;
     Reader   = reader;
     Writer   = writer;
 }
        internal static void WarnUsingInvariantCulture(this PipelineWriter writer)
        {
            if (!writer.ShouldWriteWarning())
            {
                return;
            }

            writer.WriteWarning(PSRuleResources.UsingInvariantCulture);
        }
예제 #6
0
        internal RunspaceContext(PipelineContext pipeline, PipelineWriter writer)
        {
            Writer        = writer;
            CurrentThread = this;
            Pipeline      = pipeline;

            _InconclusiveWarning = Pipeline.Option.Execution.InconclusiveWarning ?? ExecutionOption.Default.InconclusiveWarning.Value;
            _NotProcessedWarning = Pipeline.Option.Execution.NotProcessedWarning ?? ExecutionOption.Default.NotProcessedWarning.Value;
            _FailStream          = Pipeline.Option.Logging.RuleFail ?? LoggingOption.Default.RuleFail.Value;
            _PassStream          = Pipeline.Option.Logging.RulePass ?? LoggingOption.Default.RulePass.Value;

            _ObjectNumber = -1;
            _RuleTimer    = new Stopwatch();
            _Reason       = new List <string>();
        }
예제 #7
0
 internal AssertWriter(WriteOutput output, PipelineLogger logger, PipelineWriter innerWriter, OutputStyle style)
     : base(output)
 {
     _Logger      = logger;
     _InnerWriter = innerWriter;
     if (style == OutputStyle.AzurePipelines)
     {
         _Formatter = new AzurePipelinesFormatter(logger);
     }
     else if (style == OutputStyle.GitHubActions)
     {
         _Formatter = new GitHubActionsFormatter(logger);
     }
     else if (style == OutputStyle.Plain)
     {
         _Formatter = new PlainFormatter(logger);
     }
     else if (style == OutputStyle.Client)
     {
         _Formatter = new ClientFormatter(logger);
     }
 }
예제 #8
0
 internal GetBaselinePipeline(PipelineContext pipeline, Source[] source, PipelineReader reader, PipelineWriter writer, IResourceFilter filter)
     : base(pipeline, source, reader, writer)
 {
     _Filter = filter;
 }
 internal GetRuleHelpPipeline(PipelineContext pipeline, Source[] source, PipelineReader reader, PipelineWriter writer)
     : base(pipeline, source, reader, writer)
 {
     // Do nothing
 }
예제 #10
0
        internal InvokeRulePipeline(PipelineContext context, Source[] source, PipelineReader reader, PipelineWriter writer, RuleOutcome outcome)
            : base(context, source, reader, writer)
        {
            HostHelper.ImportResource(source: Source, context: context);
            _RuleGraph = HostHelper.GetRuleBlockGraph(source: Source, context: context);
            RuleCount  = _RuleGraph.Count;

            if (RuleCount == 0)
            {
                Context.WarnRuleNotFound();
            }

            _Outcome           = outcome;
            _Summary           = new Dictionary <string, RuleSummaryRecord>();
            _ResultFormat      = context.Option.Output.As.Value;
            _SuppressionFilter = new RuleSuppressionFilter(context.Option.Suppression);
        }
예제 #11
0
 internal GetRulePipeline(PipelineContext context, Source[] source, PipelineReader reader, PipelineWriter writer, bool includeDependencies)
     : base(context, source, reader, writer)
 {
     HostHelper.ImportResource(source: Source, context: context);
     _IncludeDependencies = includeDependencies;
 }
예제 #12
0
 protected PipelineWriter(PipelineWriter inner, PSRuleOption option)
 {
     _Writer = inner;
     Option  = option;
 }
예제 #13
0
 protected SerializationOutputWriter(PipelineWriter inner, PSRuleOption option)
     : base(inner, option)
 {
     _Result = new List <T>();
 }
예제 #14
0
 internal BooleanWriter(PipelineWriter output, RuleOutcome outcome)
     : base(output, null)
 {
     _Outcome = outcome;
 }