NREL / buildstockbatch

Other
21 stars 14 forks source link

Adding black formatter pre-commit #403

Closed nmerket closed 11 months ago

nmerket commented 11 months ago

Pull Request Description

Adding pre-commit and black code formatter.

Checklist

Not all may apply

github-actions[bot] commented 11 months ago

File Coverage
All files 86% :white_check_mark:
base.py 90% :white_check_mark:
eagle.py 77% :white_check_mark:
exc.py 57% :white_check_mark:
local.py 70% :white_check_mark:
postprocessing.py 84% :white_check_mark:
utils.py 96% :white_check_mark:
sampler/base.py 79% :white_check_mark:
sampler/downselect.py 33% :white_check_mark:
sampler/precomputed.py 93% :white_check_mark:
sampler/residential_quota.py 61% :white_check_mark:
test/test_docker.py 33% :white_check_mark:
test/test_validation.py 97% :white_check_mark:
workflow_generator/base.py 90% :white_check_mark:
workflow_generator/commercial.py 53% :white_check_mark:
workflow_generator/residential_hpxml.py 86% :white_check_mark:

Minimum allowed coverage is 33%

Generated by :monkey: cobertura-action against ba56460b1ba56c74149690c23551b2187d452f37

shorowit commented 11 months ago

Note that as an alternative to developers having to install pre-commit, there are services that will run the pre-commit automatically. Like this one. It's free and integrates with GitHub.

shorowit commented 11 months ago

https://github.com/pre-commit/action even says:

"this action is in maintenance-only mode and will not be accepting new features.

generally you want to use pre-commit.ci which is faster and has more features."

rajeee commented 11 months ago

Can we keep 120 line length and avoid excessive reformatting of the code base?

nmerket commented 11 months ago

@rajee I'm open to it. It looks like to set a custom line length, I'd need to use a pyproject.toml. However, buildstockbatch is using setup.py. We'll need to convert the setup.py into a pyproject.toml. Would you be able to take a stab at that?

rajeee commented 11 months ago

@rajee I'm open to it. It looks like to set a custom line length, I'd need to use a pyproject.toml. However, buildstockbatch is using setup.py. We'll need to convert the setup.py into a pyproject.toml. Would you be able to take a stab at that?

Glad you got it sorted without switching the whole project into pyproject.toml. I don't have a good experience with pyproject.toml - I tried using it for buildstock-query but had to revert back to setup.py because at that time, the toml version didn't support editable mode installation.