Ejemplo n.º 1
0
        private (IBicepAnalyzerRule[] rules, JObject configSchema) GetRulesAndSchema()
        {
            var linter  = new LinterAnalyzer(BicepTestConstants.BuiltInConfiguration);
            var ruleSet = linter.GetRuleSet();

            ruleSet.Should().NotBeEmpty();

            var configStream = typeof(BicepConfigSchemaTests).Assembly.GetManifestResourceStream(
                $"{typeof(BicepConfigSchemaTests).Assembly.GetName().Name}.bicepconfig.schema.json");

            Assert.IsNotNull(configStream);
            var configContents = new StreamReader(configStream).ReadToEnd();

            Assert.IsNotNull(configContents);
            var configSchema = JObject.Parse(configContents);

            return(ruleSet.ToArray(), configSchema);
        }
Ejemplo n.º 2
0
        public void BuiltInRulesExist(string ruleCode)
        {
            var linter = new LinterAnalyzer();

            linter.GetRuleSet().Should().Contain(r => r.Code == ruleCode);
        }
Ejemplo n.º 3
0
        public void HasBuiltInRules()
        {
            var linter = new LinterAnalyzer();

            linter.GetRuleSet().Should().NotBeEmpty();
        }
Ejemplo n.º 4
0
        private CompilationContext CreateContext(SourceFileGrouping syntaxTreeGrouping, ImmutableDictionary <ISourceFile, ISemanticModel> modelLookup, RootConfiguration configuration, LinterAnalyzer linterAnalyzer)
        {
            var compilation = new Compilation(this.features, namespaceProvider, syntaxTreeGrouping, configuration, linterAnalyzer, modelLookup);

            return(new CompilationContext(compilation));
        }
Ejemplo n.º 5
0
        public CompilationContext Update(IReadOnlyWorkspace workspace, CompilationContext current, ImmutableDictionary <ISourceFile, ISemanticModel> modelLookup, RootConfiguration configuration, LinterAnalyzer linterAnalyzer)
        {
            var syntaxTreeGrouping = SourceFileGroupingBuilder.Rebuild(moduleDispatcher, workspace, current.Compilation.SourceFileGrouping, configuration);

            return(this.CreateContext(syntaxTreeGrouping, modelLookup, configuration, linterAnalyzer));
        }
Ejemplo n.º 6
0
        public CompilationContext Create(IReadOnlyWorkspace workspace, DocumentUri documentUri, ImmutableDictionary <ISourceFile, ISemanticModel> modelLookup, RootConfiguration configuration, LinterAnalyzer linterAnalyzer)
        {
            var syntaxTreeGrouping = SourceFileGroupingBuilder.Build(fileResolver, moduleDispatcher, workspace, documentUri.ToUri(), configuration);

            return(this.CreateContext(syntaxTreeGrouping, modelLookup, configuration, linterAnalyzer));
        }