Merge pull request #422 from henryiii/ci/format

ci: format updates
This commit is contained in:
Yannick Jadoul
2020-08-16 23:02:19 +02:00
committed by GitHub
9 changed files with 45 additions and 48 deletions
-17
View File
@@ -1,22 +1,6 @@
version: 2 version: 2
jobs: jobs:
flake8-mypy:
docker:
- image: circleci/python:3.6
steps:
- checkout
- run:
name: Install flake8 & mypy
command: sudo python -m pip install flake8 mypy
- run:
name: flake8
command: flake8
- run:
name: mypy
command: mypy
osx-python3.6: osx-python3.6:
macos: macos:
xcode: "9.4.1" xcode: "9.4.1"
@@ -54,6 +38,5 @@ workflows:
version: 2 version: 2
all-tests: all-tests:
jobs: jobs:
- flake8-mypy
- osx-python3.6 - osx-python3.6
- linux-python3.6 - linux-python3.6
+8
View File
@@ -7,6 +7,14 @@ on:
- 'docs/**' - 'docs/**'
jobs: jobs:
pre-commit:
name: Pre-commit checks (mypy, flake8, etc.)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/action@v2.0.0
test: test:
# skip branch builds on joerick/cibuildwheel, but always build `master` and pull requests # skip branch builds on joerick/cibuildwheel, but always build `master` and pull requests
if: github.repository != 'joerick/cibuildwheel' || github.ref == 'refs/heads/master' || github.event_name == 'pull_request' if: github.repository != 'joerick/cibuildwheel' || github.ref == 'refs/heads/master' || github.event_name == 'pull_request'
+12 -8
View File
@@ -1,21 +1,25 @@
repos: repos:
- repo: https://gitlab.com/pycqa/flake8 - repo: https://gitlab.com/pycqa/flake8
rev: 3.8.1 rev: 3.8.3
hooks: hooks:
- id: flake8 - id: flake8
pass_filenames: true
# this seems to need to be here in addition to setup.cfg
exclude: cibuildwheel/resources/ exclude: cibuildwheel/resources/
additional_dependencies: [flake8-bugbear]
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0 rev: v3.2.0
hooks: hooks:
- id: check-yaml - id: check-case-conflict
- id: check-merge-conflict - id: check-merge-conflict
- id: check-yaml
- id: end-of-file-fixer - id: end-of-file-fixer
exclude: cibuildwheel/resources/pinned_docker_images.cfg exclude: cibuildwheel/resources/pinned_docker_images.cfg
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/pre-commit/mirrors-mypy - repo: https://github.com/pre-commit/mirrors-mypy
rev: '' # Use the sha / tag you want to point at rev: v0.782
hooks: hooks:
- id: mypy - id: mypy
files: cibuildwheel|test files: cibuildwheel/|test/
exclude: cibuildwheel/resources pass_filenames: false
+3 -2
View File
@@ -117,11 +117,12 @@ class DockerContainer:
return [PurePath(p) for p in path_strs] return [PurePath(p) for p in path_strs]
def call(self, args: Sequence[Union[str, PathLike]], env: Dict[str, str] = {}, def call(self, args: Sequence[Union[str, PathLike]], env: Optional[Dict[str, str]] = None,
capture_output=False, cwd: Optional[Union[str, PathLike]] = None) -> str: capture_output=False, cwd: Optional[Union[str, PathLike]] = None) -> str:
chdir = f'cd {cwd}' if cwd else '' chdir = f'cd {cwd}' if cwd else ''
env_assignments = ' '.join(f'{shlex.quote(k)}={shlex.quote(v)}' env_assignments = ' '.join(f'{shlex.quote(k)}={shlex.quote(v)}'
for k, v in env.items()) for k, v in env.items()) if env is not None else ''
command = ' '.join(shlex.quote(str(a)) for a in args) command = ' '.join(shlex.quote(str(a)) for a in args)
end_of_message = str(uuid.uuid4()) end_of_message = str(uuid.uuid4())
+2 -1
View File
@@ -1,5 +1,6 @@
[flake8] [flake8]
ignore = E501,W503,E741,E226 ignore = E501,W503,E741,E226,B950
select = C,E,F,W,B,B9
application-import-names = cibuildwheel application-import-names = cibuildwheel
exclude = exclude =
cibuildwheel/resources/, cibuildwheel/resources/,