Skip to content

Commit

Permalink
reorder pre-commit config
Browse files Browse the repository at this point in the history
  • Loading branch information
asottile committed Mar 25, 2022
1 parent 4b8a8cc commit 9ac45a2
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 33 deletions.
42 changes: 17 additions & 25 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,34 @@ repos:
- id: end-of-file-fixer
- id: check-yaml
- id: debug-statements
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.6.0
hooks:
- id: autopep8
- id: double-quote-string-fixer
- id: name-tests-test
- id: requirements-txt-fixer
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.0.1
hooks:
- id: reorder-python-imports
args: [--py37-plus, --add-import, 'from __future__ import annotations']
- repo: https://github.com/asottile/add-trailing-comma
rev: v2.2.1
hooks:
- id: add-trailing-comma
args: [--py36-plus]
exclude: ^install-local.py$
- id: reorder-python-imports
files: install-local.py
- repo: https://github.com/asottile/pyupgrade
rev: v2.31.1
hooks:
- id: pyupgrade
args: [--py36-plus]
exclude: ^install-local.py$
- id: pyupgrade
files: install-local.py
- repo: https://github.com/asottile/add-trailing-comma
rev: v2.2.1
args: [--py37-plus]
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.6.0
hooks:
- id: add-trailing-comma
- id: autopep8
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.941
rev: v0.942
hooks:
- id: mypy
additional_dependencies: [types-all]
Expand All @@ -46,12 +44,6 @@ repos:
args: [--fix]
- repo: local
hooks:
- id: scss-lint
name: scss-lint
entry: scss-lint
types: [scss]
language: ruby
additional_dependencies: ['scss_lint:0.57.0']
- id: no-github-dot-git
name: No need for .git for github/gitlab urls
entry: '(github|gitlab).*\.git'
Expand Down
8 changes: 3 additions & 5 deletions install-local.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import annotations

import contextlib
import hashlib
Expand Down Expand Up @@ -103,7 +101,7 @@ def main():
))

print('*' * 79)
print('Installing pre-commit to {}'.format(script_dest))
print(f'Installing pre-commit to {script_dest}')
print('*' * 79)

if not os.path.exists(bin_dir):
Expand All @@ -116,7 +114,7 @@ def main():
os.symlink(script_src, script_dest)

if not distutils.spawn.find_executable('pre-commit'):
print('It looks like {} is not on your path'.format(bin_dir))
print(f'It looks like {bin_dir} is not on your path')
print('You may want to add it.')
print('Often this does the trick: source ~/.profile')

Expand Down
4 changes: 3 additions & 1 deletion make_all_hooks.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import functools
import json
import multiprocessing
Expand All @@ -16,7 +18,7 @@
fast_load = functools.partial(yaml.load, Loader=Loader)


def get_manifest(repo_path: str) -> Tuple[bool, str, List[Dict[str, Any]]]:
def get_manifest(repo_path: str) -> tuple[bool, str, list[dict[str, Any]]]:
print(f'*** {repo_path}')
with tempfile.TemporaryDirectory() as directory:
repo_dir = os.path.join(directory, 'repo')
Expand Down
6 changes: 4 additions & 2 deletions make_templates.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import collections
import json
import os.path
Expand Down Expand Up @@ -34,7 +36,7 @@
]


def get_env() -> Dict[str, Any]:
def get_env() -> dict[str, Any]:
body_parts = []
for title, filename in SECTIONS:
div_id, _ = os.path.splitext(os.path.basename(filename))
Expand All @@ -59,7 +61,7 @@ def get_env() -> Dict[str, Any]:
hook_type
for properties in all_hooks.values()
for hook_type in (
properties[0].get("types", []) + properties[0].get("types_or", [])
properties[0].get('types', []) + properties[0].get('types_or', [])
)
}
return {'all_hooks': all_hooks, 'all_types': all_types, 'body': body}
Expand Down

0 comments on commit 9ac45a2

Please sign in to comment.