glm-tools / pyglmnet

Python implementation of elastic-net regularized generalized linear models
http://glm-tools.github.io/pyglmnet/
MIT License
279 stars 83 forks source link

Added the black code formatter #283

Closed tommyod closed 5 years ago

tommyod commented 5 years ago

Added black to CI and ran codebase through it.

Black is the uncompromising Python code formatter. By using it, you agree to cede control over minutiae of hand-formatting. In return, Black gives you speed, determinism, and freedom from pycodestyle nagging about formatting. You will save time and mental energy for more important matters.

Whether or not to use black is a preference, but over time it will probably make life easier.

codecov-io commented 5 years ago

Codecov Report

Merging #283 into master will not change coverage. The diff coverage is 63.39%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #283   +/-   ##
=======================================
  Coverage   73.74%   73.74%           
=======================================
  Files           4        4           
  Lines         617      617           
  Branches      124      124           
=======================================
  Hits          455      455           
  Misses        123      123           
  Partials       39       39
Impacted Files Coverage Δ
pyglmnet/metrics.py 100% <100%> (ø) :arrow_up:
pyglmnet/base.py 48.48% <33.33%> (ø) :arrow_up:
pyglmnet/utils.py 32.55% <37.5%> (ø) :arrow_up:
pyglmnet/pyglmnet.py 79.67% <65.64%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a80848c...d5fa2fd. Read the comment docs.

jasmainak commented 5 years ago

I'm not super convinced of black yet. I prefer people to write clean code in the first place rather than use a code formatter to fix it later. Perhaps I'll come around to it later :)

tommyod commented 5 years ago

I used to manually comply to PEP8. I still do it (mostly out of habit), but running an autoformatter afterwards is nice because it saves me time.

I see no disadvantage of using black (apart perhaps from the argument that manually crafted code is occasionally prettier): if you write clean code, then black does little with it. If the code is ugly, black makes it prettier faster than you can manually.

I'll leave it open for you to consider. I believe this PR would close #271.

jasmainak commented 5 years ago

@tommyod closing PR for now. We can revisit this later if there is a strong reason for adapting it