Open
Changes from 1 commit
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Failed to load files.
Previous commit
refactor: add support for fortran and fixtures/json changes
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: na
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: na
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: missing_dependencies
  - task: lint_typescript_declarations
    status: na
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
  • Loading branch information
@headlessNode
headlessNode committedMar 1, 2025
commit 88217bcb3919fbadacc583a1992cf248ddbd617b
Original file line numberDiff line numberDiff line change
Expand Up@@ -473,9 +473,29 @@ main() {
# Get changed test files directly
test_files=$(echo "${changed_files}" | grep '/test/.*\.js$' | grep -v '/test/fixtures/.*\.js$' | grep -v '/test/.*/fixtures/.*\.js$')

# Get changed test fixture JSON files
fixture_json_files=$(echo "${changed_files}" | grep '/test/fixtures/.*\.json$')

# For each changed JSON fixture, find the corresponding test files
fixture_test_files=""
if [[ -n "${fixture_json_files}" ]]; then
echo 'Identifying tests for changed JSON fixtures...' >&2
while IFS= read -r file; do
# Get the package directory (two levels up from fixtures directory)
pkg_dir=$(dirname "$(dirname "$(dirname "$file")")")

# Find all JS test files in the package
potential_tests=$(find "$pkg_dir/test" -name "*.js" 2>/dev/null | grep -v 'fixtures')
if [[ -n "${potential_tests}" ]]; then
fixture_test_files="${fixture_test_files} ${potential_tests}"
fi
done <<< "${fixture_json_files}"
fi

# Get changed source files
js_source_files=$(echo "${changed_files}" | grep -E '/(lib)/.*\.js$')
c_source_files=$(echo "${changed_files}" | grep -E '/src/.*\.c$')
fortran_source_files=$(echo "${changed_files}" | grep -E '/src/.*\.(f|f90|for|f77)$')
manifest_files=$(echo "${changed_files}" | grep 'manifest.json$')

source_test_files=""
Expand All@@ -493,9 +513,9 @@ main() {
done <<< "${js_source_files}"
fi

# Process C source files and manifest files
if [[ -n "${c_source_files}" || -n "${manifest_files}" ]]; then
echo 'Identifying tests for changed C source files and manifests...' >&2
# Process C and Fortran source files and manifest files
if [[ -n "${c_source_files}" || -n "${fortran_source_files}" || -n "${manifest_files}" ]]; then
echo 'Identifying tests for changed native source files and manifests...' >&2

# Process C source files
if [[ -n "${c_source_files}" ]]; then
Expand All@@ -515,6 +535,24 @@ main() {
done <<< "${c_source_files}"
fi

# Process Fortran source files
if [[ -n "${fortran_source_files}" ]]; then
while IFS= read -r file; do
pkg_dir=$(get_pkg_dir "$file")
pkg_pattern=$(get_pkg_pattern "$pkg_dir")

# Add to packages to compile
if [[ -n "$pkg_pattern" && "$packages_to_compile" != *"$pkg_pattern"* ]]; then
packages_to_compile="${packages_to_compile} ${pkg_pattern}"
fi

potential_tests=$(find_test_files "$pkg_dir" "*.native.js")
if [[ -n "${potential_tests}" ]]; then
source_test_files="${source_test_files} ${potential_tests}"
fi
done <<< "${fortran_source_files}"
fi

# Process manifest files
if [[ -n "${manifest_files}" ]]; then
while IFS= read -r file; do
Expand DownExpand Up@@ -549,9 +587,8 @@ main() {
fi
fi

# Combine test files from both sources and remove duplicates
all_test_files=$(echo "${test_files} ${source_test_files}" | tr ' ' '\n' | sort | uniq | tr '\n' ' ')

# Combine test files from all sources and remove duplicates
all_test_files=$(echo "${test_files} ${fixture_test_files} ${source_test_files}" | tr ' ' '\n' | sort | uniq | tr '\n' ' ')
if [[ -n "${all_test_files}" ]]; then
echo 'Running JavaScript test files...' >&2
make FILES="${all_test_files}" test-javascript-files > /dev/null >&2
Expand Down