@@ -64,6 +64,43 @@ $ cd repos
6464$ pip install -e . --config-settings editable_mode=strict
6565```
6666
67+ ## Linting and Formatting
68+
69+ The command ` inv lint ` will lint your changes (using
70+ [ lint-diffs] ( https://github.com/AtakamaLLC/lint-diffs/ ) ) and ` inv format ` will
71+ format your changes (using [ darker] ( https://github.com/akaihola/darker ) ). This
72+ will allow us to incrementally bring this repo up to PEP8 compliance. There is
73+ [ a CI action] ( .github/workflows/lint.yaml ) to ensure that all new code is
74+ compliant.
75+
76+ To setup the linter commands locally, run the following commands in the root of
77+ the repository:
78+
79+ ``` sh
80+ # Create a virtual environment
81+ python -m venv venv
82+ source venv/bin/activate
83+ # Install lint dependencies
84+ pip install -r requirements.lint.txt
85+ # Run lint
86+ inv lint
87+ ```
88+
89+ If you get the error ` ERROR:darker.git:fatal: Not a valid commit name <hash> ` ,
90+ then it's likely because your local main branch is not up to date; either you
91+ need to rebase or merge. Note that ` darker ` reads from ` pyproject.toml ` for
92+ default settings.
93+
94+ If the lines you change are in a file that uses width 2 tabs (which are plenty
95+ in this repo), it will only change those lines and not the rest, which will
96+ likely break the code; in that case, you should probably just pass the whole
97+ file through black and just do it in the same commit. You can do that with the
98+ following command (using the same virtual environment as above):
99+
100+ ``` sh
101+ black < file>
102+ ```
103+
67104# COVIDcast
68105
69106At the present, our primary focus is developing and expanding the
0 commit comments