feat: Add --lint support for validating definition files#27
Conversation
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com> Agent-Logs-Url: https://github.com/demaconsulting/ReviewMark/sessions/a75bab3c-44b6-4dcf-8da7-eb85c41f6ec3
…ge assertions, corrupted YAML tests Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com> Agent-Logs-Url: https://github.com/demaconsulting/ReviewMark/sessions/245f177b-039d-4058-a8eb-3fce0818cd47
…pport, and stronger test assertions Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com> Agent-Logs-Url: https://github.com/demaconsulting/ReviewMark/sessions/7318deb4-3700-47ba-b4b8-b7c3e37c4b4e
|
@copilot Whups, you're right - reviewmark doesn't need includes - it's just in a single file. |
… file Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com> Agent-Logs-Url: https://github.com/demaconsulting/ReviewMark/sessions/25f4d0e6-fdf3-493b-803c-d19cfb0967fd
Removed in commit |
There was a problem hiding this comment.
Pull request overview
Adds a new --lint command to ReviewMark to validate .reviewmark.yaml definition files, improving configuration feedback quality (including filename and YAML line/column reporting) and extending self-validation/test coverage around the new behavior.
Changes:
- Added
--lintflag parsing (Context) and a new lint execution path inProgram.Run(). - Refactored
ReviewMarkConfiguration.Load/Parseto centralize YAML deserialization/validation and improve exception messages with filename (+ line/column for YAML syntax errors). - Added/updated unit tests and self-validation coverage; introduced a
TestDirectoryhelper to reduce temp-dir boilerplate; updatedrequirements.yamlaccordingly.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/DemaConsulting.ReviewMark/Context.cs | Adds Lint flag and --lint argument parsing. |
| src/DemaConsulting.ReviewMark/Program.cs | Adds --lint help text and lint execution path (RunLintLogic). |
| src/DemaConsulting.ReviewMark/ReviewMarkConfiguration.cs | Refactors YAML parsing/validation helpers; improves Load exception messages with filename/line/column. |
| src/DemaConsulting.ReviewMark/Validation.cs | Adds ReviewMark_Lint self-validation test. |
| test/DemaConsulting.ReviewMark.Tests/TestDirectory.cs | New disposable temp-directory helper for tests. |
| test/DemaConsulting.ReviewMark.Tests/ContextTests.cs | Adds tests validating --lint flag parsing behavior. |
| test/DemaConsulting.ReviewMark.Tests/ProgramTests.cs | Adds lint-focused tests and refactors temp-dir usage to TestDirectory. |
| test/DemaConsulting.ReviewMark.Tests/ReviewMarkConfigurationTests.cs | Adds tests asserting improved Load() error message quality. |
| requirements.yaml | Adds a --lint requirement and links it to relevant tests across platforms/runtimes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…uration.Lint Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com> Agent-Logs-Url: https://github.com/demaconsulting/ReviewMark/sessions/0745bda8-94ca-4460-a7b2-c361d77474c0
… assertion Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com> Agent-Logs-Url: https://github.com/demaconsulting/ReviewMark/sessions/0745bda8-94ca-4460-a7b2-c361d77474c0
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot apply changes based on the comments in this thread Also the test is getting errors on windows - I don't think a file is being closed before being read: |
|
@copilot And remember the README.md and User Guide should be expanded to include the lint option, usage examples, and possibly needs updates to the self-validation for the new tests. |
…es, TestDirectory safety, shared type validator Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com> Agent-Logs-Url: https://github.com/demaconsulting/ReviewMark/sessions/206afe15-d999-4902-a3d6-381cc23061cb
Applied in commit Windows file lock fix: All lint tests that used Consistent error messages: Both missing-filePath lint errors fixed — unknown evidence-source type and duplicate review ID now include
|
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com> Agent-Logs-Url: https://github.com/demaconsulting/ReviewMark/sessions/a5fb2a08-3a4d-4a2e-908c-d95bbe84dae0
Done in commit README.md: added docs/guide/guide.md: added a full Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot Linting failed - English vs American spelling. |
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com> Agent-Logs-Url: https://github.com/demaconsulting/ReviewMark/sessions/2712fd02-b8b6-44bc-99bf-2a973437ffbb
Fixed in commit |
Malcolmnixon
left a comment
There was a problem hiding this comment.
I think the linting output should follow the standard for common linting reports. Something like "[location]: [issue]" and if there are no issues then "[definitionFile]: No issues found".
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com> Agent-Logs-Url: https://github.com/demaconsulting/ReviewMark/sessions/3576c6ae-5203-472e-b193-49f8d6e46feb
Done in commit
The severity token is |
Adds a
--lintcommand that reads the.reviewmark.yamlconfiguration file and reports all structural and semantic issues in a single pass, with non-zero exit code on failure. Lint output follows the standard[location]: [severity]: [issue]format used by common linting tools, making it easy to integrate with editors and CI pipelines.Description
Context.csLintboolean property and--lintflag parsing (mirrors--validatepattern)Program.cs--lintto help textRun()(between self-validation and main tool logic)RunLintLogicthat callsReviewMarkConfiguration.Lintand reports every returned error using the standard linting format; non-zero exit code on any error[definitionFile]: No issues foundReviewMarkConfiguration.csReviewMarkConfigurationHelpersclass containingIsSupportedEvidenceSourceType,DeserializeRaw, andBuildConfigurationmethods, allowing file-local YAML types to appear in method signaturesLoadnow embeds the filename in all exceptions:"Failed to parse 'filename' at line X, column Y: <message>""Invalid configuration in 'filename': <message>""Failed to read configuration file 'filename': <message>"BuildConfigurationnow validates theevidence-sourcetype isurlorfileshare, soLoadproduces a clear error for unsupported types rather than a later failure inReviewIndex.LoadLint(filePath)static method that accumulates all detectable errors in one pass without throwing, returning them in the standard[location]: [severity]: [issue]format:file:line:col: error: <message>(includes precise position)file: error: <message>evidence-sourceblock, each review set, and detects duplicate review set IDsValidation.csReviewMark_Lintself-validation test (checks forNo issues foundin output)TestDirectory.cs(new)TestDirectory— anIDisposablehelper class for the test project that creates and auto-deletes a temporary directory, replacing the repetitivetry/finallypattern across testsDispose()wraps deletion in try/catch forIOExceptionandUnauthorizedAccessExceptionso transient file-lock failures on Windows do not mask real assertion failuresTests
ContextTests:Context_Create_LintFlag_SetsLintTrue,Context_Create_NoArguments_LintIsFalseProgramTests: refactored elaborate and lint tests to useTestDirectory; all lint tests disposeContextbefore reading the log file to release the Windows file handle; updated all error tests to assert"error:"(lowercase, matching the new format) plus specific content (filename, error type); added:Program_Run_WithLintFlag_CorruptedYaml_ReportsErrorProgram_Run_WithLintFlag_MissingEvidenceSource_ReportsErrorProgram_Run_WithLintFlag_MultipleErrors_ReportsAllReviewMarkConfigurationTests: added three new tests covering filename-in-error, line-in-error, and all-errors-in-one-pass behaviourrequirements.yamlReviewMark-Cmd-Lintrequirement linked to all 13 test casesReviewMark_Lintto all platform requirements (Windows/Linux/macOS, .NET 8/9/10)README.md--lintto the Features list, Usage examples, and Command-Line Options tableReviewMark_Lintto the Self Validation test report example and descriptions (totals updated: 8 → 9)docs/guide/guide.md## Lint Definition Filesection covering purpose, running lint, what lint checks, and lint error message format with examples in the standard[location]: [severity]: [issue]style--lintto the Command-Line Options tableReviewMark_Lintto the validation report example and test descriptions (totals updated: 8 → 9)Example 4: Lint a Definition File(with basic,--definition, and silent/log variants); subsequent examples renumberedType of Change
Pre-Submission Checklist
Before submitting this pull request, ensure you have completed the following:
Build and Test
dotnet build --configuration Releasedotnet test --configuration Releasedotnet run --project src/DemaConsulting.ReviewMark --configuration Release --framework net10.0--no-build -- --validateCode Quality
dotnet format --verify-no-changesQuality Checks
Please run the following checks before submitting:
cspell "**/*.{md,cs}"markdownlint "**/*.md"yamllint .Testing
Documentation
Additional Notes
The lint check reports all detectable issues rather than stopping at the first error, so users can fix multiple problems in one pass. Output follows the standard
[location]: [severity]: [issue]convention used by common linting tools:definition.yaml:3:5: error: (parse details)definition.yaml: error: Configuration is missing required 'evidence-source' block.definition.yaml: No issues foundThe severity token is
errorfor all current findings. The format is designed to acceptwarningalongsideerrorif warnings are added in future. The sharedIsSupportedEvidenceSourceTypehelper ensures theurl/filesharetype check is consistent betweenBuildConfiguration(used byLoad) andLint.Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.