Skip to content

Commit ccb9a31

Browse files
authored
#24 add default linting for python, java, and csharp (#32)
1 parent c717459 commit ccb9a31

File tree

45 files changed

+932
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+932
-4
lines changed

.config/.editorconfig

+367
Large diffs are not rendered by default.

.github/workflows/bandit.yaml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: bandit
2+
3+
on:
4+
push:
5+
branches-ignore: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
pull-requests: write
12+
13+
jobs:
14+
bandit:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
python-version: ["3.12"]
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
30+
- name: Run Bandit Scan
31+
uses: lukehinds/bandit-action@new-action
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
with:
35+
path: "examples src"
36+
recursive: "true"

.github/workflows/bearer.yaml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: bearer
2+
3+
on:
4+
push:
5+
branches-ignore: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
rule_check:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Bearer
20+
uses: bearer/bearer-action@v2

.github/workflows/black.yaml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: black
2+
3+
on:
4+
push:
5+
branches-ignore: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
black:
14+
name: black Python ${{ matrix.python-version }}
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
python-version: ["3.9", "3.10", "3.11", "3.12"]
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
30+
- name: Install dependencies
31+
run: |
32+
python -m venv ./venv
33+
source ./venv/bin/activate
34+
echo "PATH=${PATH}" >> "${GITHUB_ENV}"
35+
python -m pip install --upgrade pip
36+
python -m pip install --requirement requirements.txt
37+
python -m pip install black
38+
39+
- name: Run black testing
40+
run: |
41+
# shellcheck disable=SC2046
42+
black --diff --check $(git ls-files '*.py' ':!:docs/source/*')
+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Dependency scan
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
fpvs:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
python-version: ["3.12"]
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Install dependencies
28+
run: |
29+
python -m venv ./venv
30+
source ./venv/bin/activate
31+
echo "PATH=${PATH}" >> "${GITHUB_ENV}"
32+
python -m pip install --upgrade pip
33+
python -m pip install --requirement requirements.txt
34+
python -m pip install wheel
35+
python -m pip wheel -r requirements.txt --wheel-dir=vendor
36+
37+
- name: Run fpvs scan
38+
run: |
39+
python -m pip install fpvs
40+
git clone https://gitlab.com/gitlab-org/security-products/gemnasium-db.git
41+
fpvs-scan --verbose
42+
43+
pip-audit:
44+
runs-on: ubuntu-latest
45+
strategy:
46+
fail-fast: false
47+
matrix:
48+
python-version: ["3.12"]
49+
50+
steps:
51+
- name: Checkout repository
52+
uses: actions/checkout@v4
53+
54+
- name: Set up Python ${{ matrix.python-version }}
55+
uses: actions/setup-python@v5
56+
with:
57+
python-version: ${{ matrix.python-version }}
58+
59+
- name: Install dependencies
60+
run: |
61+
python -m venv ./venv
62+
source ./venv/bin/activate
63+
echo "PATH=${PATH}" >> "${GITHUB_ENV}"
64+
python -m pip install --requirement requirements.txt
65+
python -m pip install .
66+
67+
- name: Run pip-audit
68+
uses: pypa/[email protected]
69+
with:
70+
inputs: requirements.txt

