Add --lint support for requirements YAML files#133
Conversation
… tests, and requirements Agent-Logs-Url: https://github.com/demaconsulting/ReqStream/sessions/0fc31532-46f1-4661-a8c4-59d2c67d10b6 Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
…r -> behavior Agent-Logs-Url: https://github.com/demaconsulting/ReqStream/sessions/0fc31532-46f1-4661-a8c4-59d2c67d10b6 Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
|
@copilot I don't think you updated any documentation, and I don't think you created a new review-set for the new software unit. Please read https://raw.githubusercontent.com/demaconsulting/ContinuousCompliance/refs/heads/main/docs/file-reviews.md and then update as appropriate. You may also find https://raw.githubusercontent.com/demaconsulting/ContinuousCompliance/refs/heads/main/docs/requirements.md useful for making sure the requirements are good. |
…ser guide) Agent-Logs-Url: https://github.com/demaconsulting/ReqStream/sessions/b9784df3-8c7e-4868-a56f-350cc15d4a2c Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Done in commit a727d95: Review-set: Added Documentation updates:
|
|
@copilot So it does seem we're missing a docs/design pandoc folder containing:
These should be written, and then added to the .reviewmark.yaml files for each review-set. The goal would be that the design document contains the detailed design of ReqStream, and the reviews contain enough information (requirements, design, code, tests) for formal reviews. |
… software units Agent-Logs-Url: https://github.com/demaconsulting/ReqStream/sessions/5ed4bb83-dde9-4099-af6f-47856f47a4db Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Done in commit 8d2c56c. Created
Each design doc covers the unit's responsibilities, data model, key algorithms, method contracts, and interactions with other units. Also updated
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 please use the @code-review agent to review all review-sets in the .reviewmark.yaml file. Run the reviews separately so the contexts dont collide. |
|
@copilot please continue with the last request |
- platform-requirements.yaml: add ReqStream_Lint to all 6 platform requirements - program.md: fix version priority action (no PrintBanner), PrintBanner output (3 lines not 1), EnforceRequirementsCoverage parameter list - validation.md: add TemporaryDirectory section, correct DirectorySwitch description, fix test method step 1 description - requirements.md: correct _allRequirements type from Dictionary<string,string> to Dictionary<string,Requirement> - tracematrix.md: rename LoadTestResultFile→ProcessTestResultFile, fix GetTestResult signature to remove sourceFilter param - ValidationTests.cs: add missing assertion for ReqStream_Lint - Passed - LinterTests.cs: add 5 new tests for blank values (req id, req title, mapping id, test name, tag name) Agent-Logs-Url: https://github.com/demaconsulting/ReqStream/sessions/9c0775a2-8fea-461e-abb7-0b8db2817031 Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
All 8 review-sets reviewed separately and actionable findings addressed in commit 91047bc: Reviews completed (all: Pass with Minor Issues, except OTS-Dependencies which flagged missing dependency docs):
Issues fixed:
The OTS-Dependencies review flagged that several NuGet packages (YamlDotNet, TestResults, FileSystemGlobbing) lack OTS requirement files, and that some existing OTS files reference test names from external tools' self-validation runs. These are pre-existing gaps unrelated to this PR's changes — I'd suggest tracking them as separate issues. |
- Linter.cs: change visitedFiles to StringComparer.Ordinal (was OrdinalIgnoreCase) - Linter.cs: ParseYaml now returns YamlNode? so non-mapping roots emit an error - Linter.cs: add GetSequenceChecked helper; detect key-exists-but-wrong-type for sections/mappings/requirements fields and report an error - LinterTests.cs: add Linter_Lint_WithBlankMappingTestName_ReportsError - LinterTests.cs: add Linter_Lint_WithNonMappingRoot_ReportsError - unit-linter.yaml: split ReqStream-Lint-UnknownMappingField from new ReqStream-Lint-MissingMappingId; add ReqStream-Lint-BlankTestName and ReqStream-Lint-BlankTagName; extend ReqStream-Lint-MissingRequirementFields to cover blank id/title - linter.md: update design doc to reflect non-mapping root check and sequence-type-mismatch detection Agent-Logs-Url: https://github.com/demaconsulting/ReqStream/sessions/b010a2d9-07e7-492f-a5fb-4ebeb03ed061 Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Applied all 6 review findings in commit bb9fa05:
All 167 tests pass; all linters clean; CodeQL: 0 alerts. |
|
@copilot did you remember to update the README |
- Add Linting to Features list - Add --lint to help output block - Update self-validation output to show 6 tests including ReqStream_Lint - Add ReqStream_Lint description to self-validation section Agent-Logs-Url: https://github.com/demaconsulting/ReqStream/sessions/8a2ef406-6eec-4487-b1b1-0dd6e402fa20 Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Updated in commit 0ebedf5:
All linters pass. |
ReqStream had no way to validate requirements file structure short of attempting a full processing run that aborts on the first error. This adds
--lintto inspect all requirement files and report all issues in one pass.Description
Core Linting (
src/DemaConsulting.ReqStream/Linter.cs)New
Linterclass using YamlDotNet's representation model (not the deserializer) to walk YAML trees with full position info:sections,mappings,requirements), missing required fields (titlefor sections;id+titlefor requirements;idfor mappings), blank field values (id, title, test names, tag names), duplicate requirement IDs across all filesincludes:directives recursively, deduplicating visited files using case-sensitive path comparison{file}({line},{col}): error: {description}{firstFile}: No issues foundCLI Integration
Context.cs: AddedLintbool property +--lintargumentProgram.cs: Lint runs as Priority 4 (after--validate, before requirements processing); added to help textSelf-Validation (
src/DemaConsulting.ReqStream/Validation.cs)Added
RunLintTest— total self-validation tests: 5 → 6.Tests
LinterTests.cs(new): 29 unit tests covering all lint scenarios including blank-value validation (blank req id, req title, mapping id, test name in requirements and mappings, tag name), non-mapping YAML root, and blank mapping test nameProgramTests.cs: UpdatedTotal Tests: 5→Total Tests: 6ValidationTests.cs: Added assertion forReqStream_Lint - PassedRequirements
docs/reqstream/unit-linter.yaml(new): 14 linting requirements covering all detection scenarios including blank-value and type-mismatch checksdocs/reqstream/unit-program.yaml: AddedReqStream-Prog-Lintrequirements.yaml: Includesunit-linter.yamldocs/reqstream/platform-requirements.yaml: AddedReqStream_Lintto all 6 platform requirements (Windows, Linux, macOS, .NET 8/9/10)Review-Sets (
.reviewmark.yaml)ReqStream-Linterreview-set groupingdocs/reqstream/unit-linter.yaml,docs/design/linter.md,src/**/Linter.cs, andtest/**/LinterTests.csdocs/design/{unit}.mdto each existing software unit review-set (Context, Program, Validation, Requirements, TraceMatrix)docs/design/**/*.mdtoneeds-reviewpatterns so all design documents require formal review coverage@code-reviewagent; actionable findings addressedDesign Documents (
docs/design/)New pandoc folder providing detailed design documentation for all software units, enabling complete formal reviews (requirements + design + source + tests):
title.txt— YAML front matter for the design document PDFdefinition.yaml— Pandoc definition listing all unit design files as inputintroduction.md— Document introduction chapter (purpose, scope, conventions, references)program.md—Program.cs: version reflection, priority-dispatch table, error-handling contract,ProcessRequirementsand enforcement algorithmscontext.md—Context.cs: CLI switch-based parser, all properties,ExpandGlobPattern, Write/WriteError, IDisposable patternvalidation.md—Validation.cs: 6 self-validation tests,TemporaryDirectoryandDirectorySwitchhelpers, results file format dispatchrequirements.md—Requirements.cs/Section.cs/Requirement.cs: data model, YAML intermediates,ReadFilealgorithm,MergeSection,ValidateCyclesDFS, export with tag filteringtracematrix.md—TraceMatrix.cs:TestMetrics/TestExecutionrecords, source-specific test matching, coverage calculation, exportlinter.md—Linter.cs: known field sets, error format with position, non-mapping root detection, sequence-type-mismatch detection, cross-file deduplication, full linting call chainArchitecture, User Guide & README
ARCHITECTURE.md: AddedLinterto the components table and mermaid flowchart; updated execution flow to include--lintas step 5; added full Linter component description section.docs/guide/guide.md: Added--lintto the key features list and CLI options table; added a "Linting Requirements Files" subsection with usage examples, output examples, and a full table of detected issues; updated the self-validation report example to reflect 6 tests.README.md: Added🔍 Lintingto the features list; added--lintto the help output block; updated the self-validation example output to show 6 tests includingReqStream_Lint; addedReqStream_Lintdescription to the self-validation test list.Usage
Type of Change
Related Issues
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.ReqStream --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
ExpandGlobPattern(existing behavior) only handles relative glob patterns — absolute paths passed to--requirementsare silently ignored. This is pre-existing and unrelated to this change; all tests useDirectorySwitch+ relative paths to work around it, consistent with existing test patterns.Several pre-existing OTS dependency gaps were identified during code review (YamlDotNet, TestResults, FileSystemGlobbing lack OTS requirement files). These are unrelated to this PR's scope and should be tracked as separate issues.
📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.