From fd6ab7ab2136c4afd8169fc97e0ee6ecbbef56a7 Mon Sep 17 00:00:00 2001 From: Paul Horton Date: Wed, 9 Mar 2022 08:37:28 +0000 Subject: [PATCH 1/3] chore: first pass pre-commit config Signed-off-by: Paul Horton --- .pre-commit-config.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..96a2c746 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,16 @@ +fail_fast: true +repos: + - repo: local + hooks: + - id: system + name: mypy + entry: poetry run tox -e mypy + pass_filenames: false + language: system + - repo: local + hooks: + - id: system + name: isort + entry: poetry run isort . + pass_filenames: false + language: system From 5dafb1c88208caccaf82fc5abea41df0d295d5a4 Mon Sep 17 00:00:00 2001 From: Paul Horton Date: Wed, 9 Mar 2022 08:45:04 +0000 Subject: [PATCH 2/3] chore: added autopep8 to pre-commit and clarified command in CONTRIBUTING for performance Signed-off-by: Paul Horton --- .pre-commit-config.yaml | 7 +++++++ CONTRIBUTING.md | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 96a2c746..399afc99 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,3 +14,10 @@ repos: entry: poetry run isort . pass_filenames: false language: system + - repo: local + hooks: + - id: system + name: autopep8 + entry: poetry run autopep8 --in-place -r cyclonedx tests + pass_filenames: false + language: system diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index befb7d58..eb385f0b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,7 +23,7 @@ Get it all applied via: ```shell poetry run isort . -poetry run autopep8 --in-place -r . +poetry run autopep8 --in-place -r cyclonedx tests ``` ## Documentation From f38215f2b370e14f5629edff1ade97734b3a79cd Mon Sep 17 00:00:00 2001 From: Paul Horton Date: Wed, 9 Mar 2022 08:57:28 +0000 Subject: [PATCH 3/3] doc: added CONTRIBUTING to public docs doc: included pre-commit hooks in CONTRIBUTING Signed-off-by: Paul Horton --- CONTRIBUTING.md | 12 +++++++ docs/contributing.rst | 83 +++++++++++++++++++++++++++++++++++++++++++ docs/index.rst | 1 + 3 files changed, 96 insertions(+) create mode 100644 docs/contributing.rst diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index eb385f0b..aa04d533 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -57,8 +57,20 @@ to show that you agree to publish your changes under the current terms and licen git commit --signed-off ... ``` +## Pre-commit hooks + +If you like to take advantage of [pre-commit hooks], you can do so to cover most of the topics on this page when +contributing. + +```shell +pre-commit install +``` + +All our pre-commit checks will run locally before you can commit! + [poetry]: https://python-poetry.org [PEP8]: https://www.python.org/dev/peps/pep-0008 [Sphinx]: https://www.sphinx-doc.org/ [readthedocs.io]: https://cyclonedx-python-library.readthedocs.io/ [RST]: https://en.wikipedia.org/wiki/ReStructuredText +[pre-commit hooks]: https://pre-commit.com diff --git a/docs/contributing.rst b/docs/contributing.rst new file mode 100644 index 00000000..0dbd0ebc --- /dev/null +++ b/docs/contributing.rst @@ -0,0 +1,83 @@ +Contributing +==================================================== + +Pull requests are welcome, but please read these contributing guidelines first. + +Setup +---------------------------------------------------- + +This project uses `poetry`_. Have it installed and setup first. + +To install dev-dependencies and tools: + +.. code-block:: + + poetry install + +Code style +---------------------------------------------------- + +This project uses `PEP8`_ Style Guide for Python Code. This project loves sorted imports. Get it all applied via: + +.. code-block:: + + poetry run isort . + poetry run autopep8 --in-place -r cyclonedx tests + + +Documentation +---------------------------------------------------- + +This project uses `Sphinx`_ to generate documentation which is automatically published to `readthedocs.io`_. + +Source for documentation is stored in the ``docs`` folder in `RST`_ format. + +You can generate the documentation locally by running: + +.. code-block:: + + cd docs + pip install -r requirements.txt + make html + + +Testing +---------------------------------------------------- + +Run all tests in dedicated environments, via: + +.. code-block:: + + poetry run tox + + +Sign your commits +---------------------------------------------------- + +Please sign your commits, to show that you agree to publish your changes under the current terms and licenses of the +project. We can't accept contributions, however great, if you do not sign your commits. + +.. code-block:: + + git commit --signed-off ... + + +Pre-commit hooks +---------------------------------------------------- + +If you like to take advantage of `pre-commit hooks`_, you can do so to cover most of the topics on this page when +contributing. + +.. code-block:: + + pre-commit install + +All our pre-commit checks will run locally before you can commit! + + +.. _poetry: https://python-poetry.org +.. _PEP8: https://www.python.org/dev/peps/pep-0008 +.. _Sphinx: https://www.sphinx-doc.org/ +.. _readthedocs.io: https://cyclonedx-python-library.readthedocs.io/ +.. _RST: https://en.wikipedia.org/wiki/ReStructuredText +.. _pre-commit hooks: https://pre-commit.com diff --git a/docs/index.rst b/docs/index.rst index 5855d784..6f2b0201 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -37,6 +37,7 @@ programmatically generate SBOMs. install architecture + contributing support changelog