Skip to content

Commit

Permalink
Enforce guidelines with docstrings and annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
Guts committed Nov 4, 2021
1 parent 6301058 commit ce544f9
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ repos:
types: [file, python]

- repo: https://github.com/pycqa/isort
rev: 5.9.3
rev: 5.10.0
hooks:
- id: isort
args: ["--profile", "black", "--filter-files"]
Expand All @@ -38,5 +38,6 @@ repos:
- id: flake8
language: python
files: ^gml_application_schema_toolbox/.*\.py$
types: [python]
additional_dependencies: ["flake8-annotations<3", "flake8-docstrings<2"]
args: ["--config=setup.cfg", "--select=E9,F63,F7,F82"]
types: [python]
17 changes: 16 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing Guidelines

:+1::tada: First off, thanks for considering to contribute to this project! :tada::+1:
First off, thanks for considering to contribute to this project!

These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.

Expand All @@ -17,3 +17,18 @@ Make sure your code *roughly* follows [PEP-8](https://www.python.org/dev/peps/pe
- docstrings: [sphinx-style](https://sphinx-rtd-tutorial.readthedocs.io/en/latest/docstrings.html#the-sphinx-docstring-format) is used to write technical documentation.
- formatting: [black](https://black.readthedocs.io/) is used to automatically format the code without debate.
- static analisis: [flake8](https://flake8.pycqa.org/en/latest/) is used to catch some dizziness and keep the source code healthy.
- static typing: following [PEP-484](https://www.python.org/dev/peps/pep-0484/) type annotations are used to improve code readability and reliability.

----

## Git flow

### Branches naming pattern

The pattern is: `{category}/{issue-code}_-_{slugified-description}`. Where:

- `category` is the type of work. Can be: `feature`, `bug`, `tooling`, `refactor`, `test`, `chore`, `release`, `hotfix`, `docs`, `ci`, `deploy` or `release-candidate`.
- `issue-code` is the GitHub issue number followed by an underscore. If it's not relevant, ignore this.
- `slugified-description` is the description of the work, slugified.

Example: `feature/137_content_negociation`
2 changes: 2 additions & 0 deletions requirements/development.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

black
flake8>=3.8,<4.1
flake8-annotations<2.8
flake8-builtins>=1.5,<1.6
flake8-docstrings<1.7
flake8-eradicate>=1.0,<1.3
flake8-isort>=4.0,<4.2
pre-commit>=2.12,<2.16
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ exclude =
tests,
# do not consider external packages
*/external/*, ext_libs/*
ignore = E121,E123,E126,E203,E226,E24,E704,W503,W504
ignore = ANN101, ANN102, D104, D400, D401, E121,E123,E126,E203,E226,E24,E704,W503,W504
max-complexity = 15
max-doc-length = 130
max-line-length = 100
Expand Down

0 comments on commit ce544f9

Please sign in to comment.