.github/workflows/dotnet-format.yaml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: dotnet format
2+
3+
on:
4+
push:
5+
branches-ignore: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
dotnet-format:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
include:
18+
- dotnet-version: "8"
19+
20+
steps:
21+
- name: checkout repository
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- uses: actions/setup-dotnet@v4
27+
with:
28+
dotnet-version: ${{ matrix.dotnet-version }}
29+
30+
- name: install Senzing runtime
31+
uses: senzing-factory/github-action-install-senzing-sdk@v2
32+
with:
33+
packages-to-install: "senzingsdk-runtime senzingsdk-setup"
34+
senzingsdk-repository-package: ${{ secrets.SENZING_APT_BETA_STAGING_REPOSITORY_PACKAGE }}
35+
senzingsdk-repository-path: ${{ secrets.SENZING_APT_BETA_STAGING_REPOSITORY_URL }}
36+
37+
- name: configure local nuget repo
38+
run: |
39+
sdk_package=$(grep -Rl "Senzing.Sdk" /opt/senzing/er/sdk/dotnet/ | xargs -L 1 basename)
40+
mkdir -p ~/dev/nuget/packages
41+
dotnet nuget add source ~/dev/nuget/packages -n dev
42+
dotnet nuget push /opt/senzing/er/sdk/dotnet/"${sdk_package}" --source dev
43+
44+
- name: dotnet format all
45+
run: |
46+
projects=$(find . -name "*.csproj")
47+
echo "[INFO] projects are: $projects"
48+
for project in $projects; do
49+
cd "$(dirname "$project")"
50+
dotnet restore
51+
dotnet format --verify-no-changes --verbosity diagnostic
52+
done

.github/workflows/flake8.yaml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: flake8
2+
3+
on:
4+
push:
5+
branches-ignore: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
flake8:
14+
name: flake8 Python ${{ matrix.python-version }}
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
python-version: ["3.9", "3.10", "3.11", "3.12"]
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
30+
- name: Run flake8 lint
31+
uses: py-actions/flake8@v2
32+
with:
33+
max-line-length: 88
34+
path: python
35+
plugins: flake8-black

.github/workflows/isort.yaml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: isort
2+
3+
on:
4+
push:
5+
branches-ignore: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
isort:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
python-version: ["3.12"]
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
29+
- name: Install dependencies
30+
run: |
31+
python -m venv ./venv
32+
source ./venv/bin/activate
33+
echo "PATH=${PATH}" >> "${GITHUB_ENV}"
34+
python -m pip install --upgrade pip
35+
python -m pip install --requirement requirements.txt
36+
37+
- name: Run isort
38+
uses: isort/isort-action@v1
39+
with:
40+
requirements-files: requirements.txt
41+
sort-paths: "examples src/template_python tests"

.github/workflows/java-darwin-snippets.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- name: build with Maven
4343
run: |
4444
cd "${GITHUB_WORKSPACE}"/java
45-
mvn clean install
45+
mvn clean install -Pcheckstyle,spotbugs -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
4646
4747
- name: run java snippets
4848
run: |

.github/workflows/java-linux-snippets.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
SENZING_PATH: "/opt/senzing"
4343
run: |
4444
cd "${GITHUB_WORKSPACE}"/java
45-
mvn clean package
45+
mvn clean install -Pcheckstyle,spotbugs -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
4646
4747
- name: run java snippets
4848
env:

.github/workflows/java-windows-snippets.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
run: |
3636
$Env:SENZING_PATH = "$Env:USERPROFILE\senzing"
3737
cd "${Env:GITHUB_WORKSPACE}/java"
38-
mvn clean install
38+
mvn clean install "-Pcheckstyle,spotbugs" -B "-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn"
3939
4040
- name: Add to "Path" environment variable
4141
run: |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: maven dependency review
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
dependency-submission-maven:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
include:
16+
- java-version: "21"
17+
java-distribution: "temurin"
18+
19+
steps:
20+
- name: checkout repository
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: "Dependency Review"
26+
uses: actions/dependency-review-action@v4

.github/workflows/mypy.yaml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: mypy
2+
3+
on:
4+
push:
5+
branches-ignore: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
mypy:
14+
name: mypy Python ${{ matrix.python-version }}
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
python-version: ["3.9", "3.10", "3.11", "3.12"]
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
30+
- name: Install dependencies
31+
run: |
32+
python -m venv ./venv
33+
source ./venv/bin/activate
34+
echo "PATH=${PATH}" >> "${GITHUB_ENV}"
35+
python -m pip install --upgrade pip
36+
python -m pip install --requirement requirements.txt
37+
python -m pip install mypy
38+
39+
- name: Run mypy tests
40+
run: |
41+
# shellcheck disable=SC2046
42+
mypy --strict $(git ls-files '*.py' ':!:docs/source/*')

0 commit comments

Comments
 (0)