Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reformat codebase with the Black code formatter #877

Merged
merged 4 commits into from Jul 4, 2020

Commits on Jun 20, 2020

  1. Run code through black

    One should generally avoid applying large, style-only changes to
    existing code bases because they tend to make a complete mess of our
    ability to use 'git-blame' and related tools effectively. With that
    said, the code base is in pretty bad shape owing to its sheer age and
    we'd otherwise be fixing this stuff manually for years. Bite the bullet
    and run all the code through black [1] (specifically, 'black -S', to
    avoid unnecessary conversion of single quotes to double quotes) to
    address the worst of the issues. A future change will address the
    remaining issues like use of wildcard imports and commented out (dead)
    code.
    
    Note that black defaults to a max line length of 88, not 79 [2], which
    means we need to configure flake8 to allow this.
    
    [1] https://pypi.org/project/black/
    [2] https://black.readthedocs.io/en/stable/the_black_code_style.html
    
    Signed-off-by: Stephen Finucane <stephen@that.guru>
    Closes: rst2pdf#724
    Closes: rst2pdf#711
    stephenfin committed Jun 20, 2020
    Copy the full SHA
    825ba00 View commit details
    Browse the repository at this point in the history

Commits on Jun 29, 2020

  1. Resolve various style issues

    Mostly end of file/whitespace fixes.
    
    Signed-off-by: Stephen Finucane <stephen@that.guru>
    stephenfin committed Jun 29, 2020
    Copy the full SHA
    a6aff6b View commit details
    Browse the repository at this point in the history
  2. Add pre-commit and black configuration

    The pre-commit tool [1] can be used to validate black automatically
    before committing, saving the need to do so manually. Integrate it,
    initially for black and some other basic tests, with an aim to extend to
    flake8 and others later.
    
    Signed-off-by: Stephen Finucane <stephen@that.guru>
    stephenfin committed Jun 29, 2020
    Copy the full SHA
    8cfb14f View commit details
    Browse the repository at this point in the history
  3. travis: Start running black (via pre-commit) in CI

    Nothing too funky here. This is based on what black itself does [1].
    
    [1] https://github.com/psf/black/blob/master/.travis.yml
    
    Signed-off-by: Stephen Finucane <stephen@that.guru>
    stephenfin committed Jun 29, 2020
    Copy the full SHA
    dc07f24 View commit details
    Browse the repository at this point in the history