public void GetHelpLink_VisualBasic() { var helpLink = DiagnosticDescriptorBuilder .GetHelpLink(vbnet.SonarAnalyzer.RspecStrings.ResourceManager, "S1234"); helpLink.Should().Be("https://rules.sonarsource.com/vbnet/RSPEC-1234"); }
public void GetHelpLink_CSharp() { var helpLink = DiagnosticDescriptorBuilder .GetHelpLink(csharp.SonarAnalyzer.RspecStrings.ResourceManager, "S1234"); helpLink.Should().Be("https://rules.sonarsource.com/csharp/RSPEC-1234"); }
protected PubliclyWritableDirectoriesBase(IAnalyzerConfiguration configuration, ResourceManager rspecResources) : base(configuration) { rule = DiagnosticDescriptorBuilder.GetDescriptor(DiagnosticId, MessageFormat, rspecResources).WithNotConfigurable(); linuxDirectories = new Regex($@"^({linuxDirs.JoinStr("|", x => Regex.Escape(x))})(\/|$)", RegexOptions.Compiled); macDirectories = new Regex($@"^({macDirs.JoinStr("|", x => Regex.Escape(x))})(\/|$)", WindowsAndUnixOptions); environmentVariables = new Regex($@"^%({InsecureEnvironmentVariables.JoinStr("|")})%([\\\/]|$)", WindowsAndUnixOptions); }
public void GetUtilityDescriptor_Should_Contain_NotConfigurable_CustomTag() { var result = DiagnosticDescriptorBuilder.GetUtilityDescriptor("Foo", ""); #if DEBUG result.CustomTags.Should().NotContain(WellKnownDiagnosticTags.NotConfigurable); #else result.CustomTags.Should().Contain(WellKnownDiagnosticTags.NotConfigurable); #endif }
public void GetDescriptor_SetsIsEnabledByDefaultToTrue() { DiagnosticDescriptorBuilder.GetDescriptor("S100", "", csharp.SonarAnalyzer.RspecStrings.ResourceManager) .IsEnabledByDefault .Should().BeTrue(); DiagnosticDescriptorBuilder.GetDescriptor("S100", "", SonarAnalyzer.Common.IdeVisibility.Hidden, csharp.SonarAnalyzer.RspecStrings.ResourceManager) .IsEnabledByDefault .Should().BeTrue(); }
public void GetDescriptor_WhenIsActivatedByDefaultAndIdeVisibilityNotHidden_HasOnlySonarWayAndLanguageTags() { // Arrange var diagnosticId = "foo"; var mockedResourceManager = CreateMockedResourceManager(diagnosticId, true); // Act var result = DiagnosticDescriptorBuilder.GetDescriptor(diagnosticId, "", mockedResourceManager); // Assert result.CustomTags.Should().OnlyContain(DiagnosticTagsHelper.SonarWayTag, LanguageValue); }
public void GetDescriptor_WhenIsNotActivatedByDefaultAndIdeVisibilityIsHidden_HasOnlyUnnecessaryAndLanguageTags() { // Arrange var diagnosticId = "foo"; var mockedResourceManager = CreateMockedResourceManager(diagnosticId, false); // Act var result = DiagnosticDescriptorBuilder.GetDescriptor(diagnosticId, "", IdeVisibility.Hidden, mockedResourceManager); // Assert result.CustomTags.Should().OnlyContain(WellKnownDiagnosticTags.Unnecessary, LanguageValue); }
public void GetDescriptor_WhenIsNotActivatedByDefaultAndIdeVisibilityNotHidden_ContainsOnlyLanguage() { // Arrange var diagnosticId = "foo"; var mockedResourceManager = CreateMockedResourceManager(diagnosticId, false); // Act var result = DiagnosticDescriptorBuilder.GetDescriptor(diagnosticId, "", mockedResourceManager); // Assert result.CustomTags.Should().OnlyContain(LanguageValue); }
public void GetUtilityDescriptor_Should_Contain_NotConfigurable_CustomTag_SourceScope_Specified() { foreach (SourceScope sourceScope in Enum.GetValues(typeof(SourceScope))) { // Arrange // Act var result = DiagnosticDescriptorBuilder.GetUtilityDescriptor("Foo", "", sourceScope); // Assert #if DEBUG result.CustomTags.Should().NotContain(WellKnownDiagnosticTags.NotConfigurable); #else result.CustomTags.Should().Contain(WellKnownDiagnosticTags.NotConfigurable); #endif } }
public void GetDescriptor_SetsIsEnabledByDefaultToGivenValue() { // Arrange var diagnosticId = "FooBar"; var mockedResourceManager = CreateMockedResourceManager(diagnosticId, isActivatedByDefault: true); DiagnosticDescriptorBuilder.GetDescriptor(diagnosticId, "", mockedResourceManager, true) .IsEnabledByDefault .Should() .BeTrue(); DiagnosticDescriptorBuilder.GetDescriptor(diagnosticId, "", mockedResourceManager, false) .IsEnabledByDefault .Should() .BeFalse(); DiagnosticDescriptorBuilder.GetDescriptor(diagnosticId, "", mockedResourceManager) .IsEnabledByDefault .Should() .BeTrue(); }
protected JwtSignedBase(System.Resources.ResourceManager rspecResources) { verifyingRule = DiagnosticDescriptorBuilder .GetDescriptor(DiagnosticId, string.Format(MessageFormat, MessageVerifying), rspecResources) .WithNotConfigurable(); }
protected PropertiesAccessCorrectFieldBase(System.Resources.ResourceManager rspecResources) { rule = DiagnosticDescriptorBuilder.GetDescriptor(DiagnosticId, MessageFormat, rspecResources); }
protected MethodOverloadsShouldBeGroupedBase(System.Resources.ResourceManager resources) { rule = DiagnosticDescriptorBuilder.GetDescriptor(DiagnosticId, MessageFormat, resources); }
protected ProvideDeserializationMethodsForOptionalFieldsBase() { rule = DiagnosticDescriptorBuilder.GetDescriptor(DiagnosticId, MessageFormat, Language.RspecResources); }
protected $DiagnosticClassName$Base() => Rule = DiagnosticDescriptorBuilder.GetDescriptor(DiagnosticId, MessageFormat, Language.RspecResources);
public MarkAssemblyWithComVisibleAttributeBase(System.Resources.ResourceManager rspecResources) : base(DiagnosticDescriptorBuilder.GetDescriptor(DiagnosticId, MessageFormat, rspecResources)) { }
protected $DiagnosticClassName$Base(System.Resources.ResourceManager rspecResources) => Rule = DiagnosticDescriptorBuilder.GetDescriptor(DiagnosticId, MessageFormat, rspecResources);
protected HardcodedIpAddressBase(IAnalyzerConfiguration analyzerConfiguration, System.Resources.ResourceManager rspecResources) : base(analyzerConfiguration) { rule = DiagnosticDescriptorBuilder.GetDescriptor(DiagnosticId, MessageFormat, rspecResources).WithNotConfigurable(); }
protected ParameterAssignedToBase(System.Resources.ResourceManager rspecResources) { rule = DiagnosticDescriptorBuilder.GetDescriptor(DiagnosticId, MessageFormat, rspecResources); }
protected SelfAssignmentBase(System.Resources.ResourceManager rspecResources) { this.rule = DiagnosticDescriptorBuilder.GetDescriptor(DiagnosticId, MessageFormat, rspecResources); }
protected MarkAssemblyWithAssemblyVersionAttributeBase(System.Resources.ResourceManager rspecResources) : base(DiagnosticDescriptorBuilder.GetDescriptor(DiagnosticId, MessageFormat, rspecResources)) { }
protected CertificateValidationCheckBase(System.Resources.ResourceManager rspecResources) { rule = DiagnosticDescriptorBuilder.GetDescriptor(DiagnosticId, MessageFormat, rspecResources); }
protected DisablingRequestValidationBase(System.Resources.ResourceManager rspecResources, IAnalyzerConfiguration configuration) { rule = DiagnosticDescriptorBuilder.GetDescriptor(DiagnosticId, MessageFormat, rspecResources).WithNotConfigurable(); this.configuration = configuration; }
protected GotoStatementBase(System.Resources.ResourceManager rspecResources) { rule = DiagnosticDescriptorBuilder.GetDescriptor(DiagnosticId, string.Format(MessageFormat, GoToLabel), rspecResources); }
protected FieldShadowsParentFieldBase(System.Resources.ResourceManager rspecResources) { s2387 = DiagnosticDescriptorBuilder.GetDescriptor(S2387DiagnosticId, S2387MessageFormat, rspecResources); s4025 = DiagnosticDescriptorBuilder.GetDescriptor(S4025DiagnosticId, S4025MessageFormat, rspecResources); }
protected RequestsWithExcessiveLengthBase(IAnalyzerConfiguration analyzerConfiguration) { rule = DiagnosticDescriptorBuilder.GetDescriptor(DiagnosticId, MessageFormat, Language.RspecResources).WithNotConfigurable(); this.analyzerConfiguration = analyzerConfiguration; }