Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .codespell-ignore-words
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ser
hashi
wheter
aci
ot
boostrapping
confuguration
certifcates
associtive
commmands
properies
25 changes: 25 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[flake8]
max-line-length = 120

ignore =
F401
F541
F841
F821
E501
D202
D205
D400
D401
D403
B008
B006
C417
D100,D101,D102,D103,D104,D105,D106

exclude =
venv/
__pycache__/
migrations/
.git/
.idea/
34 changes: 34 additions & 0 deletions .github/mergeable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: 2
mergeable:
- when: pull_request.*, pull_request_review.*
validate:
# Validate PR title
- do: title
must_include:
regex: '^(feat|docs|chore|fix|refactor|test|style|perf)(\(\w+\))?: .{5,}'
message: "Semantic release conventions must be followed. Example: feat(auth): add login page. Title must be at least 5 characters after the prefix."

# Ensure PR description is provided
- do: description
must_include:
regex: "[\\s\\S]{20,}" # At least 20 characters
message: "Please provide a meaningful description of the PR (minimum 20 characters)."

# Ensure PR references an associated issue
- do: description
must_include:
regex: "(Closes|Fixes|Resolves|Addresses)\\s+#[0-9]+(,?\\s*#[0-9]+)*"
message: "PR must reference at least one issue (e.g., Closes #123, Fixes #123, #124)."

# Ensure at least one required label is applied
- do: label
must_include:
regex: "^(bug|enhancement|documentation|feature|refactor|performance|chore|wip|test|ci|security|dependencies)$"
message: "PR must include at least one valid label."

pass:
- do: labels
add:
- "validated"
- do: checks
status: "success"
128 changes: 128 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: Pre-Commit Checks

on:
push:
branches:
- main
- develop
- 'feat/**'
- 'feature/**'
- 'test/**'
- 'chore/**'
- 'fix/**'
- 'hotfix/**'
- 'docs/**'
pull_request:
types: [opened, synchronize, reopened]

jobs:
precommit:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Create and activate Python venv
run: |
python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
pip install pre-commit
shell: bash

# Optional: add venv to PATH for subsequent steps
- name: Add venv to PATH
run: echo "${{ github.workspace }}/.venv/bin" >> $GITHUB_PATH

- name: Load Pre-commit Config
run: |
if [ ! -f ".pre-commit-config.yaml" ]; then
echo " No .pre-commit-config.yaml found — downloading BerryBytes global config..."
curl -sSL \
https://raw.githubusercontent.com/BerryBytes/precommit-util/main/global/precommitFile/.pre-commit-config.yaml \
-o .pre-commit-config.yaml
else
echo "✔ Using project's existing .pre-commit-config.yaml"
fi
shell: bash

- name: Inject temporary Stylelint config for CI
run: |
if [ ! -f ".stylelintrc.json" ]; then
echo " Creating temporary .stylelintrc.json for CI..."
cat <<EOF > .stylelintrc.json
{
"extends": "stylelint-config-standard",
"rules": {
"no-duplicate-selectors": true,
"color-hex-length": "short",
"selector-no-qualifying-type": true,
"selector-max-id": 0
}
}
EOF
else
echo "✔ .stylelintrc.json already exists — skipping"
fi
shell: bash
# --------------------------------------------------------------------
# STEP 1: Run pre-commit (capture full logs and exit code safely)
# --------------------------------------------------------------------
- name: Run pre-commit (full logs)
id: runprecommit
run: |
source .venv/bin/activate
echo "🔍 Running full pre-commit checks..."

set +e # allow failure
pre-commit run --all-files --verbose --show-diff-on-failure --color never \
| tee full_precommit.log
exit_code=${PIPESTATUS[0]}

echo "Pre-commit exit code: $exit_code"
echo "$exit_code" > precommit_exit_code.txt
shell: bash

# --------------------------------------------------------------------
# STEP 2: Summary of FAILED hooks
# --------------------------------------------------------------------
- name: Pre-commit summary of failed hooks
run: |
source .venv/bin/activate
echo "====================================================="
echo " PRE-COMMIT SUMMARY"
echo "====================================================="

exit_code=$(cat precommit_exit_code.txt)

if [ "$exit_code" = "0" ]; then
echo " All hooks passed!"
exit 0
fi

echo " Hooks failed — showing summary:"
echo ""

echo " FAILED HOOKS:"
grep -E "^\w.*\.{3,}Failed" full_precommit.log || echo " None"
echo "-----------------------------------------------------"

