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
24 changes: 24 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Code Quality Checks

on:
push:
branches: ['**']
pull_request:
branches: ['**']

jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install check tools
run: make install

- name: Run lint checks
run: make lint
37 changes: 37 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
COMPILED_RESOURCE_FILES = smarty/resources.py
RESOURCE_SRC=$(shell grep '^ *<file' smarty/resources.qrc | sed 's@</file>@@g;s/.*>//g' | tr '\n' ' ')

QGIS_PLUGINS_DIR = $(HOME)/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins

.PHONY: vendor check compile install lint deploy redeploy

install:
pip install bandit detect-secrets flake8

lint:
@echo "--- Flake8 ---"
@flake8 smarty/ --exclude=smarty/smartystreets_python_sdk,smarty/smartystreets_python_sdk-6.1.0.dist-info || true
@echo "--- detect-secrets ---"
@detect-secrets scan --all-files || true
@echo "--- Bandit ---"
bandit -r smarty/ -x smarty/smartystreets_python_sdk,smarty/test,./.git

deploy:
rm -rf "$(QGIS_PLUGINS_DIR)/smarty"
cp -rf smarty "$(QGIS_PLUGINS_DIR)/smarty"

redeploy: deploy
osascript -e 'quit app "QGIS"'
open -a QGIS

vendor:
./vendor.sh

check:
cd smarty && python3 -m py_compile __init__.py smarty.py smarty_dialog.py utils.py
cd smarty && python3 -c "import sys; sys.path.insert(0, '.'); import smartystreets_python_sdk; from smartystreets_python_sdk import StaticCredentials, exceptions, ClientBuilder, SharedCredentials, Batch, Request; from smartystreets_python_sdk.us_street import Lookup; from smartystreets_python_sdk.us_autocomplete_pro import Lookup; print('OK')"

compile: $(COMPILED_RESOURCE_FILES)

smarty/%.py : smarty/%.qrc $(RESOURCES_SRC)
pyrcc5 -o $*.py $<
251 changes: 0 additions & 251 deletions smarty/Makefile

This file was deleted.

2 changes: 0 additions & 2 deletions smarty/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
***************************************************************************/
This script initializes the plugin, making it known to QGIS.
"""
import subprocess
import platform
import os
import sys

Expand Down
Loading
Loading