Skip to content

Commit

Permalink
Change pragma directives to include OrLower
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthurvdv committed Nov 1, 2024
1 parent ab9c877 commit ac2ba29
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 40 deletions.
44 changes: 22 additions & 22 deletions .github/actions/feature-flags/Get-FeatureFlags.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,30 @@ function Get-FeatureFlags {
$featureFlags = ""

$RuntimeVersion = [Ordered]@{
'Spring2018' = '1.0'
'Fall2018' = '2.0'
'Spring2019' = '3.0'
'Fall2019' = '4.0'
'Spring2020' = '5.0'
'Fall2020' = '6.0'
'Spring2021' = '7.0'
'Fall2021' = '8.0'
'Spring2022' = '9.0'
'Spring2022RV1' = '9.1'
'Spring2022RV2' = '9.2'
'Fall2022' = '10.0'
'Spring2023' = '11.0'
'Fall2023' = '12.0'
'Fall2023RV1' = '12.1'
'Fall2023RV2' = '12.2'
'Fall2023RV3' = '12.3'
'Spring2024' = '13.0'
'Fall2024' = '14.0'
'Spring2025' = '15.0'
'Fall2025' = '16.0'
'Spring2018OrLower' = '1.0'
'Fall2018OrLower' = '2.0'
'Spring2019OrLower' = '3.0'
'Fall2019OrLower' = '4.0'
'Spring2020OrLower' = '5.0'
'Fall2020OrLower' = '6.0'
'Spring2021OrLower' = '7.0'
'Fall2021OrLower' = '8.0'
'Spring2022OrLower' = '9.0'
'Spring2022RV1OrLower' = '9.1'
'Spring2022RV2OrLower' = '9.2'
'Fall2022OrLower' = '10.0'
'Spring2023OrLower' = '11.0'
'Fall2023OrLower' = '12.0'
'Fall2023RV1OrLower' = '12.1'
'Fall2023RV2OrLower' = '12.2'
'Fall2023RV3OrLower' = '12.3'
'Spring2024OrLower' = '13.0'
'Fall2024OrLower' = '14.0'
'Spring2025OrLower' = '15.0'
'Fall2025OrLower' = '16.0'
}

$supportedRuntimeVersions = $RuntimeVersion.GetEnumerator() | Where-Object { $(ConvertTo-Version($_.Value)) -ge $(ConvertTo-Version($version)) } | Foreach-Object { $_.Key } | ForEach-Object { "#$_" }
$supportedRuntimeVersions = $RuntimeVersion.GetEnumerator() | Where-Object { $(ConvertTo-Version($_.Value)) -gt $(ConvertTo-Version($version)) } | Foreach-Object { $_.Key } | ForEach-Object { "#$_" }
if (![string]::IsNullOrEmpty($supportedRuntimeVersions)) {
$featureFlags = [System.String]::Join("", $supportedRuntimeVersions)
}
Expand Down
2 changes: 1 addition & 1 deletion BusinessCentral.LinterCop.Test/Rule0043.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !Spring2024
#if !Fall2023RV3OrLower
namespace BusinessCentral.LinterCop.Test;

public class Rule0043
Expand Down
2 changes: 1 addition & 1 deletion BusinessCentral.LinterCop.Test/Rule0068.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public async Task HasDiagnostic(string testCase)
[TestCase("ProcedureCallsInherentPermissionsProperty")]
[TestCase("ProcedureCallsInherentPermissionsAttribute")]
[TestCase("PageSourceTable")]
#if !Fall2023RV1
#if !Fall2023OrLower
[TestCase("ProcedureCallsPermissionsPropertyFullyQualified")]
#endif
// [TestCase("IntegerTable")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private static bool TableContainsNoSeries(ITableTypeSymbol table)
return table.Fields
.Where(x => x.Id > 0 && x.Id < 2000000000)
.Where(x => x.FieldClass == FieldClassKind.Normal)
#if !Fall2024
#if !Spring2024OrLower
.Where(x => x.Type.GetNavTypeKindSafe() == NavTypeKind.Code)
#endif
.Any(field =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Microsoft.Dynamics.Nav.CodeAnalysis.Diagnostics;
using Microsoft.Dynamics.Nav.CodeAnalysis.Packaging;
using System.Collections.Immutable;
#if !Spring2024
#if !Fall2023RV3OrLower
using Microsoft.Dynamics.Nav.Analyzers.Common;
#else
using Microsoft.Dynamics.Nav.Analyzers.Common.AppSourceCopConfiguration;
Expand All @@ -21,7 +21,7 @@ class Rule0033AppManifestRuntimeBehind : DiagnosticAnalyzer

private void CheckAppManifestRuntime(CompilationAnalysisContext ctx)
{
#if !Spring2024
#if !Fall2023RV3OrLower
NavAppManifest manifest = ManifestHelper.GetManifest(ctx.Compilation);
#else
NavAppManifest manifest = AppSourceCopConfigurationProvider.GetManifest(ctx.Compilation);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !Fall2023RV1
#if !Fall2023OrLower
using BusinessCentral.LinterCop.AnalysisContextExtension;
using Microsoft.Dynamics.Nav.CodeAnalysis;
using Microsoft.Dynamics.Nav.CodeAnalysis.Diagnostics;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private void AnalyzeTableExtensionReferencePageProvider(SymbolAnalysisContext ct
private static bool AreTheSameNavObjects(ITableTypeSymbol left, ITableTypeSymbol right)
{
if (left.GetNavTypeKindSafe() != right.GetNavTypeKindSafe()) return false;
#if !Fall2023RV1
#if !Fall2023OrLower
if (((INamespaceSymbol)left.ContainingSymbol).QualifiedName != ((INamespaceSymbol)right.ContainingSymbol).QualifiedName) return false;
#endif
if (left.Name != right.Name) return false;
Expand All @@ -146,7 +146,7 @@ private static bool AreTheSameNavObjects(ITableTypeSymbol left, ITableTypeSymbol

private static string GetFullyQualifiedObjectName(IPageTypeSymbol page)
{
#if !Fall2023RV1
#if !Fall2023OrLower
if (page.ContainingNamespace.QualifiedName != "")
return page.ContainingNamespace.QualifiedName + "." + page.Name.QuoteIdentifierIfNeeded();
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public override void Initialize(AnalysisContext context)
SyntaxKind.ReportColumn,
SyntaxKind.EnumValue,
SyntaxKind.PageCustomAction,
#if !Spring2024
#if !Fall2023RV3OrLower
SyntaxKind.PageSystemAction,
#endif
SyntaxKind.PageView,
Expand Down
4 changes: 2 additions & 2 deletions BusinessCentral.LinterCop/Design/Rule0043SecretText.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !Fall2023RV1
#if !Fall2023OrLower
using System.Collections.Immutable;
using BusinessCentral.LinterCop.AnalysisContextExtension;
using Microsoft.Dynamics.Nav.CodeAnalysis;
Expand Down Expand Up @@ -29,7 +29,7 @@ public override void Initialize(AnalysisContext context)

private void AnalyzeIsolatedStorage(OperationAnalysisContext ctx)
{
#if !Spring2024
#if !Fall2023RV3OrLower
if (!VersionChecker.IsSupported(ctx.ContainingSymbol, VersionCompatibility.Spring2024OrGreater)) return;

if (ctx.IsObsoletePendingOrRemoved()) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ public void PopulateFields(IApplicationObjectTypeSymbol table)
string objtype = typeprop.GetValue(field).ToString();
string fieldClass = fieldClassProp.GetValue(field).ToString();

#if !Fall2023RV1
#if !Fall2023OrLower
// Remove the QualifiedName from the Enum for now.
// In the future refactor this to support Enums with the same object name cross different namespaces
IEnumBaseTypeSymbol? enumBaseTypeSymbol = typeprop.GetValue(field) as IEnumBaseTypeSymbol;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#nullable disable // TODO: Enable nullable and review rule
#if !Fall2023RV1
#if !Fall2023OrLower
using BusinessCentral.LinterCop.AnalysisContextExtension;
using Microsoft.Dynamics.Nav.CodeAnalysis;
using Microsoft.Dynamics.Nav.CodeAnalysis.Diagnostics;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using Microsoft.Dynamics.Nav.CodeAnalysis.Packaging;
using Microsoft.Dynamics.Nav.CodeAnalysis.Utilities;
using System.Collections.Immutable;
#if !Spring2024
#if !Fall2023RV3OrLower
using Microsoft.Dynamics.Nav.Analyzers.Common;
#else
using Microsoft.Dynamics.Nav.Analyzers.Common.AppSourceCopConfiguration;
Expand All @@ -33,7 +33,7 @@ private class MethodSymbolAnalyzer : IDisposable

public MethodSymbolAnalyzer(CompilationAnalysisContext compilationAnalysisContext)
{
#if !Spring2024
#if !Fall2023RV3OrLower
NavAppManifest manifest = ManifestHelper.GetManifest(compilationAnalysisContext.Compilation);
#else
NavAppManifest manifest = AppSourceCopConfigurationProvider.GetManifest(compilationAnalysisContext.Compilation);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#nullable disable // TODO: Enable nullable and review rule
#if !Spring2024
#if !Fall2023RV3OrLower
using BusinessCentral.LinterCop.AnalysisContextExtension;
using Microsoft.Dynamics.Nav.CodeAnalysis;
using Microsoft.Dynamics.Nav.CodeAnalysis.Diagnostics;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private bool ProcedureHasInherentPermission(IEnumerable<IAttributeSymbol> inhere

var objectName = typeParts[1].Trim().Trim('"');
if (objectName.ToLowerInvariant() != variableType.Name.ToLowerInvariant())
#if !Fall2023RV1
#if !Fall2023OrLower
if (objectName.UnquoteIdentifier().ToLowerInvariant() != (variableType.OriginalDefinition.ContainingNamespace?.QualifiedName.ToLowerInvariant() + "." + variableType.Name.ToLowerInvariant()))
#endif
continue;
Expand Down Expand Up @@ -227,7 +227,7 @@ private void CheckProcedureInvocation(IPropertySymbol? objectPermissions, ITypeS
var objectName = typeAndObjectName[typeEndIndex..].Trim().Trim('"');

bool nameSpaceNameMatch = false;
#if !Fall2023RV1
#if !Fall2023OrLower
nameSpaceNameMatch = objectName.UnquoteIdentifier() == (variableType.OriginalDefinition.ContainingNamespace?.QualifiedName.ToLowerInvariant() + "." + variableType.Name.ToLowerInvariant());
#endif

Expand Down

0 comments on commit ac2ba29

Please sign in to comment.