Skip to content

Commit

Permalink
Merge pull request #777 from StefanMaron/prerelease
Browse files Browse the repository at this point in the history
Merge 'prerelease' into master
  • Loading branch information
Arthurvdv authored Sep 30, 2024
2 parents c2170f8 + a8d6e51 commit 6c7a4c5
Show file tree
Hide file tree
Showing 104 changed files with 2,027 additions and 177 deletions.
2 changes: 2 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ categories:
label: 'chore'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
include-pre-releases: true
prerelease-identifier: 'alpha'
version-resolver:
major:
labels:
Expand Down
5 changes: 3 additions & 2 deletions BusinessCentral.LinterCop.Test/Rule0004.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@ public async Task HasDiagnostic(string testCase)
.ConfigureAwait(false);

var fixture = RoslynFixtureFactory.Create<Rule0004LookupPageIdAndDrillDownPageId>();
fixture.HasDiagnostic(code, DiagnosticDescriptors.Rule0004LookupPageIdAndDrillDownPageId.Id);
fixture.HasDiagnostic(code, Rule0004LookupPageIdAndDrillDownPageId.DiagnosticDescriptors.Rule0004LookupPageIdAndDrillDownPageId.Id);
}

[Test]
[TestCase("1")]
[TestCase("2")]
public async Task NoDiagnostic(string testCase)
{
var code = await File.ReadAllTextAsync(Path.Combine(_testCaseDir, "NoDiagnostic", $"{testCase}.al"))
.ConfigureAwait(false);

var fixture = RoslynFixtureFactory.Create<Rule0004LookupPageIdAndDrillDownPageId>();
fixture.NoDiagnosticAtMarker(code, DiagnosticDescriptors.Rule0004LookupPageIdAndDrillDownPageId.Id);
fixture.NoDiagnosticAtMarker(code, Rule0004LookupPageIdAndDrillDownPageId.DiagnosticDescriptors.Rule0004LookupPageIdAndDrillDownPageId.Id);
}
}
4 changes: 2 additions & 2 deletions BusinessCentral.LinterCop.Test/Rule0013.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public async Task HasDiagnostic(string testCase)
.ConfigureAwait(false);

var fixture = RoslynFixtureFactory.Create<Rule0013CheckForNotBlankOnSingleFieldPrimaryKeys>();
fixture.HasDiagnostic(code, DiagnosticDescriptors.Rule0013CheckForNotBlankOnSingleFieldPrimaryKeys.Id);
fixture.HasDiagnostic(code, Rule0013CheckForNotBlankOnSingleFieldPrimaryKeys.DiagnosticDescriptors.Rule0013CheckForNotBlankOnSingleFieldPrimaryKeys.Id);
}

[Test]
Expand All @@ -33,6 +33,6 @@ public async Task NoDiagnostic(string testCase)
.ConfigureAwait(false);

var fixture = RoslynFixtureFactory.Create<Rule0013CheckForNotBlankOnSingleFieldPrimaryKeys>();
fixture.NoDiagnosticAtMarker(code, DiagnosticDescriptors.Rule0013CheckForNotBlankOnSingleFieldPrimaryKeys.Id);
fixture.NoDiagnosticAtMarker(code, Rule0013CheckForNotBlankOnSingleFieldPrimaryKeys.DiagnosticDescriptors.Rule0013CheckForNotBlankOnSingleFieldPrimaryKeys.Id);
}
}
40 changes: 40 additions & 0 deletions BusinessCentral.LinterCop.Test/Rule0067.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
namespace BusinessCentral.LinterCop.Test;

