From 51e7969147f992e72be8a25e5fe61b64059feb89 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Thu, 18 Jun 2020 14:28:56 +0800 Subject: [PATCH 1/2] Set linter configs in `linter.ini` --- Makefile | 9 ++++----- linter.ini | 13 +++++++++++++ 2 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 linter.ini diff --git a/Makefile b/Makefile index da87f7912..d89092483 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,8 @@ MARKDOWN_FILES = $(wildcard $(SPEC_DIR)/phase0/*.md) $(wildcard $(SPEC_DIR)/phas COV_HTML_OUT=.htmlcov COV_INDEX_FILE=$(PY_SPEC_DIR)/$(COV_HTML_OUT)/index.html +LINTER_CONFIG_FILE = $(CURDIR)/linter.ini + .PHONY: clean partial_clean all test citest lint generate_tests pyspec install_test open_cov \ install_deposit_contract_tester test_deposit_contract install_deposit_contract_compiler \ compile_deposit_contract test_compile_deposit_contract check_toc @@ -101,9 +103,8 @@ codespell: lint: pyspec . venv/bin/activate; cd $(PY_SPEC_DIR); \ - flake8 --ignore=E252,W504,W503 --max-line-length=120 ./eth2spec \ - && cd ./eth2spec && mypy --follow-imports=silent --warn-unused-ignores --ignore-missing-imports --check-untyped-defs --disallow-incomplete-defs --disallow-untyped-defs -p phase0 \ - && mypy --follow-imports=silent --warn-unused-ignores --ignore-missing-imports --check-untyped-defs --disallow-incomplete-defs --disallow-untyped-defs -p phase1; + flake8 --config $(LINTER_CONFIG_FILE) ./eth2spec \ + && mypy --config-file $(LINTER_CONFIG_FILE) -p eth2spec.phase0 -p eth2spec.phase1 install_deposit_contract_tester: cd $(DEPOSIT_CONTRACT_TESTER_DIR); python3 -m venv venv; . venv/bin/activate; pip3 install -r requirements.txt @@ -123,8 +124,6 @@ test_compile_deposit_contract: cd $(DEPOSIT_CONTRACT_COMPILER_DIR); . venv/bin/activate; \ python3.7 -m pytest . -CURRENT_DIR = ${CURDIR} - # Runs a generator, identified by param 1 define run_generator # Started! diff --git a/linter.ini b/linter.ini new file mode 100644 index 000000000..6575642f1 --- /dev/null +++ b/linter.ini @@ -0,0 +1,13 @@ +[flake8] +ignore = E252,W504,W503 +max-line-length = 120 + +[mypy] +disallow_incomplete_defs = True +disallow_untyped_defs = True + +warn_unused_ignores = True +warn_unused_configs = True +warn_redundant_casts = True + +ignore_missing_imports = True From 5171a91dfba310bccc2d63cb40ef820c387b6ff0 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Thu, 18 Jun 2020 18:55:15 +0800 Subject: [PATCH 2/2] Fix path --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d89092483..5ef25289e 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,8 @@ MARKDOWN_FILES = $(wildcard $(SPEC_DIR)/phase0/*.md) $(wildcard $(SPEC_DIR)/phas COV_HTML_OUT=.htmlcov COV_INDEX_FILE=$(PY_SPEC_DIR)/$(COV_HTML_OUT)/index.html -LINTER_CONFIG_FILE = $(CURDIR)/linter.ini +CURRENT_DIR = ${CURDIR} +LINTER_CONFIG_FILE = $(CURRENT_DIR)/linter.ini .PHONY: clean partial_clean all test citest lint generate_tests pyspec install_test open_cov \ install_deposit_contract_tester test_deposit_contract install_deposit_contract_compiler \