rs-station / reciprocalspaceship

Tools for exploring reciprocal space
https://rs-station.github.io/reciprocalspaceship/
MIT License
29 stars 13 forks source link

Pre commit + autofixes #84

Closed ianhi closed 3 years ago

ianhi commented 3 years ago

To see what the changes would look like. I wouldn't blame you for removing the autoformating but it was nice to check out flake8 errors and run autoflake8 to remove a bunch of unused assignments etc. Remaining flake8 error (not autofixable):

pip install pre-commit
pre-commit run --all-files
reciprocalspaceship/commandline/mtzdump.py:33:1: E722 do not use bare 'except'
tests/data/create_test_mtz.py:11:1: E722 do not use bare 'except'
reciprocalspaceship/io/mtz.py:112:13: F841 local variable 'mtzcol' is assigned to but never used
reciprocalspaceship/utils/phases.py:10:12: E712 comparison to True should be 'if cond is True:' or 'if cond:'
reciprocalspaceship/utils/phases.py:12:14: E712 comparison to False should be 'if cond is False:' or 'if not cond:'
reciprocalspaceship/io/crystfel.py:65:9: E731 do not assign a lambda expression, use a def
reciprocalspaceship/io/crystfel.py:193:33: F841 local variable 'is_chunk' is assigned to but never used
tests/test_dataset.py:30:30: E712 comparison to True should be 'if cond is True:' or 'if cond:'
tests/test_dataset.py:508:33: E713 test for membership should be 'not in'
reciprocalspaceship/dataset.py:646:30: F541 f-string is missing placeholders
reciprocalspaceship/dataset.py:985:30: F541 f-string is missing placeholders
reciprocalspaceship/dataset.py:1033:34: F541 f-string is missing placeholders
reciprocalspaceship/dataset.py:1035:34: F541 f-string is missing placeholders
reciprocalspaceship/dataset.py:1037:34: F541 f-string is missing placeholders
reciprocalspaceship/dataset.py:1039:34: F541 f-string is missing placeholders
reciprocalspaceship/dataset.py:1172:30: F541 f-string is missing placeholders
reciprocalspaceship/dataset.py:1182:9: F841 local variable 'hkls_isym' is assigned to but never used
reciprocalspaceship/algorithms/scale_merged_intensities.py:281:8: F841 local variable 'Sig' is assigned to but never used
reciprocalspaceship/algorithms/scale_merged_intensities.py:316:5: F811 redefinition of unused 'rs' from line 5
docs/conf.py:18:1: E402 module level import not at top of file
docs/conf.py:149:1: E302 expected 2 blank lines, found 1
reciprocalspaceship/__init__.py:12:1: E402 module level import not at top of file
reciprocalspaceship/__init__.py:14:1: E402 module level import not at top of file
reciprocalspaceship/__init__.py:15:1: E402 module level import not at top of file
reciprocalspaceship/__init__.py:18:1: E402 module level import not at top of file
reciprocalspaceship/__init__.py:23:1: E402 module level import not at top of file
reciprocalspaceship/__init__.py:24:1: E402 module level import not at top of file
reciprocalspaceship/__init__.py:25:1: E402 module level import not at top of file
reciprocalspaceship/__init__.py:26:1: E402 module level import not at top of file
reciprocalspaceship/__init__.py:27:1: E402 module level import not at top of file
reciprocalspaceship/__init__.py:28:1: E402 module level import not at top of file
reciprocalspaceship/__init__.py:29:1: E402 module level import not at top of file
reciprocalspaceship/__init__.py:30:1: E402 module level import not at top of file
reciprocalspaceship/__init__.py:31:1: E402 module level import not at top of file
reciprocalspaceship/__init__.py:32:1: E402 module level import not at top of file
reciprocalspaceship/__init__.py:33:1: E402 module level import not at top of file
reciprocalspaceship/__init__.py:34:1: E402 module level import not at top of file
reciprocalspaceship/__init__.py:35:1: E402 module level import not at top of file
reciprocalspaceship/__init__.py:36:1: E402 module level import not at top of file
reciprocalspaceship/__init__.py:37:1: E402 module level import not at top of file
reciprocalspaceship/__init__.py:38:1: E402 module level import not at top of file
reciprocalspaceship/__init__.py:39:1: E402 module level import not at top of file
reciprocalspaceship/__init__.py:40:1: E402 module level import not at top of file
reciprocalspaceship/__init__.py:41:1: E402 module level import not at top of file
tests/utils/test_phases.py:43:12: E712 comparison to True should be 'if cond is True:' or 'if cond:'
reciprocalspaceship/io/precognition.py:73:13: F841 local variable 'sg' is assigned to but never used
reciprocalspaceship/dtypes/__init__.py:27:1: E722 do not use bare 'except'
reciprocalspaceship/dtypes/__init__.py:31:1: E402 module level import not at top of file
tests/io/test_mtz.py:97:12: E713 test for membership should be 'not in'
JBGreisman commented 3 years ago

Thanks @ianhi! While I agree with the sentiment of imposing a consistent style through pre-commit style automations, I think I'd rather take this a bit more gradually to avoid some of these changes that broke things.

I will plan to close this PR, but I will revisit this again shortly with a new PR to work on better setting code style conventions in rs.