| 1 | # Refactoring the platform with lint |
| 2 | Inspiration: go/refactor-the-platform-with-lint\ |
| 3 | **Special Thanks: brufino@, azharaa@, for the prior work that made this all possible** |
| 4 | |
| 5 | ## What is this? |
| 6 | |
| 7 | It's a python script that runs the framework linter, |
| 8 | and then (optionally) copies modified files back into the source tree.\ |
| 9 | Why python, you ask? Because python is cool ¯\_(ツ)_/¯. |
| 10 | |
| 11 | Incidentally, this exposes a much simpler way to run individual lint checks |
| 12 | against individual modules, so it's useful beyond applying fixes. |
| 13 | |
| 14 | ## Why? |
| 15 | |
| 16 | Lint is not allowed to modify source files directly via lint's `--apply-suggestions` flag. |
| 17 | As a compromise, soong zips up the (potentially) modified sources and leaves them in an intermediate |
| 18 | directory. This script runs the lint, unpacks those files, and copies them back into the tree. |
| 19 | |
| 20 | ## How do I run it? |
| 21 | **WARNING: You probably want to commit/stash any changes to your working tree before doing this...** |
| 22 | |
| 23 | ``` |
| 24 | source build/envsetup.sh |
| 25 | lunch cf_x86_64_phone-userdebug # or any lunch target |
| 26 | m lint_fix |
| 27 | lint_fix -h |
| 28 | ``` |
| 29 | |
| 30 | The script's help output explains things that are omitted here. |