Skip to content

Commit

Permalink
Added additional style checking and automatic formatting (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
beliaev-maksim committed Apr 20, 2022
1 parent 8a9bcd5 commit ba04d5c
Show file tree
Hide file tree
Showing 39 changed files with 468 additions and 355 deletions.
25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
@@ -0,0 +1,25 @@
repos:
- repo: https://github.com/humitos/mirrors-autoflake
rev: v1.1
hooks:
- id: autoflake
args: ['-i', '--remove-all-unused-imports']

- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
args: ['-l', '88']

- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
name: isort (python)
args: ['-sl', '--profile', 'black']

- repo: https://github.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
args: ['--max-line-length', '120', '--max-doc-length', '140']
11 changes: 3 additions & 8 deletions Makefile
@@ -1,4 +1,4 @@
.PHONY: clean install formatter lint test types docs livedocs
.PHONY: clean install lint test types docs livedocs

JOBS ?= 1

Expand All @@ -8,10 +8,8 @@ help:
@echo " Remove Python/build artifacts."
@echo " install"
@echo " Install questionary."
@echo " formatter"
@echo " Apply black formatting to code."
@echo " lint"
@echo " Check the code style."
@echo " Check the code style and apply black formatting."
@echo " test"
@echo " Run the unit tests."
@echo " types"
Expand All @@ -34,11 +32,8 @@ clean:
install:
poetry install --extras "docs"

formatter:
poetry run black .

lint:
poetry run black --check --diff .
poetry run pre-commit run -a

test:
poetry run pytest --pycodestyle --cov questionary -v
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Expand Up @@ -2,7 +2,7 @@
import sys

sys.path.insert(0, os.path.abspath("../"))
from questionary import __version__
from questionary import __version__ # noqa: E402

project = "Questionary"
copyright = "2021, Questionary"
Expand Down
4 changes: 3 additions & 1 deletion examples/advanced_workflow.py
@@ -1,5 +1,7 @@
from pprint import pprint
from questionary import Separator, prompt

from questionary import Separator
from questionary import prompt


def ask_dictstyle(**kwargs):
Expand Down
5 changes: 3 additions & 2 deletions examples/autocomplete_ants.py
Expand Up @@ -6,8 +6,9 @@

import questionary
from examples import custom_style_fancy

from questionary import Validator, ValidationError, prompt
from questionary import ValidationError
from questionary import Validator
from questionary import prompt


class PolyergusValidator(Validator):
Expand Down
4 changes: 3 additions & 1 deletion examples/checkbox_separators.py
Expand Up @@ -6,7 +6,9 @@

import questionary
from examples import custom_style_dope
from questionary import Separator, Choice, prompt
from questionary import Choice
from questionary import Separator
from questionary import prompt


def ask_pystyle(**kwargs):
Expand Down
2 changes: 1 addition & 1 deletion examples/checkbox_toppings.py
@@ -1,5 +1,5 @@
from examples import custom_style_dope
import questionary
from examples import custom_style_dope

if __name__ == "__main__":
toppings = (
Expand Down
2 changes: 1 addition & 1 deletion examples/password_git.py
Expand Up @@ -6,7 +6,7 @@

import questionary
from examples import custom_style_dope
from questionary import Separator, Choice, prompt
from questionary import prompt


def ask_pystyle(**kwargs):
Expand Down
3 changes: 2 additions & 1 deletion examples/rawselect_separator.py
Expand Up @@ -6,7 +6,8 @@

import questionary
from examples import custom_style_dope
from questionary import Separator, Choice, prompt
from questionary import Separator
from questionary import prompt


def ask_pystyle(**kwargs):
Expand Down
4 changes: 3 additions & 1 deletion examples/select_restaurant.py
Expand Up @@ -6,7 +6,9 @@

import questionary
from examples import custom_style_dope
from questionary import Separator, Choice, prompt
from questionary import Choice
from questionary import Separator
from questionary import prompt


def ask_pystyle(**kwargs):
Expand Down
4 changes: 3 additions & 1 deletion examples/text_phone_number.py
Expand Up @@ -7,7 +7,9 @@

import questionary
from examples import custom_style_dope
from questionary import Validator, ValidationError, prompt
from questionary import ValidationError
from questionary import Validator
from questionary import prompt


class PhoneNumberValidator(Validator):
Expand Down

0 comments on commit ba04d5c

Please sign in to comment.