echo " FILES WITH ISSUES:"
grep -E "files were modified by this hook" -A3 full_precommit.log \
| sed 's/^/ - /' || echo " None"
echo "-----------------------------------------------------"

echo " ERROR DETAILS:"
grep -Ei "(error|failed|violation|missing|line too long|could not|warning)" full_precommit.log \
| grep -Ev "^(---|\+\+\+|@@|diff --git|index )" \
| sed 's/^/ • /' || echo " None"
echo "-----------------------------------------------------"

exit $exit_code
shell: bash
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Distribution / packaging
.Pytho
.vscode
.vscode
venv/
95 changes: 84 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,98 @@
repos:
########## Precommit Hooks #########
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-yaml
exclude: ^manifest/.*\.yaml$
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-added-large-files
- id: check-vcs-permalinks
exclude: ^manifest/charts/
- id: check-symlinks
- id: destroyed-symlinks
- id: pretty-format-json
args: ["--autofix"]
exclude: 'tsconfig.*\.json'

######### golang fmt and go tidey #########
- repo: https://github.com/TekWizely/pre-commit-golang
rev: v1.0.0-rc.1
hooks:
- id: go-fmt
args: [-w]
- id: go-mod-tidy

- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
args: [--line-length=88]
language_version: python3.13

# # Import sorter (runs before Black)
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
args: ["--profile=black"]

# # Linter (flake8 for code quality)
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
args:
- --max-line-length=88
- --extend-ignore=E203,W503
additional_dependencies:
- flake8-bugbear
- flake8-comprehensions
- flake8-docstrings

# # Static code analysis for Python (pylint optional)
- repo: https://github.com/pycqa/pylint
rev: v3.0.0
hooks:
- id: pylint
args: ["--disable=C0114,C0115,C0116"]
additional_dependencies:
- pylint-django
- flask
- fastapi
- pydantic
- pymongo
- python-jose
- python-keycloak
- pyparsing
- websockets
- kubernetes
- dapr
- PyYAML
# # Stylelint
- repo: https://github.com/thibaudcolas/pre-commit-stylelint
rev: v15.10.3
hooks:
- id: stylelint
files: \.(css|scss)$
# exclude: "node_modules/"
additional_dependencies:
- stylelint
- stylelint-config-standard
args: ['--config', '.stylelintrc.json', '--fix']

# # Codespell
- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
hooks:
- id: codespell
files: ^.*\.(py|c|h|md|rst|yml|go|sh|sql|tf|yaml)$
args: ["--write-changes", "--ignore-words-list", "hist,nd"]
args: ['--ignore-words=.codespell-ignore-words']

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
# # Gitleaks
- repo: https://github.com/gitleaks/gitleaks
rev: v8.21.0
hooks:
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: debug-statements
- id: trailing-whitespace
- id: html-validate
- id: json-validate
- id: gitleaks
args: ["detect", "--verbose"]
verbose: true
22 changes: 22 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"singleQuote": true,
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"printWidth": 100,
"overrides": [
{
"files": "*.html",
"options": {
"parser": "html"
}
},
{
"files": "*.css",
"options": {
"parser": "css"
}
}
],
"ignore": ["node_modules"]
}
34 changes: 34 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[MESSAGES CONTROL]
disable=
broad-exception-caught,
redefined-outer-name,
too-many-locals,
no-else-return,
logging-fstring-interpolation,
redefined-builtin,
logging-not-lazy,
dangerous-default-value,
inconsistent-return-statements,
missing-timeout,
too-few-public-methods,
invalid-name,
raise-missing-from,
consider-using-f-string,
too-many-return-statements,
R0801,
line-too-long,
no-member,
R1733,
unused-import,
unused-variable,
unused-argument,
f-string-without-interpolation,
unspecified-encoding,
unexpected-keyword-arg,
no-value-for-parameter,
too-many-instance-attributes,
too-many-arguments,
unnecessary-pass,
logging-too-many-args,
no-else-break,
deprecated-module,
9 changes: 9 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "stylelint-config-standard",
"rules": {
"color-hex-length": "short",
"no-duplicate-selectors": true,
"selector-max-id": 0,
"selector-no-qualifying-type": true
}
}
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
## [v3.2.1](https://github.com/ClusterManager/ClusterManager/tree/v3.2.1) (2024-11-20)
[All Commits](https://github.com/ClusterManager/ClusterManager/compare/v3.2.0...v3.2.1)
[All Commits](https://github.com/ClusterManager/ClusterManager/compare/v3.2.0...v3.2.1)
Loading