mysociety / parlparse

The scraper/parser that produces data for TheyWorkForYou, PublicWhip, etc
Other
61 stars 22 forks source link

Add Ruff Formatter to parlparse #184

Closed ajparsons closed 1 month ago

ajparsons commented 2 months ago

Before we start having lots of PRs on actual content, I want to get a consistent formatter in.

This PR changes requirements.txt for poetry. As far as I'm aware the requirements.txt is only for dev reference - but having poetry would in principle mean it could diverge from the twfy requirement in future (the update script running in its own virtual environment).

Ruff is used to handle black, flake and isort (config matches the config used in LIH and in TWFY PR).

There's a specific problem here that this is an an old repo and we want to be able to check new scripts for good practice, while not fixing 60 errors on scripts that aren't used anymore.

To deal with this, script/lint has a bunch of extra rules ignored to handle the outstanding issues - while the ruff vscode extention and ruff check . --fix will detect the wider range of rule breaking.

I have additionally fixed a handful of scripts where the errors were real enough to not want to turn off that rule. This was all in error handling that would break if an error was found rather than the core stuff.

With this merged, I'd revisit the london-assembly PR to fit into this.

ajparsons commented 2 months ago

This doesn't cause any issues with the current https://github.com/mysociety/parlparse/pull/176/files PR