public class Rule0067
{
private string _testCaseDir = "";

[SetUp]
public void Setup()
{
_testCaseDir = Path.Combine(Directory.GetParent(Environment.CurrentDirectory)!.Parent!.Parent!.FullName,
"TestCases", "Rule0067");
}

[Test]
[TestCase("1")]
[TestCase("2")]
[TestCase("3")]
public async Task HasDiagnostic(string testCase)
{
var code = await File.ReadAllTextAsync(Path.Combine(_testCaseDir, "HasDiagnostic", $"{testCase}.al"))
.ConfigureAwait(false);

var fixture = RoslynFixtureFactory.Create<Rule0013CheckForNotBlankOnSingleFieldPrimaryKeys>();
fixture.HasDiagnostic(code, Rule0013CheckForNotBlankOnSingleFieldPrimaryKeys.DiagnosticDescriptors.Rule0067DisableNotBlankOnSingleFieldPrimaryKey.Id);
}

[Test]
[TestCase("1")]
[TestCase("2")]
[TestCase("3")]
[TestCase("4")]
public async Task NoDiagnostic(string testCase)
{
var code = await File.ReadAllTextAsync(Path.Combine(_testCaseDir, "NoDiagnostic", $"{testCase}.al"))
.ConfigureAwait(false);

var fixture = RoslynFixtureFactory.Create<Rule0013CheckForNotBlankOnSingleFieldPrimaryKeys>();
fixture.NoDiagnosticAtMarker(code, Rule0013CheckForNotBlankOnSingleFieldPrimaryKeys.DiagnosticDescriptors.Rule0067DisableNotBlankOnSingleFieldPrimaryKey.Id);
}
}
52 changes: 52 additions & 0 deletions BusinessCentral.LinterCop.Test/Rule0068.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
namespace BusinessCentral.LinterCop.Test;

public class Rule0068
{
private string _testCaseDir = "";

[SetUp]
public void Setup()
{
_testCaseDir = Path.Combine(Directory.GetParent(Environment.CurrentDirectory)!.Parent!.Parent!.FullName,
"TestCases", "Rule0068");
}

[Test]
[TestCase("ProcedureCalls")]
[TestCase("XmlPorts")]
[TestCase("Queries")]
[TestCase("Reports")]
public async Task HasDiagnostic(string testCase)
{
var code = await File.ReadAllTextAsync(Path.Combine(_testCaseDir, "HasDiagnostic", $"{testCase}.al"))
.ConfigureAwait(false);

var fixture = RoslynFixtureFactory.Create<Rule0068CheckObjectPermission>();
fixture.HasDiagnostic(code, Rule0068CheckObjectPermission.DiagnosticDescriptors.Rule0068CheckObjectPermission.Id);
}

[Test]
[TestCase("ProcedureCallsPermissionsProperty")]
[TestCase("XmlPortPermissionsProperty")]
[TestCase("QueryPermissionsProperty")]
[TestCase("XmlPortInherentPermissions")]
[TestCase("QueryInherentPermissions")]
[TestCase("ReportPermissionsProperty")]
[TestCase("ReportInherentPermissions")]
[TestCase("ProcedureCallsInherentPermissionsProperty")]
[TestCase("ProcedureCallsInherentPermissionsAttribute")]
[TestCase("PageSourceTable")]
#if Fall2023RV1
[TestCase("ProcedureCallsPermissionsPropertyFullyQualified")]
#endif
// [TestCase("IntegerTable")]
[TestCase("XMLPortWithTableElementProps")]
public async Task NoDiagnostic(string testCase)
{
var code = await File.ReadAllTextAsync(Path.Combine(_testCaseDir, "NoDiagnostic", $"{testCase}.al"))
.ConfigureAwait(false);

var fixture = RoslynFixtureFactory.Create<Rule0068CheckObjectPermission>();
fixture.NoDiagnosticAtMarker(code, Rule0068CheckObjectPermission.DiagnosticDescriptors.Rule0068CheckObjectPermission.Id);
}
}
37 changes: 37 additions & 0 deletions BusinessCentral.LinterCop.Test/Rule0069.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
namespace BusinessCentral.LinterCop.Test;

