diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..500eb9a --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +version: 2 +updates: + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "weekly" + day: "sunday" + open-pull-requests-limit: 10 diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..8cc55a6 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,17 @@ +name: pre-commit + +on: [push, pull_request] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + - name: Install pre-commit + run: pip install pre-commit + - name: Run pre-commit + run: pre-commit run --all-files diff --git a/.github/workflows/radon.yml b/.github/workflows/radon.yml new file mode 100644 index 0000000..e4625ed --- /dev/null +++ b/.github/workflows/radon.yml @@ -0,0 +1,75 @@ +name: Radon Code Metrics + +on: + workflow_dispatch: # This allows manual triggering + push: + paths: + - '**.py' # This will run the workflow only when Python files are changed + pull_request: + paths: + - '**.py' # This will run the workflow only when Python files are changed + +jobs: + radon: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # This is important to fetch all history for comparing changes + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install radon + run: pip install radon + + - name: Run radon + run: | + # Get the list of changed Python files + if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then + CHANGED_FILES=$(git ls-files '*.py') + else + CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '\.py$' || echo "") + fi + + if [ -n "$CHANGED_FILES" ]; then + # Run Cyclomatic Complexity check + echo "Running Cyclomatic Complexity check..." + radon cc $CHANGED_FILES -a -s -n D + + # Run Maintainability Index check + echo "Running Maintainability Index check..." + radon mi $CHANGED_FILES -s -n D + else + echo "No Python files to analyze." + fi + continue-on-error: true + + - name: Check radon output + run: | + # Get the list of changed Python files + if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then + CHANGED_FILES=$(git ls-files '*.py') + else + CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '\.py$' || echo "") + fi + + if [ -n "$CHANGED_FILES" ]; then + # Run checks and capture output + CC_OUTPUT=$(radon cc $CHANGED_FILES -a -s -n D) + MI_OUTPUT=$(radon mi $CHANGED_FILES -s -n D) + + # Check if there's any output (which indicates issues) + if [ -n "$CC_OUTPUT" ] || [ -n "$MI_OUTPUT" ]; then + echo "Radon detected code complexity or maintainability issues:" + [ -n "$CC_OUTPUT" ] && echo "$CC_OUTPUT" + [ -n "$MI_OUTPUT" ] && echo "$MI_OUTPUT" + exit 1 + else + echo "No code complexity or maintainability issues detected." + fi + else + echo "No Python files to analyze." + fi diff --git a/src/AutoGGUF.py b/src/AutoGGUF.py index 029f855..afef629 100644 --- a/src/AutoGGUF.py +++ b/src/AutoGGUF.py @@ -8,7 +8,6 @@ from PySide6.QtCore import * from PySide6.QtGui import * from PySide6.QtWidgets import * -from flask import Flask, jsonify from DownloadThread import DownloadThread from GPUMonitor import GPUMonitor