Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid running no-hardcoded-env-urls linter rule in .bicepparam files #13608

Merged
merged 1 commit into from Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/Bicep.Core.IntegrationTests/ScenarioTests.cs
Expand Up @@ -5724,6 +5724,23 @@ public void Test_Issue12347()
result.ExcludingLinterDiagnostics().Should().NotHaveAnyDiagnostics();
}

// https://github.com/Azure/bicep/issues/13607
[TestMethod]
public void Test_Issue13607()
{
var result = CompilationHelper.CompileParams(
("parameters.bicepparam", """
using 'main.bicep'

param endpoint = 'management.core.windows.net'
"""),
("main.bicep", """
param endpoint string
"""));

result.Should().NotHaveAnyDiagnostics();
}

// https://github.com/Azure/bicep/issues/13250
[TestMethod]
public void Test_Issue13250()
Expand Down
Expand Up @@ -6,6 +6,7 @@
using Bicep.Core.Parsing;
using Bicep.Core.Semantics;
using Bicep.Core.Syntax;
using Bicep.Core.Workspaces;

namespace Bicep.Core.Analyzers.Linter.Rules
{
Expand All @@ -28,6 +29,12 @@ public override string FormatMessage(params object[] values)

public override IEnumerable<IDiagnostic> AnalyzeInternal(SemanticModel model, DiagnosticLevel diagnosticLevel)
{
if (model.SourceFile is BicepParamFile)
{
// The environment() function isn't available for .bicepparam files
return Enumerable.Empty<IDiagnostic>();
}

var disallowedHosts = GetConfigurationValue(model.Configuration.Analyzers, DisallowedHostsKey.ToLowerInvariant(), Array.Empty<string>()).ToImmutableArray();
var excludedHosts = GetConfigurationValue(model.Configuration.Analyzers, ExcludedHostsKey.ToLowerInvariant(), Array.Empty<string>()).ToImmutableArray();

Expand Down