public class Rule0069
{
private string _testCaseDir = "";

[SetUp]
public void Setup()
{
_testCaseDir = Path.Combine(Directory.GetParent(Environment.CurrentDirectory)!.Parent!.Parent!.FullName,
"TestCases", "Rule0069");
}

[Test]
[TestCase("1")]
public async Task HasDiagnostic(string testCase)
{
var code = await File.ReadAllTextAsync(Path.Combine(_testCaseDir, "HasDiagnostic", $"{testCase}.al"))
.ConfigureAwait(false);

var fixture = RoslynFixtureFactory.Create<Rule0069EmptyStatements>();
fixture.HasDiagnostic(code, DiagnosticDescriptors.Rule0069EmptyStatements.Id);
}

[Test]
[TestCase("1")]
[TestCase("2")]
[TestCase("3")]
public async Task NoDiagnostic(string testCase)
{
var code = await File.ReadAllTextAsync(Path.Combine(_testCaseDir, "NoDiagnostic", $"{testCase}.al"))
.ConfigureAwait(false);

var fixture = RoslynFixtureFactory.Create<Rule0069EmptyStatements>();
fixture.NoDiagnosticAtMarker(code, DiagnosticDescriptors.Rule0069EmptyStatements.Id);
}
}
37 changes: 37 additions & 0 deletions BusinessCentral.LinterCop.Test/Rule0070.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
namespace BusinessCentral.LinterCop.Test;

public class Rule0070
{
private string _testCaseDir = "";

[SetUp]
public void Setup()
{
_testCaseDir = Path.Combine(Directory.GetParent(Environment.CurrentDirectory)!.Parent!.Parent!.FullName,
"TestCases", "Rule0070");
}

[Test]
[TestCase("1")]
[TestCase("2")]
public async Task HasDiagnostic(string testCase)
{
var code = await File.ReadAllTextAsync(Path.Combine(_testCaseDir, "HasDiagnostic", $"{testCase}.al"))
.ConfigureAwait(false);

var fixture = RoslynFixtureFactory.Create<Rule0070ListObjectsAreOneBased>();
fixture.HasDiagnostic(code, Rule0070ListObjectsAreOneBased.DiagnosticDescriptors.Rule0070ListObjectsAreOneBased.Id);
}

[Test]
[TestCase("1")]
[TestCase("2")]
public async Task NoDiagnostic(string testCase)
{
var code = await File.ReadAllTextAsync(Path.Combine(_testCaseDir, "NoDiagnostic", $"{testCase}.al"))
.ConfigureAwait(false);

var fixture = RoslynFixtureFactory.Create<Rule0070ListObjectsAreOneBased>();
fixture.NoDiagnosticAtMarker(code, Rule0070ListObjectsAreOneBased.DiagnosticDescriptors.Rule0070ListObjectsAreOneBased.Id);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[|table 50100 MyTable|]
{
fields
{
field(1; MyField; Integer) {}
}
}

page 50100 MyPage
{
PageType = List;
SourceTable = MyTable;
SourceTableTemporary = true;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
table 50100 MyTable
{
fields
{
[|field(1; MyField; Code[20])|]
{
NotBlank = true;
}
field(2; "No. Series"; Code[20])
{
TableRelation = "No. Series";
}
}

keys
{
key(Key1; MyField)
{
Clustered = true;
}
}
}

table 308 "No. Series"
{
fields
{
field(1; "Code"; Code[20])
{
Caption = 'Code';
NotBlank = true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
table 50100 MyTable
{
fields
{
[|field(1; MyField; Code[20])|]
{
NotBlank = true;
}
field(2; "No. Series"; Code[20])
{
TableRelation = "No. Series".Code;
}
}

keys
{
key(Key1; MyField)
{
Clustered = true;
}
}
}

table 308 "No. Series"
{
fields
{
field(1; "Code"; Code[20])
{
Caption = 'Code';
NotBlank = true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
table 50100 MyTable
{
fields
{
[|field(1; MyField; Code[20])|]
{
NotBlank = true;
}
field(2; "No. Series"; Code[20])
{
TableRelation = "No. Series"."Code";
}
}

keys
{
key(Key1; MyField)
{
Clustered = true;
}
}
}

table 308 "No. Series"
{
fields
{
field(1; "Code"; Code[20])
{
Caption = 'Code';
NotBlank = true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
table 50100 MyTable
{
fields
{
[|field(1; MyField; Code[20])|] { }
}

keys
{
key(Key1; MyField)
{
Clustered = true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
table 50100 MyTable
{
fields
{
[|field(1; MyField; Code[20])|]
{
NotBlank = true;
}
}

keys
{
key(Key1; MyField)
{
Clustered = true;
}
}
}
Loading

0 comments on commit 6c7a4c5

Please sign in to comment.