uranusjr commented on issue #41641: URL: https://github.com/apache/airflow/issues/41641#issuecomment-2482303157
My best idea right now is to split this into two tools. We don’t really want to invest too much time into building a very rich CLI tool to show users what _need_ to be changed—we’ll effectively be rebuilding the error reporting interface in ruff (or flake8). Those squiggle lines, colors, error codes, and code context things are not easy to build. It is probably easiest to tack the linter part on Ruff—it is Rust, but the code to implement a lint rule isn’t that hard if you know Python AST and just a general idea about C-like languages. The rewrite part is a lot more difficult, so it’s probably better to implement this as a different tool in Python with libcst. I’m thinking something like ```console $ ruff check --select AIR This spits out lint errors with codes like AIR005 AIR123... $ airflow2to3 --select AIR005 -- path/to/dag/file.py This fixes the given error(s) in given file(s) in-place with a minimal CLI... ``` I plan to start experiementing some rules in Ruff to see how easy the first part actually is. We should be able to save a lot of effort if it is viable. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
