From 2c58bff62ac6ccac41df36d807140182696ebe10 Mon Sep 17 00:00:00 2001 From: imbajin Date: Sat, 23 Nov 2024 17:51:24 +0800 Subject: [PATCH 1/3] chore: enable allow-license & exclude style dir --- .gitattributes | 1 + .github/workflows/check-dependencies.yml | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitattributes b/.gitattributes index 69e734c8..333c08e7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -11,4 +11,5 @@ apache-release.sh export-ignore # ignored directory .github/ export-ignore .idea/ export-ignore +style/ export-ignore scripts/ export-ignore diff --git a/.github/workflows/check-dependencies.yml b/.github/workflows/check-dependencies.yml index 48eec918..f023a8d4 100644 --- a/.github/workflows/check-dependencies.yml +++ b/.github/workflows/check-dependencies.yml @@ -14,14 +14,14 @@ jobs: - name: 'Checkout Repository' uses: actions/checkout@v4 - name: 'Dependency Review' - uses: actions/dependency-review-action@v3 + uses: actions/dependency-review-action@v4 # Refer: https://github.com/actions/dependency-review-action with: fail-on-severity: low comment-summary-in-pr: on-failure - # Action will fail if dependencies don't match the list - #allow-licenses: Apache-2.0, MIT - deny-licenses: GPL-3.0, AGPL-1.0, AGPL-3.0, LGPL-2.0, CC-BY-3.0 + # Action will fail if dependencies don't match the list (we could choose only one of the following) + allow-licenses: Apache-2.0, MIT + #deny-licenses: GPL-3.0, AGPL-1.0, AGPL-3.0, LGPL-2.0, CC-BY-3.0 check-license: runs-on: ubuntu-latest From b100550f442aa19ac52ffdd591bd55a8496b6baa Mon Sep 17 00:00:00 2001 From: imbajin Date: Sat, 23 Nov 2024 17:56:02 +0800 Subject: [PATCH 2/3] Create test.sh --- style/test.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 style/test.sh diff --git a/style/test.sh b/style/test.sh new file mode 100644 index 00000000..5dd4424a --- /dev/null +++ b/style/test.sh @@ -0,0 +1,43 @@ +#! /bin/bash + +BLACK=false +PYLINT=false +ROOT_DIR=$(pwd) +echo ${ROOT_DIR} +# Parse command line arguments +while getopts ":bp" opt; do + case ${opt} in + b ) + BLACK=true + ;; + p ) + PYLINT=true + ;; + \? ) + echo "Usage: cmd [-b] [-p]" + ;; + esac +done + +# If no arguments were provided, run both BLACK and PYLINT +if [ "$BLACK" = false ] && [ "$PYLINT" = false ]; then + BLACK=true + PYLINT=true +fi + +# Run BLACK if -b is specified +if [ "$BLACK" = true ] ; then + echo "[black] Start to check code style and auto format" + # https://github.com/psf/BLACK/issues/1802 + black --line-length=120 ${ROOT_DIR} +fi + +# Run PYLINT if -p is specified +if [ "$PYLINT" = true ] ; then + echo "[pylint] Start code analysis and check, + we need to manually fix all the warnings mentioned below before commit! " + export PYTHONPATH=${ROOT_DIR}/hugegraph-llm/src:${ROOT_DIR}/hugegraph-python-client/src:${ROOT_DIR}/hugegraph-ml/src + pylint --rcfile=${ROOT_DIR}/style/pylint.conf ${ROOT_DIR}/hugegraph-llm + pylint --rcfile=${ROOT_DIR}/style/pylint.conf ${ROOT_DIR}/hugegraph-ml + pylint --rcfile=${ROOT_DIR}/style/pylint.conf --disable C0103 ${ROOT_DIR}/hugegraph-python-client +fi From 42460508d5a4fecc0e4dc525f7a7030531fffe7e Mon Sep 17 00:00:00 2001 From: imbajin Date: Sat, 23 Nov 2024 18:00:07 +0800 Subject: [PATCH 3/3] Revert "Create test.sh" This reverts commit b100550f442aa19ac52ffdd591bd55a8496b6baa. --- .github/workflows/check-dependencies.yml | 10 +++--- style/test.sh | 43 ------------------------ 2 files changed, 5 insertions(+), 48 deletions(-) delete mode 100644 style/test.sh diff --git a/.github/workflows/check-dependencies.yml b/.github/workflows/check-dependencies.yml index f023a8d4..e15aabab 100644 --- a/.github/workflows/check-dependencies.yml +++ b/.github/workflows/check-dependencies.yml @@ -1,4 +1,4 @@ -name: "3rd-party check" +name: "License header & 3rd-party check" on: pull_request: @@ -8,7 +8,7 @@ permissions: pull-requests: write jobs: - dependency-review: + check-dependency: runs-on: ubuntu-latest steps: - name: 'Checkout Repository' @@ -20,10 +20,10 @@ jobs: fail-on-severity: low comment-summary-in-pr: on-failure # Action will fail if dependencies don't match the list (we could choose only one of the following) - allow-licenses: Apache-2.0, MIT - #deny-licenses: GPL-3.0, AGPL-1.0, AGPL-3.0, LGPL-2.0, CC-BY-3.0 + deny-licenses: GPL-3.0, AGPL-1.0, AGPL-3.0, LGPL-2.0, CC-BY-3.0 + #allow-licenses: Apache-2.0, MIT - check-license: + check-license-header: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/style/test.sh b/style/test.sh deleted file mode 100644 index 5dd4424a..00000000 --- a/style/test.sh +++ /dev/null @@ -1,43 +0,0 @@ -#! /bin/bash - -BLACK=false -PYLINT=false -ROOT_DIR=$(pwd) -echo ${ROOT_DIR} -# Parse command line arguments -while getopts ":bp" opt; do - case ${opt} in - b ) - BLACK=true - ;; - p ) - PYLINT=true - ;; - \? ) - echo "Usage: cmd [-b] [-p]" - ;; - esac -done - -# If no arguments were provided, run both BLACK and PYLINT -if [ "$BLACK" = false ] && [ "$PYLINT" = false ]; then - BLACK=true - PYLINT=true -fi - -# Run BLACK if -b is specified -if [ "$BLACK" = true ] ; then - echo "[black] Start to check code style and auto format" - # https://github.com/psf/BLACK/issues/1802 - black --line-length=120 ${ROOT_DIR} -fi - -# Run PYLINT if -p is specified -if [ "$PYLINT" = true ] ; then - echo "[pylint] Start code analysis and check, - we need to manually fix all the warnings mentioned below before commit! " - export PYTHONPATH=${ROOT_DIR}/hugegraph-llm/src:${ROOT_DIR}/hugegraph-python-client/src:${ROOT_DIR}/hugegraph-ml/src - pylint --rcfile=${ROOT_DIR}/style/pylint.conf ${ROOT_DIR}/hugegraph-llm - pylint --rcfile=${ROOT_DIR}/style/pylint.conf ${ROOT_DIR}/hugegraph-ml - pylint --rcfile=${ROOT_DIR}/style/pylint.conf --disable C0103 ${ROOT_DIR}/hugegraph-python-client -fi