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

Apply blacken-docs / the black code formatter #26

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MartinThoma
Copy link
Contributor

Black is becomming the de-facto standard for code formatting in
Python. It makes sure code looks similar in many projects and it
leads to minimal diffs.

MartinThoma and others added 2 commits February 12, 2022 09:07
Black is becomming the de-facto standard for code formatting in
Python. It makes sure code looks similar in many projects and it
leads to minimal diffs.
@zedr
Copy link
Owner

zedr commented Feb 20, 2022

Makes sense. Before I merge this, I'll take a look at integrating Black via its API so tests fail if it detects any style errors. Bear with me...

@MartinThoma
Copy link
Contributor Author

You can add a Github Action by creating .github/workflows/linting.yaml with the content:

name: Lint

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:

    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ["3.10"]

    steps:
    - uses: actions/checkout@v2
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        python -m pip install blacken-docs
    - name: Test with blacken-docs
      run: |
        blacken-docs .

However, I'm uncertain if that will give a non-zero exit code when the check is run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants