コード例 #1
0
        /// <summary>
        ///     Tool integration constructor.
        ///     This will prepare everything needed for the tool to work with codacy
        ///     integration, using the Seed.
        /// </summary>
        public CodeAnalyzer() : base(sqlExtension)
        {
            timer        = new ConsoleTimer();
            reporter     = new CodacyConsoleReporter();
            configReader = new ConfigReader(reporter);

            // create temporary directory
            var tmpTSQLLintFolder = Path.Combine(Path.GetTempPath(), "tsqllint_" + Guid.NewGuid());

            Directory.CreateDirectory(tmpTSQLLintFolder);

            tmpTSQLLintPath = Path.Combine(tmpTSQLLintFolder, defaultTSQLLintConfiguration);

            var defaultTSQLLintConfigurationPath = Path.Combine("/src", defaultTSQLLintConfiguration);

            var tsqllintConfig = new TSQLLintConfiguration();

            if (!(PatternIds is null) && PatternIds.Any())
            {
                tsqllintConfig.Rules = new Dictionary <string, string>();
                foreach (var pattern in CurrentTool.Patterns)
                {
                    tsqllintConfig.Rules.Add(pattern.PatternId, "error");
                }

                foreach (var unusedPattern in Patterns.Patterns.Select(p => p.PatternId)
                         .Except(CurrentTool.Patterns.Select(p => p.PatternId)))
                {
                    tsqllintConfig.Rules.Add(unusedPattern, "off");
                }
            }
コード例 #2
0
ファイル: Application.cs プロジェクト: ScubaTron84/tsqllint
        public Application(string[] args, IReporter reporter)
        {
            timer = new ConsoleTimer();
            timer.Start();

            this.reporter            = reporter;
            commandLineOptions       = new CommandLineOptions.CommandLineOptions(args);
            configReader             = new ConfigReader(reporter);
            commandLineOptionHandler = new CommandLineOptionHandler(commandLineOptions, new ConfigFileGenerator(), configReader, reporter);
        }
コード例 #3
0
ファイル: Application.cs プロジェクト: ostreifel/tsqllint
        public Application(string[] args, IReporter reporter)
        {
            timer = new ConsoleTimer();
            timer.Start();

            this.reporter            = reporter;
            commandLineOptions       = new CommandLineOptions.CommandLineOptions(args);
            configReader             = new ConfigReader(reporter);
            commandLineOptionHandler = new CommandLineOptionHandler(commandLineOptions, new ConfigFileGenerator(), configReader, reporter);
            var          fragmentBuilder    = new FragmentBuilder();
            var          ruleVisitorBuilder = new RuleVisitorBuilder(configReader, this.reporter);
            IRuleVisitor ruleVisitor        = new SqlRuleVisitor(ruleVisitorBuilder, fragmentBuilder, reporter);

            pluginHandler = new PluginHandler(reporter);
            fileProcessor = new SqlFileProcessor(ruleVisitor, pluginHandler, reporter, new FileSystem());
        }