public void RegisterConfigFilePath(Language language, string path, IBindingConfigFile bindingConfig = null)
        {
            if (!this.availableFiles.ContainsKey(language))
            {
                bindingConfig = bindingConfig ?? new DotNetBindingConfigFile(new RuleSet("SonarQube"));
                this.availableFiles[language] = new ConfigFileInformation(bindingConfig);
            }

            this.availableFiles[language].NewFilePath = path;
        }
        public async Task <IBindingConfigFile> GetConfigurationAsync(SonarQubeQualityProfile qualityProfile, string organizationKey, Language language, CancellationToken cancellationToken)
        {
            var provider = Providers.FirstOrDefault(p => p.IsLanguageSupported(language));

            if (provider == null)
            {
                throw new ArgumentOutOfRangeException(nameof(language));
            }
            IBindingConfigFile config = null;

            if (provider != null)
            {
                config = await provider?.GetConfigurationAsync(qualityProfile, organizationKey, language, cancellationToken);
            }

            return(config);
        }
Exemplo n.º 3
0
 public DummyProvider(IBindingConfigFile configToReturn = null, params Language[] supportedLanguages)
 {
     SupportedLanguages  = new List <Language>(supportedLanguages);
     this.ConfigToReturn = configToReturn;
 }
 public ConfigFileInformation(IBindingConfigFile bindingConfigFile)
 {
     BindingConfigFile = bindingConfigFile ?? throw new ArgumentNullException(nameof(bindingConfigFile));
 }
 public static bool TryGetRuleSet(this IBindingConfigFile bindingConfigFile, out RuleSet ruleSet)
 {
     ruleSet = (bindingConfigFile as IBindingConfigFileWithRuleset)?.RuleSet;
     return(ruleSet != null);
 }