From 5b989915819a2aa1c8889bedd314597dfaa5f1db Mon Sep 17 00:00:00 2001 From: "Rojas Chaves, Jose" Date: Tue, 10 Jun 2025 20:56:26 +0000 Subject: [PATCH 1/8] Adding assembler to pre-commit check --- .github/workflows/format.yml | 24 ++++++++++++++++++++++++ .gitignore | 1 + .pre-commit-config.yaml | 1 + 3 files changed, 26 insertions(+) create mode 100644 .github/workflows/format.yml diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 00000000..0406a34f --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,24 @@ +name: Format + +on: + pull_request: + push: + branches: [main] + +jobs: + format: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: Install pre-commit + run: pip install pre-commit + + - name: Run pre-commit checks + run: pre-commit run diff --git a/.gitignore b/.gitignore index 5daf1d05..7f9d3a91 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ tmp/ #======================== *.yml +!.github/workflows/*.yml *.pyc *.bak *.pkl diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e94aef70..4bd266c3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -62,6 +62,7 @@ repos: - -rn # Only display messages - -sn # Don't display the score - --source-roots=p-isa_tools/kerngen # Working directory + - --source-roots=assembler_tools/hec-assembler-tools # Added directory - id: clang-format-14 name: clang-format-14 entry: clang-format-14 From 2736f4cf11747123d1060b508e34e37eec980bd0 Mon Sep 17 00:00:00 2001 From: Jose Rojas Chaves Date: Tue, 10 Jun 2025 15:05:17 -0600 Subject: [PATCH 2/8] Fix for code scanning alert no. 8: Workflow does not contain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- .github/workflows/format.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 0406a34f..565b1ba1 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -5,6 +5,9 @@ on: push: branches: [main] +permissions: + contents: read + jobs: format: runs-on: ubuntu-latest From d5ba130bfb232d5245f0790618feb59235cd3b1e Mon Sep 17 00:00:00 2001 From: "Rojas Chaves, Jose" Date: Tue, 10 Jun 2025 21:12:16 +0000 Subject: [PATCH 3/8] Updates pre-commit to avoid deprecation issues --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4bd266c3..a89c11ae 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ default_language_version: python: python3.10 repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 # Updated 2024/04 + rev: v5.0.0 # Updated 2024/04 hooks: - id: trailing-whitespace - id: end-of-file-fixer From 49fc3e59ee93ca5acd92cc84d9010729039246b7 Mon Sep 17 00:00:00 2001 From: "Rojas Chaves, Jose" Date: Tue, 10 Jun 2025 21:29:49 +0000 Subject: [PATCH 4/8] Updates typos version to avoid deprecation issues --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a89c11ae..0ee057b3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,7 @@ repos: args: - --allow-multiple-documents - repo: https://github.com/crate-ci/typos - rev: v1.20.9 # Updated 2024/04 + rev: v1 # Updated 2024/04 hooks: - id: typos - repo: https://github.com/Lucas-C/pre-commit-hooks From 127a67baaf6a0809fe7b29d2e5201e0f42b78b8d Mon Sep 17 00:00:00 2001 From: "Rojas Chaves, Jose" Date: Tue, 10 Jun 2025 22:15:56 +0000 Subject: [PATCH 5/8] test --- assembler_tools/hec-assembler-tools/he_link.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assembler_tools/hec-assembler-tools/he_link.py b/assembler_tools/hec-assembler-tools/he_link.py index 2560ad99..d2bf99a7 100644 --- a/assembler_tools/hec-assembler-tools/he_link.py +++ b/assembler_tools/hec-assembler-tools/he_link.py @@ -18,8 +18,8 @@ Parses command-line arguments for the linker script. Usage: - This script is intended to be run as a standalone program. It requires specific command-line arguments - to specify input and output files and configuration options for the linking process. + This script is intended to be run as a standalone program. It requires specific command-line + arguments to specify input and output files and configuration options for the linking process. """ import argparse From 379c69df783728b52852630779662cf4154f0c0a Mon Sep 17 00:00:00 2001 From: "Rojas Chaves, Jose" Date: Tue, 10 Jun 2025 22:15:56 +0000 Subject: [PATCH 6/8] Updating pre-commit --- .pre-commit-config.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0ee057b3..d3467f90 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ default_language_version: python: python3.10 repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 # Updated 2024/04 + rev: v5.0.0 # Updated 2025/06 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -16,11 +16,11 @@ repos: args: - --allow-multiple-documents - repo: https://github.com/crate-ci/typos - rev: v1 # Updated 2024/04 + rev: v1.33.1 # Updated 2025/06 hooks: - id: typos - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.5.1 # Updated 2023/07 + rev: v1.5.5 # Updated 2025/06 hooks: - id: insert-license name: insert-license-shell @@ -43,12 +43,12 @@ repos: files: \.(py)$ args: [--whitespaces-count, '4'] - repo: https://github.com/psf/black-pre-commit-mirror - rev: 24.4.0 # Updated 2024/04 + rev: 25.1.0 # Updated 2025/06 hooks: - id: black language_version: python3.10 - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.9.0 # Last checked 2024/04 + rev: v1.16.0 # Last checked 2025/06 hooks: - id: mypy - repo: local From bca531b4163633653123bf1c5762395f66af3d17 Mon Sep 17 00:00:00 2001 From: "Rojas Chaves, Jose" Date: Tue, 10 Jun 2025 22:39:31 +0000 Subject: [PATCH 7/8] Making it run on changes on CI --- .github/workflows/format.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 565b1ba1..b354139b 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -23,5 +23,8 @@ jobs: - name: Install pre-commit run: pip install pre-commit - - name: Run pre-commit checks - run: pre-commit run + - name: Fetch main branch for diff + run: git fetch origin main + + - name: Run pre-commit on changed files only + run: pre-commit run --from-ref origin/main --to-ref HEAD From 707c9ae8ed1030d175e30edeb4ff0827668a1e1d Mon Sep 17 00:00:00 2001 From: "Rojas Chaves, Jose" Date: Tue, 10 Jun 2025 22:43:17 +0000 Subject: [PATCH 8/8] Remove test change --- assembler_tools/hec-assembler-tools/he_link.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assembler_tools/hec-assembler-tools/he_link.py b/assembler_tools/hec-assembler-tools/he_link.py index d2bf99a7..2560ad99 100644 --- a/assembler_tools/hec-assembler-tools/he_link.py +++ b/assembler_tools/hec-assembler-tools/he_link.py @@ -18,8 +18,8 @@ Parses command-line arguments for the linker script. Usage: - This script is intended to be run as a standalone program. It requires specific command-line - arguments to specify input and output files and configuration options for the linking process. + This script is intended to be run as a standalone program. It requires specific command-line arguments + to specify input and output files and configuration options for the linking process. """ import argparse