Skip to content

Linting: Reformat python code with black#297

Merged
arm4b merged 11 commits intomainfrom
feature/black-lint
Sep 7, 2022
Merged

Linting: Reformat python code with black#297
arm4b merged 11 commits intomainfrom
feature/black-lint

Conversation

@arm4b
Copy link
Copy Markdown
Contributor

@arm4b arm4b commented Sep 2, 2022

This PR adds black tool which enforces code formatting according to the common python standards.
See https://black.readthedocs.io/en/stable/

It's the start of a future series of PRs focused on improving the codebase standards, adding tests, and enforcing the CI checks that are expected from the project with the python codebase. See https://github.com/bitovi/bitops/projects/4 project. Partially implements #271

  • Add black - code reformatting tool
  • Add tox - pipeline/venv test runner
  • Add test-requirements.txt
  • Reformat python code with black
  • Run black in CI GH Actions for every PR
  • Update the development docs with instructions

Example quick start instructions:

pip3 install tox
tox -e black

@arm4b arm4b added enhancement ✨ New feature or request feature CI/CD labels Sep 2, 2022
@arm4b arm4b marked this pull request as ready for review September 6, 2022 14:47

### Python Style guide

* Use 4 spaces for a tab.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put this into the Coding Conventions section

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an outdated section "Coding Conventions" that was probably relevant to bash in the previous BitOps v1:
https://bitovi.github.io/bitops/contributing/#coding-conventions
That section was removed in this PR.

There is another section for bash and yaml formatting under the development page:
https://bitovi.github.io/bitops/development/development/#bash-style-guide

I propose to have only one place for the coding standards under development.md page to avoid confusion with scattered guidelines.

@arm4b arm4b requested a review from PhillypHenning September 6, 2022 15:53
# 4. ERROR

from .settings import BITOPS_logging_level, BITOPS_logging_color, BITOPS_logging_filename, BITOPS_logging_path
from .settings import (
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nifty, didn't know this was possible

@arm4b arm4b mentioned this pull request Sep 7, 2022
2 tasks
@arm4b arm4b merged commit 14f8607 into main Sep 7, 2022
@arm4b arm4b deleted the feature/black-lint branch September 7, 2022 15:31
@arm4b arm4b changed the title Reformat python code with black Linting: Reformat python code with black Sep 7, 2022
@arm4b arm4b added this to the v2.1.0 milestone Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants