From 10586cb041b4720020b29c6892b601d1b156e6ce Mon Sep 17 00:00:00 2001 From: Martin Lehmann Date: Wed, 31 Jul 2024 14:39:52 +0200 Subject: [PATCH] chore: Update project infrastructure template-version: f11f439c2c2337ae1cc907c39a4f3389174af044 --- .commitlintrc.yml | 19 ++++ .git_archival.txt | 2 +- .git_commit_template | 23 ++++ .git_commit_template.license | 2 + .gitattributes | 2 +- .github/workflows/commit-check.yml | 63 +++++++++++ .github/workflows/docs.yml | 18 +++- .github/workflows/lint.yml | 42 -------- .github/workflows/publish.yml | 63 ++++++++--- .gitignore | 2 +- .pre-commit-config.yaml | 119 +++++++++++++-------- CONTRIBUTING.md | 4 +- LICENSES/.license_header.txt | 2 - LICENSES/.license_header_apache.txt | 2 + LICENSES/.license_header_cc0.txt | 2 + README.md | 4 +- capella_diff_tools/__init__.py | 2 +- capella_diff_tools/__main__.py | 7 +- capella_diff_tools/compare.py | 7 +- capella_diff_tools/report.html.jinja | 2 +- capella_diff_tools/report.py | 14 +-- capella_diff_tools/types.py | 2 +- docs/Makefile | 2 +- docs/make.bat | 2 +- docs/source/_static/.gitkeep | 0 docs/source/_static/github-logo.svg | 9 -- docs/source/_static/screenshot.png.license | 2 +- docs/source/conf.py | 7 +- docs/source/index.rst | 2 +- git-conventional-commits.json | 18 ---- git-conventional-commits.json.license | 2 - pyproject.toml | 21 ++-- 32 files changed, 294 insertions(+), 174 deletions(-) create mode 100644 .commitlintrc.yml create mode 100644 .git_commit_template create mode 100644 .git_commit_template.license create mode 100644 .github/workflows/commit-check.yml delete mode 100644 .github/workflows/lint.yml delete mode 100644 LICENSES/.license_header.txt create mode 100644 LICENSES/.license_header_apache.txt create mode 100644 LICENSES/.license_header_cc0.txt create mode 100644 docs/source/_static/.gitkeep delete mode 100644 docs/source/_static/github-logo.svg delete mode 100644 git-conventional-commits.json delete mode 100644 git-conventional-commits.json.license diff --git a/.commitlintrc.yml b/.commitlintrc.yml new file mode 100644 index 0000000..ef03960 --- /dev/null +++ b/.commitlintrc.yml @@ -0,0 +1,19 @@ +# SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors +# SPDX-License-Identifier: CC0-1.0 +rules: + body-leading-blank: [2, always] + footer-leading-blank: [2, always] + scope-case: [2, always, lower-case] + subject-case: [2, always, sentence-case] + subject-empty: [2, never] + subject-full-stop: [2, never, .] + subject-max-length: [2, always, 72] + type-empty: [2, never] + type-enum: + [ + 2, + always, + [build, chore, ci, docs, feat, fix, merge, perf, refactor, revert, test], + ] +extends: + - '@commitlint/config-conventional' diff --git a/.git_archival.txt b/.git_archival.txt index 1c1d2e8..5a4899c 100644 --- a/.git_archival.txt +++ b/.git_archival.txt @@ -1,4 +1,4 @@ -Copyright DB Netz AG and contributors +Copyright DB InfraGO AG and contributors SPDX-License-Identifier: CC0-1.0 node: $Format:%H$ diff --git a/.git_commit_template b/.git_commit_template new file mode 100644 index 0000000..8f5e98b --- /dev/null +++ b/.git_commit_template @@ -0,0 +1,23 @@ + + +# type(scope)[!]: (max 50 chars, do not end with period) +# Conventional Commits: https://www.conventionalcommits.org/en/v1.0.0/#summary +# Seven rules of commits: https://chris.beams.io/posts/git-commit/#seven-rules +# +# commit types: +# - build (anything related to the package build) +# - chore (cosmetic commits without behavioral changes to production code) +# - ci (anything related to the CI setup) +# - docs (anything related to the documentation) +# - feat (new feature) +# - fix (bug fix) +# - merge (merge commit) +# - perf (performance improvements) +# - refactor (improvements without externally visible behavior changes) +# - revert (other commit(s) was/were reverted) +# - test (only changes to the test setup) + +# commit scopes: +# - core code: (...) +# - extensions: (...) +# - (docs) diff --git a/.git_commit_template.license b/.git_commit_template.license new file mode 100644 index 0000000..dd5d085 --- /dev/null +++ b/.git_commit_template.license @@ -0,0 +1,2 @@ +# Copyright DB InfraGO AG and contributors +# SPDX-License-Identifier: Apache-2.0 diff --git a/.gitattributes b/.gitattributes index de62da1..e9dd5d5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,4 @@ -# Copyright DB Netz AG and contributors +# Copyright DB InfraGO AG and contributors # SPDX-License-Identifier: CC0-1.0 * text=auto diff --git a/.github/workflows/commit-check.yml b/.github/workflows/commit-check.yml new file mode 100644 index 0000000..5ce55e3 --- /dev/null +++ b/.github/workflows/commit-check.yml @@ -0,0 +1,63 @@ +# SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors +# SPDX-License-Identifier: CC0-1.0 + +name: Conventional Commits + +on: + pull_request: + branches: [master] + +jobs: + conventional-commits: + runs-on: ubuntu-latest + concurrency: + group: commit-check-pr-${{ github.event.pull_request.number }} + cancel-in-progress: true + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install commitlint + run: npm install @commitlint/cli @commitlint/config-conventional + - name: Validate commit messages + id: conventional-commits + env: + SHA_FROM: ${{ github.event.pull_request.base.sha }} + SHA_TO: ${{ github.event.pull_request.head.sha }} + run: | + delim="_EOF_$(uuidgen)" + echo "validation-result<<$delim" >> "$GITHUB_OUTPUT" + r=0 + npx commitlint --from "$SHA_FROM" --to "$SHA_TO" >> "$GITHUB_OUTPUT" 2>&1 || r=$? + echo "$delim" >> "$GITHUB_OUTPUT" + exit $r + - name: Find conventional commit comment on PR + uses: peter-evans/find-comment@v3 + if: always() && steps.conventional-commits.outcome == 'failure' + id: fc + with: + issue-number: ${{ github.event.pull_request.number }} + comment-author: 'github-actions[bot]' + body-includes: conventional commit + - name: Post comment if validation failed + uses: peter-evans/create-or-update-comment@v4 + if: always() && steps.conventional-commits.outcome == 'failure' + with: + comment-id: ${{ steps.fc.outputs.comment-id }} + issue-number: ${{ github.event.pull_request.number }} + body: | + The pull request does not conform to the conventional commit specification. Please ensure that your commit messages follow the spec: . + We also strongly recommend that you set up your development environment with pre-commit, as described in our [CONTRIBUTING guidelines](https://github.com/DSD-DBS/capella-diff-tools/blob/master/CONTRIBUTING.md). This will run all the important checks right before you commit your changes, and avoids lengthy CI wait time and round trips. + + This is the commit validation log: + ``` + ${{ steps.conventional-commits.outputs.validation-result }} + ``` + + Here are some examples of valid commit messages: + ``` + build: Bump dependency versions + docs(user): Add model creation workflow + feat: Add a monitoring dashboard + ``` + edit-mode: replace diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 4e63d8d..b83beef 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,11 +1,13 @@ -# Copyright DB Netz AG and contributors +# Copyright DB InfraGO AG and contributors # SPDX-License-Identifier: CC0-1.0 name: Docs on: + pull_request: push: - branches: ["master"] + branches: [master] + workflow_dispatch: jobs: sphinx: @@ -13,10 +15,10 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v5 with: python-version: "3.11" - name: Upgrade pip @@ -31,7 +33,15 @@ jobs: - name: Create docs run: | make -C docs html + - name: Upload built docs as artifact + uses: actions/upload-artifact@v4 + with: + name: Documentation + path: docs/build/html + if-no-files-found: error + retention-days: 5 - name: Deploy + if: github.ref == 'refs/heads/master' uses: peaceiris/actions-gh-pages@v3 with: force_orphan: true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 96b4af5..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright DB Netz AG and contributors -# SPDX-License-Identifier: CC0-1.0 - -name: Lint - -on: - push: - branches: ["*"] - -jobs: - pre-commit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - with: - python-version: "3.11" - - name: Upgrade pip - run: |- - python -m pip install -U pip - - name: Install pre-commit - run: |- - python -m pip install pre-commit types-docutils - - name: Run Pre-Commit - run: |- - pre-commit run --all-files - pylint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - with: - python-version: "3.11" - - name: Upgrade pip - run: |- - python -m pip install -U pip - - name: Install pylint - run: |- - python -m pip install pylint - - name: Run pylint - run: |- - pylint -dfixme capella_diff_tools || exit $(($? & ~24)) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index cc5cf45..749ca90 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,40 +1,71 @@ -# Copyright DB Netz AG and contributors +# Copyright DB InfraGO AG and contributors # SPDX-License-Identifier: CC0-1.0 name: Publish package on: - workflow_dispatch: + pull_request: push: branches: [master] tags: ["v*"] - pull_request: + workflow_dispatch: jobs: - publish: - name: Publish artifacts + pre-commit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Setup Python - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: cache: pip cache-dependency-path: pyproject.toml python-version: "3.11" + - name: Upgrade pip + run: python -m pip install -U pip + - name: Install pre-commit + run: python -m pip install pre-commit types-docutils + - name: Run Pre-Commit + run: pre-commit run --all-files + + build: + name: Build wheel + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" - name: Install dependencies - run: python -m pip install -U pip build twine + run: |- + python -m pip install -U pip + python -m pip install build twine - name: Build packages - run: python -m build + run: |- + python -m build - name: Verify packages - run: python -m twine check dist/* + run: |- + python -m twine check dist/* - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Artifacts path: 'dist/*' + pypi: + name: Publish to PyPI + runs-on: ubuntu-latest + needs: [build, test] + if: startsWith(github.ref, 'refs/tags/v') + environment: + name: pypi + url: https://pypi.org/project/capella-diff-tools + permissions: + id-token: write + steps: + - name: Download built wheel + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ - name: Publish to PyPI - if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master' - run: python -m twine upload -u __token__ -p ${{ secrets.PYPI_TOKEN }} --non-interactive dist/* + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.gitignore b/.gitignore index 975287e..6dddc2e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -# Copyright DB Netz AG and contributors +# Copyright DB InfraGO AG and contributors # SPDX-License-Identifier: CC0-1.0 # Byte-compiled / optimized / DLL files diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e276aef..137eb4e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,11 +1,16 @@ -# Copyright DB Netz AG and contributors +# Copyright DB InfraGO AG and contributors # SPDX-License-Identifier: CC0-1.0 default_install_hook_types: [commit-msg, pre-commit] default_stages: [commit, merge-commit] +minimum_pre_commit_version: 3.2.0 repos: + - repo: https://github.com/gitleaks/gitleaks.git + rev: v8.18.4 + hooks: + - id: gitleaks - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: check-added-large-files - id: check-ast @@ -19,49 +24,32 @@ repos: - id: check-toml - id: check-vcs-permalinks - id: check-xml + - id: check-yaml - id: debug-statements - id: destroyed-symlinks - id: end-of-file-fixer - id: fix-byte-order-marker - id: trailing-whitespace - - repo: https://github.com/psf/black-pre-commit-mirror - rev: 23.11.0 - hooks: - - id: black - - repo: https://github.com/PyCQA/isort - rev: 5.12.0 - hooks: - - id: isort - - repo: https://github.com/PyCQA/docformatter - rev: v1.7.5 - hooks: - - id: docformatter - additional_dependencies: - - docformatter[tomli] - - repo: https://github.com/PyCQA/pydocstyle - rev: 6.3.0 - hooks: - - id: pydocstyle - exclude: '^tests/' - additional_dependencies: - - pydocstyle[toml] - - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.7.1 - hooks: - - id: mypy - additional_dependencies: - - types-pyyaml - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.5.4 + rev: v1.5.5 hooks: - id: insert-license - name: Insert license headers (shell-style comments) + name: Insert Apache license headers (shell-style comments) files: '(?:^|/)(?:.*\.(?:py|sh|toml|ya?ml)|Dockerfile|Makefile)$' exclude: '(?:^|/)\..+|^docs/Makefile$' args: - --detect-license-in-X-top-lines=15 - --license-filepath - - LICENSES/.license_header.txt + - LICENSES/.license_header_apache.txt + - --comment-style + - '#' + - id: insert-license + name: Insert CC0 license headers (shell-style comments) + files: '(?:^|/)(?:codeql-analysis.yml|dependabot.yml|\.(?:pre-commit-config.yaml|(?:git|helm|docker)ignore))$' + args: + - --detect-license-in-X-top-lines=15 + - --license-filepath + - LICENSES/.license_header_cc0.txt - --comment-style - '#' - id: insert-license @@ -71,34 +59,81 @@ repos: args: - --detect-license-in-X-top-lines=15 - --license-filepath - - LICENSES/.license_header.txt + - LICENSES/.license_header_apache.txt - --comment-style - '' - id: insert-license - name: Insert license headers (C-style comments) - files: '\.(?:css|js|ts)$' + name: Insert Apache license headers (C-style comments) + files: '\.(?:s?css|js|ts)$' exclude: '(?:^|/)\..+' args: - --detect-license-in-X-top-lines=15 - --license-filepath - - LICENSES/.license_header.txt + - LICENSES/.license_header_apache.txt - --comment-style - '/*| *| */' - id: insert-license - name: Insert license headers (reST comments) + name: Insert Apache license headers (reST comments) files: '\.rst$' exclude: '(?:^|/)\..+' args: - --detect-license-in-X-top-lines=15 - --license-filepath - - LICENSES/.license_header.txt + - LICENSES/.license_header_apache.txt - --comment-style - '..| |' + - repo: https://github.com/asottile/pyupgrade + rev: v3.17.0 + hooks: + - id: pyupgrade + args: ['--py311-plus'] + - repo: https://github.com/PyCQA/isort + rev: 5.13.2 + hooks: + - id: isort + - repo: https://github.com/PyCQA/docformatter + rev: v1.7.5 + hooks: + - id: docformatter + additional_dependencies: + - docformatter[tomli] + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 24.4.2 + hooks: + - id: black + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.11.1 + hooks: + - id: mypy + additional_dependencies: + - capellambse==0.5.69 + - click + - jinja2 + - markupsafe + - types-pyyaml + - repo: https://github.com/pylint-dev/pylint + rev: v3.2.6 + hooks: + - id: pylint + additional_dependencies: + - mccabe + require_serial: false + args: [-rn, -sn, -dfixme, -dduplicate-code] + - repo: https://github.com/PyCQA/pydocstyle + rev: 6.3.0 + hooks: + - id: pydocstyle + exclude: '^tests/' + additional_dependencies: + - pydocstyle[toml] - repo: https://github.com/fsfe/reuse-tool - rev: v2.1.0 + rev: v4.0.3 hooks: - id: reuse - - repo: https://github.com/qoomon/git-conventional-commits - rev: v2.6.5 + - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook + rev: v9.16.0 hooks: - - id: conventional-commits + - id: commitlint + stages: [commit-msg] + additional_dependencies: + - '@commitlint/config-conventional' diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b210f6f..3263b4b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,5 +1,5 @@ @@ -80,7 +80,7 @@ The key differences are: https://numpydoc.readthedocs.io/en/latest/format.html#docstring-standard When writing docstrings for functions, use the imperative style, as per - [PEP-257]). For example, write "Do X and Y" instead of "Does X and Y". + [PEP-257]. For example, write "Do X and Y" instead of "Does X and Y". [pep-257]: https://peps.python.org/pep-0257/ diff --git a/LICENSES/.license_header.txt b/LICENSES/.license_header.txt deleted file mode 100644 index c3fb022..0000000 --- a/LICENSES/.license_header.txt +++ /dev/null @@ -1,2 +0,0 @@ -Copyright DB Netz AG and contributors -SPDX-License-Identifier: Apache-2.0 diff --git a/LICENSES/.license_header_apache.txt b/LICENSES/.license_header_apache.txt new file mode 100644 index 0000000..02c8c23 --- /dev/null +++ b/LICENSES/.license_header_apache.txt @@ -0,0 +1,2 @@ +Copyright DB InfraGO AG and contributors +SPDX-License-Identifier: Apache-2.0 diff --git a/LICENSES/.license_header_cc0.txt b/LICENSES/.license_header_cc0.txt new file mode 100644 index 0000000..b689e74 --- /dev/null +++ b/LICENSES/.license_header_cc0.txt @@ -0,0 +1,2 @@ +Copyright DB InfraGO AG and contributors +SPDX-License-Identifier: CC0-1.0 diff --git a/README.md b/README.md index 3619651..6b4bbd6 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ @@ -119,7 +119,7 @@ look at our [guidelines for contributors](CONTRIBUTING.md) for details. This project is compliant with the [REUSE Specification Version 3.0](https://git.fsfe.org/reuse/docs/src/commit/d173a27231a36e1a2a3af07421f5e557ae0fec46/spec.md). -Copyright DB Netz AG, licensed under Apache 2.0 (see full text in +Copyright DB InfraGO AG, licensed under Apache 2.0 (see full text in [LICENSES/Apache-2.0.txt](LICENSES/Apache-2.0.txt)) Dot-files are licensed under CC0-1.0 (see full text in diff --git a/capella_diff_tools/__init__.py b/capella_diff_tools/__init__.py index 0401787..90b94d4 100644 --- a/capella_diff_tools/__init__.py +++ b/capella_diff_tools/__init__.py @@ -1,4 +1,4 @@ -# Copyright DB Netz AG and contributors +# Copyright DB InfraGO AG and contributors # SPDX-License-Identifier: Apache-2.0 """The capella_diff_tools package.""" from importlib import metadata diff --git a/capella_diff_tools/__main__.py b/capella_diff_tools/__main__.py index 3fc66b5..408622e 100644 --- a/capella_diff_tools/__main__.py +++ b/capella_diff_tools/__main__.py @@ -1,10 +1,11 @@ -# Copyright DB Netz AG and contributors +# Copyright DB InfraGO AG and contributors # SPDX-License-Identifier: Apache-2.0 """Main entry point into capella_diff_tools.""" from __future__ import annotations import datetime import logging +import os import pathlib import sys import typing as t @@ -91,7 +92,7 @@ def main( report_file.write(report.generate_html(result)) -def _ensure_git(path: str | pathlib.Path) -> str: +def _ensure_git(path: str | os.PathLike) -> str: proto, path = fh.split_protocol(path) if proto == "file": assert isinstance(path, pathlib.Path) @@ -133,7 +134,7 @@ def _get_revision_info( class CustomYAMLDumper(yaml.SafeDumper): """A custom YAML dumper that can serialize markupsafe.Markup.""" - def represent_markup(self, data): + def represent_markup(self, data: t.Any) -> t.Any: """Represent markupsafe.Markup with the '!html' tag.""" return self.represent_scalar("!html", str(data)) diff --git a/capella_diff_tools/compare.py b/capella_diff_tools/compare.py index 8824268..d66c45e 100644 --- a/capella_diff_tools/compare.py +++ b/capella_diff_tools/compare.py @@ -1,4 +1,4 @@ -# Copyright DB Netz AG and contributors +# Copyright DB InfraGO AG and contributors # SPDX-License-Identifier: Apache-2.0 """Functions for comparing different types of objects in a Capella model.""" from __future__ import annotations @@ -209,6 +209,7 @@ def _obj2dict(obj: c.GenericElement) -> types.FullObject: } +# pylint: disable-next=too-complex def _obj2diff( old: c.GenericElement, new: c.GenericElement ) -> types.ChangedObject | None: @@ -293,9 +294,9 @@ def _obj2diff( def _serialize_obj(obj: t.Any) -> t.Any: if isinstance(obj, c.GenericElement): return {"uuid": obj.uuid, "display_name": _get_name(obj)} - elif isinstance(obj, c.ElementList): + if isinstance(obj, c.ElementList): return [{"uuid": i.uuid, "display_name": _get_name(i)} for i in obj] - elif isinstance(obj, (enum.Enum, enum.Flag)): + if isinstance(obj, (enum.Enum, enum.Flag)): return obj.name return obj diff --git a/capella_diff_tools/report.html.jinja b/capella_diff_tools/report.html.jinja index d033e67..e621356 100644 --- a/capella_diff_tools/report.html.jinja +++ b/capella_diff_tools/report.html.jinja @@ -1,5 +1,5 @@ {#- - Copyright DB Netz AG and contributors + Copyright DB InfraGO AG and contributors SPDX-License-Identifier: Apache-2.0 -#} diff --git a/capella_diff_tools/report.py b/capella_diff_tools/report.py index e3af53a..2a9a8ac 100644 --- a/capella_diff_tools/report.py +++ b/capella_diff_tools/report.py @@ -1,4 +1,4 @@ -# Copyright DB Netz AG and contributors +# Copyright DB InfraGO AG and contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations @@ -25,7 +25,7 @@ class _CustomLoader(yaml.SafeLoader): - def construct_html(self, node): + def construct_html(self, node: t.Any) -> t.Any: data = self.construct_scalar(node) return markupsafe.Markup(data) @@ -33,21 +33,21 @@ def construct_html(self, node): _CustomLoader.add_constructor("!html", _CustomLoader.construct_html) -def _diff_text(previous, current): +def _diff_text(previous: str, current: str) -> t.Any: dmp = diff_match_patch.diff_match_patch() diff = dmp.diff_main("\n".join(previous), "\n".join(current)) dmp.diff_cleanupSemantic(diff) return dmp.diff_prettyHtml(diff) -def _diff_objects(previous, current): +def _diff_objects(previous: t.Any, current: t.Any) -> t.Any: return ( f"{previous['display_name']}" f" → {current['display_name']}" ) -def _diff_lists(previous, current): +def _diff_lists(previous: t.Any, current: t.Any) -> t.Any: out = [] previous = {item["uuid"]: item for item in previous} for item in current: @@ -67,7 +67,7 @@ def _diff_lists(previous, current): return "
    " + "".join(out) + "
