Skip to content

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.

2 participants