-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Major rewrite to make things more consistent and extensible #664
Conversation
**IMPORTANT: Work in progress, not yet functional!** The code in Strudy did the same thing in multiple ways: - The main CLI was linked to the first type of analysis reports, that still get published to `w3c/webref-analysis`. - A few CLIs were there, used mainly for exploration purpose. - The study modules could sometimes be used as CLI, for no apparent reason. - The study modules used different conventions for inputs/outputs - The reporting code was somewhat separated from the rest, whereas it could be useful to extend it. - Preparing flexible reports and amending the "file an issue" workflow was a bit tedious. This rewrite attempts to solve the above by: - Rewriting study modules to expose one similar study function - Adding a generic study module that knows about all anomaly types, dispatches the study to the different study modules depending on the request, and can structure and format the result as needed in markdown to file one or more issues. - Adding a few tests to be more confident that the analyses are doing the right thing! - **(Not done yet)** Updating the entry points to use the new study module - **(Not done yet)** Getting rid of all side CLIs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a first pass at review the refactoring, with a few minor nits; as always, a superb set of improvements :)
Time to rewrite the CLI. The CLI now gets divided into commands. The only available command for now is `inspect`, but a `view` command could perhaps be created afterwards to create views on the crawl report, such as the previous dependencies report (what specs have a normative reference on a given spec). New options got added to the CLI: ``` -f, --format <format> report markdown or json (default: "markdown") -i, --issues <folder> report issues as markdown files in the given folder -m, --max <max> maximum number of issue files to create/update (default: 0) --structure <structure> report structure (default: "type+spec") --update-mode <mode> what issue files to update (default: "new") -w, --what <what...> what to analyze (default: ["all"]) ``` Library code updated to fix a few bugs, integrate feedback, and complete the logic where needed. Tests remain fairly minimal for now.
The `--update-mode` option now also accepts an `old` value that preserves existing issue files by default, except when the analysis no longer detects any error for them.
The script used to run the study *and* handle Git and GitHub commands. It now expects that some analysis got run with the main strudy CLI, and only handles Git and GitHub commands. One update is that the script can also create pull requests for issue files that got deleted during the analysis (because study did not reveal any issue with the underlying spec anymore).
Delete all the things! The previous CLIs should no longer be needed as the main Strudy CLI now should take care of everything. The `study-crawl` CLI (and companion `generate-report`) is a sort of exception to the rule: all anomalies it reported are now covered by the CLI, but the CLI could also output a dependencies report, compute a diff between two reports, and generate an HTML report. New Strudy CLI no longer can do any of that. This update drops the files anyway. We could perhaps keep them around, but we haven't maintained the code, and `w3c/webref-analysis` is, I think, the only project that uses it and I propose to shelve that project now that we have, at least theoretically, a more flexible way to create issue reports. The NPM package would only export the main `study` function, because there shouldn't be any need to export the individual study functions such as `studyWebIdl` anymore. We'll have to update Webref tests accordingly. Project dependencies adjusted to drop `node-pandoc`... and `node-fetch` which was no longer being used in any case.
This refreshes the boilerplate text in existing issue files so that the CLI can more easily detect whether a change is warranted, and stops reporting that the files need to be updated in particular.
Forgotten in a previous commit
PR should now be ready for review. I updated the initial description. I also tried to split further updates into coherent commits to hopefully ease review. I guess the best way to see what this does is to try it locally. For example:
This will make changes to your local
|
I had reviewed the commits as they come in and they LGTM. I also tried the commands locally - the last one fails due to the comment I raised (although I'm not sure if it points to another failure than just the code optimism) |
The code in Strudy did the same thing in multiple ways:
w3c/webref-analysis
.This rewrite attempts to solve the above by:
Breaking changes: Yes! ;)
Issues reporting should work as before, but any external project making use of Strudy will need to adjust calls and/or use of the CLI. Main breaking changes are:
strudy
CLI remains. Andfile-for-review
, but that's more intended for internal usage.inspect
one.study
function.Updates to
w3c/webref-analysis
will no longer be possible as a result. I'm not aware of anyone relying on that project, so it seems fine to shelve it and archive the repository.Additional notes:
brokenLinks
for now in the job but we'll probably want to start reporting issues on additional anomaly types. That's the overall motivation for these changes!