" -def _traverse_and_diff(data): +def _traverse_and_diff(data: t.Any) -> t.Any: """Traverse the data and perform diff on text fields. This function recursively traverses the data and performs an HTML @@ -107,7 +107,7 @@ def _traverse_and_diff(data): return data -def _compute_diff_stats(data): +def _compute_diff_stats(data: t.Any) -> t.Any: """Compute the diff stats for the data. This function collects the diff stats for the data, i.e. how many diff --git a/capella_diff_tools/types.py b/capella_diff_tools/types.py index 4a1710d..357736b 100644 --- a/capella_diff_tools/types.py +++ b/capella_diff_tools/types.py @@ -1,4 +1,4 @@ -# Copyright DB Netz AG and contributors +# Copyright DB InfraGO AG and contributors # SPDX-License-Identifier: Apache-2.0 """Types for annotating functions in the diff tool.""" from __future__ import annotations diff --git a/docs/Makefile b/docs/Makefile index fdfe666..165c707 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,4 +1,4 @@ -# Copyright DB Netz AG and contributors +# Copyright DB InfraGO AG and contributors # SPDX-License-Identifier: CC0-1.0 # Minimal makefile for Sphinx documentation diff --git a/docs/make.bat b/docs/make.bat index ab614db..9f24710 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -1,5 +1,5 @@ @ECHO OFF -REM Copyright DB Netz AG and contributors +REM Copyright DB InfraGO AG and contributors REM SPDX-License-Identifier: CC0-1.0 pushd %~dp0 diff --git a/docs/source/_static/.gitkeep b/docs/source/_static/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/docs/source/_static/github-logo.svg b/docs/source/_static/github-logo.svg deleted file mode 100644 index a407b96..0000000 --- a/docs/source/_static/github-logo.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - diff --git a/docs/source/_static/screenshot.png.license b/docs/source/_static/screenshot.png.license index c3fb022..02c8c23 100644 --- a/docs/source/_static/screenshot.png.license +++ b/docs/source/_static/screenshot.png.license @@ -1,2 +1,2 @@ -Copyright DB Netz AG and contributors +Copyright DB InfraGO AG and contributors SPDX-License-Identifier: Apache-2.0 diff --git a/docs/source/conf.py b/docs/source/conf.py index 3841a87..0c7b9d5 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,7 +1,9 @@ -# Copyright DB Netz AG and contributors +# Copyright DB InfraGO AG and contributors # SPDX-License-Identifier: Apache-2.0 """Configuration file for Sphinx.""" +# pylint: disable=invalid-name + # -- Path setup -------------------------------------------------------------- @@ -93,7 +95,8 @@ { "name": "GitHub", "url": "https://github.com/DSD-DBS/capella-diff-tools", - "html": '', + # pylint: disable-next=line-too-long + "html": '', "class": "", }, ], diff --git a/docs/source/index.rst b/docs/source/index.rst index 819e174..3b3b6ab 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -1,5 +1,5 @@ .. - Copyright DB Netz AG and contributors + Copyright DB InfraGO AG and contributors SPDX-License-Identifier: Apache-2.0 Welcome to Capella Diff Tools's documentation! diff --git a/git-conventional-commits.json b/git-conventional-commits.json deleted file mode 100644 index 525cbf0..0000000 --- a/git-conventional-commits.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "convention" : { - "commitTypes": [ - "build", - "chore", - "ci", - "docs", - "feat", - "fix", - "merge", - "perf", - "refactor", - "revert", - "test" - ], - "commitScopes": [] - } -} diff --git a/git-conventional-commits.json.license b/git-conventional-commits.json.license deleted file mode 100644 index 95e8b6e..0000000 --- a/git-conventional-commits.json.license +++ /dev/null @@ -1,2 +0,0 @@ -Copyright DB Netz AG and contributors -SPDX-License-Identifier: CC0-1.0 diff --git a/pyproject.toml b/pyproject.toml index 83f7a21..ba7a5f0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,4 +1,4 @@ -# Copyright DB Netz AG and contributors +# Copyright DB InfraGO AG and contributors # SPDX-License-Identifier: Apache-2.0 [build-system] @@ -14,7 +14,7 @@ readme = "README.md" requires-python = ">=3.11, <3.13" license = { text = "Apache-2.0" } authors = [ - { name = "DB Netz AG" }, + { name = "DB InfraGO AG" }, ] keywords = [] classifiers = [ @@ -82,6 +82,8 @@ line_length = 79 [tool.mypy] check_untyped_defs = true +disallow_incomplete_defs = true +disallow_untyped_defs = true no_implicit_optional = true show_error_codes = true warn_redundant_casts = true @@ -90,13 +92,13 @@ python_version = "3.11" [[tool.mypy.overrides]] module = ["tests.*"] -allow_incomplete_defs = true -allow_untyped_defs = true +disallow_incomplete_defs = false +disallow_untyped_defs = false [[tool.mypy.overrides]] # Untyped third party libraries module = [ - # ... + "diff_match_patch.*", ] ignore_missing_imports = true @@ -121,6 +123,10 @@ add-ignore = [ ignore-long-lines = '^\s*(?:(?:__ |\.\. __: )?https?://[^ ]+$|def test_.*|[A-Za-z0-9_\.]+(?: ?:)?$)' [tool.pylint.master] +load-plugins = [ + "pylint.extensions.mccabe", +] +max-complexity = 14 max-line-length = 79 [tool.pylint.messages_control] @@ -128,14 +134,9 @@ disable = [ "broad-except", "global-statement", "import-outside-toplevel", - "invalid-name", "missing-class-docstring", "missing-function-docstring", "missing-module-docstring", - "no-else-break", - "no-else-continue", - "no-else-raise", - "no-else-return", "protected-access", "redefined-builtin", "too-few-public-methods",