Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ slnx-validator MySolution.slnx
[FAIL] MySolution.slnx

MySolution.slnx
- line 5: [SLNX0013] The element 'Folder' in namespace '...' has invalid child element 'Folder'. List of possible elements expected: 'Project'.
- line 12: [SLNX0011] File not found: docs\CONTRIBUTING.md
- line 5: [SLNX013] The element 'Folder' in namespace '...' has invalid child element 'Folder'. List of possible elements expected: 'Project'.
- line 12: [SLNX011] File not found: docs\CONTRIBUTING.md
```

### Multiple files — mixed results
Expand All @@ -86,8 +86,8 @@ slnx-validator src\
[FAIL] src\Backend.slnx

src\Backend.slnx
- line 4: [SLNX0011] File not found: docs\CONTRIBUTING.md
- line 8: [SLNX0012] Wildcard patterns are not supported in file paths: docs\*.md
- line 4: [SLNX011] File not found: docs\CONTRIBUTING.md
- line 8: [SLNX012] Wildcard patterns are not supported in file paths: docs\*.md
```

## What is validated
Expand Down Expand Up @@ -116,13 +116,13 @@ The following are **intentionally out of scope** because the toolchain already h

| Code | Name | Description |
|------|------|-------------|
| `SLNX0001` | `FileNotFound` | The input `.slnx` file does not exist. |
| `SLNX0002` | `InvalidExtension` | The input file does not have a `.slnx` extension. |
| `SLNX0003` | `NotATextFile` | The file is binary and cannot be parsed as XML. |
| `SLNX0010` | `InvalidXml` | The file is not valid XML (see [`examples/invalid-not-xml.slnx`](examples/invalid-not-xml.slnx)). |
| `SLNX0011` | `FileNotFound` | A file referenced in `<File Path="...">` does not exist on disk. |
| `SLNX0012` | `InvalidWildcardUsage` | A `<File Path="...">` contains a wildcard pattern (see [`examples/invalid-wildcard.slnx`](examples/invalid-wildcard.slnx)). |
| `SLNX0013` | `XsdViolation` | The XML structure violates the schema, e.g. `<Folder>` inside `<Folder>` (see [`examples/invalid-xsd.slnx`](examples/invalid-xsd.slnx)). |
| `SLNX001` | `FileNotFound` | The input `.slnx` file does not exist. |
| `SLNX002` | `InvalidExtension` | The input file does not have a `.slnx` extension. |
| `SLNX003` | `NotATextFile` | The file is binary and cannot be parsed as XML. |
| `SLNX010` | `InvalidXml` | The file is not valid XML (see [`examples/invalid-not-xml.slnx`](examples/invalid-not-xml.slnx)). |
| `SLNX011` | `ReferencedFileNotFound` | A file referenced in `<File Path="...">` does not exist on disk. |
| `SLNX012` | `InvalidWildcardUsage` | A `<File Path="...">` contains a wildcard pattern (see [`examples/invalid-wildcard.slnx`](examples/invalid-wildcard.slnx)). |
| `SLNX013` | `XsdViolation` | The XML structure violates the schema, e.g. `<Folder>` inside `<Folder>` (see [`examples/invalid-xsd.slnx`](examples/invalid-xsd.slnx)). |

## XSD Schema

Expand Down
2 changes: 1 addition & 1 deletion examples/invalid-not-xml.slnx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
This file intentionally contains plain text instead of XML,
to demonstrate the SLNX0010 InvalidXml error.
to demonstrate the SLNX010 InvalidXml error.
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ namespace JulianVerdurmen.SlnxValidator.Core.ValidationResults;
public static class ValidationErrorCodeExtensions
{
public static string ToCode(this ValidationErrorCode code) =>
$"SLNX{(int)code:D4}";
$"SLNX{(int)code:D3}";
}
14 changes: 7 additions & 7 deletions tests/SLNX-validator.Core.Tests/SlnxValidatorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,12 @@ public async Task ValidateAsync_WildcardInFilePath_ReturnsInvalidWildcardUsageEr
[Test]
public async Task ValidationErrorCode_ToCode_ReturnsPrefixedCode()
{
ValidationErrorCode.FileNotFound.ToCode().Should().Be("SLNX0001");
ValidationErrorCode.InvalidExtension.ToCode().Should().Be("SLNX0002");
ValidationErrorCode.NotATextFile.ToCode().Should().Be("SLNX0003");
ValidationErrorCode.InvalidXml.ToCode().Should().Be("SLNX0010");
ValidationErrorCode.ReferencedFileNotFound.ToCode().Should().Be("SLNX0011");
ValidationErrorCode.InvalidWildcardUsage.ToCode().Should().Be("SLNX0012");
ValidationErrorCode.XsdViolation.ToCode().Should().Be("SLNX0013");
ValidationErrorCode.FileNotFound.ToCode().Should().Be("SLNX001");
ValidationErrorCode.InvalidExtension.ToCode().Should().Be("SLNX002");
ValidationErrorCode.NotATextFile.ToCode().Should().Be("SLNX003");
ValidationErrorCode.InvalidXml.ToCode().Should().Be("SLNX010");
ValidationErrorCode.ReferencedFileNotFound.ToCode().Should().Be("SLNX011");
ValidationErrorCode.InvalidWildcardUsage.ToCode().Should().Be("SLNX012");
ValidationErrorCode.XsdViolation.ToCode().Should().Be("SLNX013");
}
}