Loading .githooks/pre-push 0 → 100755 +25 −0 Original line number Diff line number Diff line #!/bin/sh # # pre-push hook to run 'make lint' # If 'make lint' fails (exit code != 0), the push will be aborted. echo "--- 🚀 Running 'make lint' before push ---" # Run the linter make fix # Save the exit code of the last command EXIT_CODE=$? if [ $EXIT_CODE -ne 0 ]; then echo "-----------------------------------------------" echo "| ⛔ The linter has failed! ⛔. |" echo "| Please fix the errors before pushing. |" echo "-----------------------------------------------" exit 1 # Abort the push fi echo "--- ✅ Linter OK. ---" echo "--- 🚀 Pushing... ---" exit 0 # Allow the push No newline at end of file Makefile 0 → 100644 +12 −0 Original line number Diff line number Diff line # functions lint_cmd := ruff check opencapif_sdk scripts test fix_cmd := $(lint_cmd) --fix .PHONY: lint lint: $(lint_cmd) .PHONY: fix fix: $(fix_cmd) installation/requirements.txt +1 −0 Original line number Diff line number Diff line Loading @@ -31,3 +31,4 @@ coverage>=7.4.0,<8 flake8>=7.1.0,<8 binaryornot>=0.4.4,<0.5 jinja2-time==0.2.0 ruff==0.9.5 ruff.toml 0 → 100644 +79 −0 Original line number Diff line number Diff line # Allow lines to be as long as 120 characters. line-length = 120 # Exclude a variety of commonly ignored directories. exclude = [ ".bzr", ".direnv", ".eggs", ".git", ".git-rewrite", ".hg", ".mypy_cache", ".nox", ".pants.d", ".pytype", ".ruff_cache", ".svn", ".tox", ".venv", "__pypackages__", "_build", "buck-out", "build", "dist", "node_modules", "venv", "network_app_samples/", "ci_cd_test/", "doc/" ] # Assume Python 3.11 target-version = "py39" [lint] # Allow fix for all enabled rules (when `--fix`) is provided. fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"] # Try to fix any rule, even flake8-bugbear (`B`) violations. unfixable = [] # Enable pycodestyle (`E`), pyflakes (`F`) and flake8-bugbear (`B`) rules. # Enable quotes (Q) rules. select = ["E", "F", "B", "Q", "I"] # Do not ignore any rule, not even `E501` (line length violations). ignore = [] [lint.flake8-quotes] docstring-quotes = "double" inline-quotes = "single" multiline-quotes = "double" # Ignore `E402` (import violations) in all `__init__.py` files. [lint.per-file-ignores] "__init__.py" = ["E402"] [lint.mccabe] # Unlike Flake8, default to a complexity level of 10. max-complexity = 10 [format] # Prefer single quotes over double quotes. quote-style = "single" Loading
.githooks/pre-push 0 → 100755 +25 −0 Original line number Diff line number Diff line #!/bin/sh # # pre-push hook to run 'make lint' # If 'make lint' fails (exit code != 0), the push will be aborted. echo "--- 🚀 Running 'make lint' before push ---" # Run the linter make fix # Save the exit code of the last command EXIT_CODE=$? if [ $EXIT_CODE -ne 0 ]; then echo "-----------------------------------------------" echo "| ⛔ The linter has failed! ⛔. |" echo "| Please fix the errors before pushing. |" echo "-----------------------------------------------" exit 1 # Abort the push fi echo "--- ✅ Linter OK. ---" echo "--- 🚀 Pushing... ---" exit 0 # Allow the push No newline at end of file
Makefile 0 → 100644 +12 −0 Original line number Diff line number Diff line # functions lint_cmd := ruff check opencapif_sdk scripts test fix_cmd := $(lint_cmd) --fix .PHONY: lint lint: $(lint_cmd) .PHONY: fix fix: $(fix_cmd)
installation/requirements.txt +1 −0 Original line number Diff line number Diff line Loading @@ -31,3 +31,4 @@ coverage>=7.4.0,<8 flake8>=7.1.0,<8 binaryornot>=0.4.4,<0.5 jinja2-time==0.2.0 ruff==0.9.5
ruff.toml 0 → 100644 +79 −0 Original line number Diff line number Diff line # Allow lines to be as long as 120 characters. line-length = 120 # Exclude a variety of commonly ignored directories. exclude = [ ".bzr", ".direnv", ".eggs", ".git", ".git-rewrite", ".hg", ".mypy_cache", ".nox", ".pants.d", ".pytype", ".ruff_cache", ".svn", ".tox", ".venv", "__pypackages__", "_build", "buck-out", "build", "dist", "node_modules", "venv", "network_app_samples/", "ci_cd_test/", "doc/" ] # Assume Python 3.11 target-version = "py39" [lint] # Allow fix for all enabled rules (when `--fix`) is provided. fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"] # Try to fix any rule, even flake8-bugbear (`B`) violations. unfixable = [] # Enable pycodestyle (`E`), pyflakes (`F`) and flake8-bugbear (`B`) rules. # Enable quotes (Q) rules. select = ["E", "F", "B", "Q", "I"] # Do not ignore any rule, not even `E501` (line length violations). ignore = [] [lint.flake8-quotes] docstring-quotes = "double" inline-quotes = "single" multiline-quotes = "double" # Ignore `E402` (import violations) in all `__init__.py` files. [lint.per-file-ignores] "__init__.py" = ["E402"] [lint.mccabe] # Unlike Flake8, default to a complexity level of 10. max-complexity = 10 [format] # Prefer single quotes over double quotes. quote-style = "single"