Coding 2022-03-23
Screw waiting for things.
I think I've got nearly everything I need for wrapping command lines, so let's go.
I'm starting with flake8. For reference, here's the general command again:
flake8 --format=html --htmldir <generated path> --isort-show-traceback <path to root>/src <path to root>/tests
And it has requirements like:
- flake8
- flake8-black
- flake8-comprehensions
- flake8-docstrings
- flake8-html @ <a bunch of nonsense>
- flake8-isort
- flake8-pytest-style
- flake8-rst
- flake8-rst-docstrings
- flake8-type-checking
The majority of these plugins don't require anything except to be installed. If we divide those up, with the ones that need special handling first...
- flake8-html
- flake8-isort
And, everything else:
- flake8-black
- flake8-comprehensions
- flake8-docstrings
- flake8-pytest-style
- flake8-rst
- flake8-rst-docstrings
- flake8-type-checking
I bet I could convert that one command-line flag for flake8-isort into a bit of flake8 config, which would give me a bunch of things that merely need to be installed. I don't have a strong sense for what would be better for people who aren't me, but moving stuff from the command line into the config files certainly makes things easier within a repository.
(Source: I couldn't figure out why I was getting weird errors from running mypy directly instead of through MOTR, until I figured out that I could convert some static environment variable stuff I was doing into a config line.)
With that in mind, all I really need to code is handling for flake8-html, and everything else should probably get some kind of generic something.
This does raise the question, is there anything else in the motrfile I can do this to?
So, pytest has output stuff which needs to integrate with the higher-level abstractions, and some stuff that might or might not be needed in the automated case, but definitely isn't needed if you're invoking it manually, so, eh.
Looks like coverage has some stuff in the HTML output that it probably makes more sense to live in config.
Oh no, I just remembered that I think some of the coverage configs need to be generated on a per-command basis. Hm, that's going to be workable, but also confusing. Or maybe I can put it all together at once in some way...
In any case, the immediate goal is to figure out how to best collect together this kind of "just install a package" stuff that's so common. It's getting late, so let's just see about some quick plans:
- Create a helper function in flake8.py for now, until I figure out the right way to generalize it. Unless... Something like Command.install_plugin()... Or some kind of nice wrapper around Label[Pip]...
- Start working on the tests, focusing on building up the test data first.
- Remove unneeded lines from flake8.py.
- For the actual tests, focus on validating the registry generated from the test data.
- Fill things in until I have full coverage and the ability to handle all of the cases that the current motrfile does, plus some low-effort nice-to-haves.
Anyway, I'll have time later to think about this. For now, I'm getting pretty tired.
Good night.