Skip to content

Commit

Permalink
New checks added to Github workflow AEA-1690 (#25)
Browse files Browse the repository at this point in the history
* Dependencies to perform more checks installed.

* Commands with checks added to Makefile.

* Pipfile.lock added.

* Github checks added to workflow.

* Pipfile.lock updated.

* Darglint config added.

* Ignore "assert" error on Bandit run added.

* Isort issues fixed.

* Unnecessary check removed.

* Vulture whitelist added.

* Unnecessary info removed from comments.

* Excluded from Flake8: vulture_whitelist.py

* Excluded from Mypy: vulture_whitelist.py

* Checks order changed.

* Lock updated, versions fixed.

* Isort run in workflow fixed.

* Workflow fixed.

* Coverage version frozen to Pipfile to pass safety check.

* Coverage safety warning ignored, lock updated.

* Scripts updated.

* Pylint setup added, makefile updated.

* Pylintrc updated.

* Pylintrc updated.

* Pylintrc updated.

* Pylint options updated.

* Staking module issues fixed.

* Pass replaced with "..."

* Auth and Crypro modules docstrings added.

* Crypto module docstrings added.

* Docstrings added to Auth module.

* Auth pylint issues fixed.

* Docstrings added to the Bank module.

* Test helpers pylint issues fixed.

* Pylint issues fixed.

* Unnecessary blank line removed.

* Makefile updated.

* chorse: fix pylint issues

* cleanup: apply linters

* cleanup: cleaning up the makefile

Co-authored-by: ali <[email protected]>
  • Loading branch information
panasevychol and 5A11 authored Aug 5, 2021
1 parent d4ad1b9 commit 381c686
Show file tree
Hide file tree
Showing 36 changed files with 1,568 additions and 160 deletions.
22 changes: 14 additions & 8 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,22 @@ jobs:
- name: Install dependencies
run: |
pip install pipenv
pipenv install --dev --skip-lock
- name: Check code formatting
run: |
pipenv run make black-check
pipenv install --dev
- name: Code style check
run: |
pipenv run make black-check
pipenv run make isort-check
pipenv run make flake
pipenv run make vulture
- name: Security check
run: pipenv run make bandit
- name: Safety check
run: pipenv run make safety
- name: Static type check
run: |
pipenv run make mypy
run: pipenv run make mypy
- name: Pylint check
run: pipenv run make pylint
- name: Unused code check
run: pipenv run make vulture
- name: Unit tests
run: |
pipenv run make test
run: pipenv run make test
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
*.py[cgo]
*.egg-info/
build/
Pipfile.lock

# IDEs
.idea/

20 changes: 20 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[MESSAGES CONTROL]
disable=C0103, C0301, R0801, E1101

[IMPORTS]
ignored-modules=

[DESIGN]
min-public-methods=1
max-public-methods=36
max-returns=10
max-bool-expr=7
max-args=27
max-locals=31
max-statements=80
max-parents=11
max-branches=24
max-attributes=38

[REFACTORING]
max-nested-blocks=6
67 changes: 62 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,80 @@ $(WASMD_DIR): Makefile
cd $(WASMD_DIR) && git checkout $(WASMD_VERSION) -- $(WASMD_PROTO_RELATIVE_DIRS)
cp -rpv $(WASMD_PROTO_RELATIVE_DIRS:%=$(WASMD_DIR)/%) $(COSMOS_SDK_DIR)

####################
### Code style
####################

.PHONY: black-check
black-check:
black --check --verbose $(PYCOSM_SRC_DIR)

.PHONY: isort-check
isort-check:
isort --check-only --verbose $(PYCOSM_SRC_DIR)

.PHONY: flake
flake:
flake8 $(PYCOSM_SRC_DIR)

.PHONY: vulture
vulture:
vulture $(PYCOSM_SRC_DIR) $(PYCOSM_SRC_DIR)/vulture_whitelist.py --exclude "*_pb2.py"

####################
### Security & Safety
####################

.PHONY: bandit
bandit:
bandit -r $(PYCOSM_SRC_DIR) --skip B101

.PHONY: safety
safety:
safety check -i 41002

####################
### Linters
####################

.PHONY: mypy
mypy:
mypy $(PYCOSM_SRC_DIR)

black:
black $(PYCOSM_SRC_DIR)
.PHONY: pylint
pylint:
pylint $(PYCOSM_SRC_DIR)

black-check:
black --check $(PYCOSM_SRC_DIR)
####################
### Tests
####################

.PHONY: test
test:
python -m unittest discover -s $(PYCOSM_SRC_DIR)

ci: flake mypy black clask-check test
####################
### Combinations
####################

.PHONY: lint
lint:
black $(PYCOSM_SRC_DIR)
isort $(PYCOSM_SRC_DIR)
flake8 $(PYCOSM_SRC_DIR)
vulture $(PYCOSM_SRC_DIR) $(PYCOSM_SRC_DIR)/vulture_whitelist.py --exclude "*_pb2.py"

.PHONY: check
check:
make black-check
make isort-check
make flake
make vulture
make bandit
make safety
make mypy
make pylint
make test

debug:
$(info SOURCES_REGEX_TO_EXCLUDE: $(SOURCES_REGEX_TO_EXCLUDE))
Expand Down
9 changes: 9 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
flake8 = "==3.9.2"
black = "==21.6b0"
mypy = "==0.910"
bandit = "==1.7.0"
safety = "==1.10.3"
isort = "==5.9.3"
darglint = "==1.8.0"
vulture = "==2.3"
pylint = "==2.9.6"

[packages]
cosm = {editable = true, extras = ["dev", "test"], path = "."}
Expand Down
Loading

0 comments on commit 381c686

Please sign in to comment.