Generate and validate the XML documentation - #94
Draft
HowardvanRooijen wants to merge 1 commit into
Draft
HowardvanRooijen wants to merge 1 commit into
HowardvanRooijen wants to merge 1 commit into
Conversation
No project set GenerateDocumentationFile, so the compiler never parsed a doc comment and the package shipped no documentation file. A malformed comment reached #81 and was caught by a reviewer rather than the build, despite TreatWarningsAsErrors. The setting now goes on in Directory.Build.props for every project. Malformed XML and unresolvable crefs are build errors from here, and the packable projects ship their documentation. CS1591 - a public member with no comment - is enforced for Z3.Linq only; the test, examples and demo projects suppress it, each saying why in its project file. Turning it on found three defects this stack had already introduced: the documentation for GetSolution<T> had come loose from its method when two helpers were inserted between them, and was reporting a typeparam and three params that its new host does not have. It is back on the method, with the template parameter it gained in #78. The 21 public members that had no comment - Environment and its members, ExpressionVisitor, the two rewriter interfaces and the three attributes, and Optimization - are documented. Two negative controls confirm the guard has teeth: a broken cref is error CS1574, and a duplicated closing tag in a test remark is error CS1570. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #82.
The defect
No project set
GenerateDocumentationFile, so the compiler never parsed a doc comment. Twoconsequences: the test suite's documentation - which carries most of the reasoning behind this
stack - was unvalidated, and a malformed comment reached #81 and was caught by a reviewer rather
than the build, despite
TreatWarningsAsErrors; and the package shipped no documentation file,so consumers got no IntelliSense for anything.
What turning it on found first
Measured before any other change, with
-p:GenerateDocumentationFile=trueon the command line:Z3.Linq<param>tags forcontext,modelandenvironmenton a method with no such parametersmemberandinstancewith no tag on the same method<typeparam name="T">on a method with noTThe last three rows are one defect this stack introduced: the documentation for
GetSolution<T>came loose from its method when #75 insertedIsCollectionbetween them, and#78 then inserted
GetMemberValuebefore that - so the block attached toGetMemberValue,describing a
T, acontext, amodeland anenvironmentit does not have. Neither PR couldhave noticed, because nothing parsed the comment. It is back on
GetSolution<T>, with thetemplateparameter it gained in #78. That is the guard proving its worth before it exists.The change
GenerateDocumentationFile=trueinDirectory.Build.props, for every project. Malformed XMLand unresolvable crefs are build errors from here, and the packable projects ship their
documentation. CS1591 is enforced for
Z3.Linqonly; the test, examples and demo projectssuppress it, each with a comment in its own project file saying why - a test's name is its
documentation, sample types are illustrations rather than an API, and the demo is a console
program. That answers the issue's open question about where the settings belong: the setting is
global, the suppression is per project, next to the reason.
The 21 public members are documented.
Environmentand its three members,ExpressionVisitor,ITheoremGlobalRewriterandITheoremPredicateRewriterand their methods,the three attributes with their constructors and properties, and
Optimizationwith both values.Each comment says what the thing is for and, where it matters, when a wrong use fails - a
rewriter type that does not implement the interface is rejected at solve time, not when the
attribute is applied; a predicate rewriter that returns its input is refused; a mapped type
without the right constructor fails when the solution is read.
Environment.IsArraysays plainlythat nothing reads it, and points at #89.
Verification
dotnet build solutions/Z3.Linq.slnx -c Release- clean: 0 warnings, 0 errors, withTreatWarningsAsErrorson and documentation generation on for all four projects./build.ps1 -Configuration Release- 46 tasks, 0 errors, 0 warningslib/net10.0held only the assembly;after,
lib/net10.0holdsZ3.Linq.dlland a 47,833-byteZ3.Linq.xml. Straight from the ZeroFailed pipeline: every earlier package in_packageslists the dll alone, andZ3.Linq.2.0.2-xml-docs.47.nupkglists both.Z3.Linq.Examplesships its 4 KB file tooZ3.Linq.xmldocuments 93 membersNegative controls
Both run against the final code and restored byte-identical afterwards, because a clean build
proves nothing until the check has been seen to fail:
Environmentchanged toExpressionVisitor.NoSuchMembererror CS1574: XML comment has cref attribute 'NoSuchMember' that could not be resolved</remarks>in a test class - the exact defect from #81error CS1570: XML comment has badly formed XML -- 'End tag was not expected at this location.'What this does not catch
Recorded on the issue and worth repeating here: the defect Copilot found on #86 was an inaccurate
<returns>- well-formed XML, resolving crefs, wrong sentence. This setting would not have caughtit and nothing mechanical will. It catches the malformed-XML and broken-reference classes, which
is what it found on #81 and what it found in this stack.
Coverage unchanged at 88.1% line (693 of 786) and 77.5% branch (459 of 592), as it should be for a change that touches no behaviour.
Release note
Releases remain on hold under #60 until Microsoft.Z3 5.x reaches nuget.org. This is the change
the issue asked to have in place before that hold lifts, so the first published 2.x carries its
documentation.