@echo off setlocal EnableExtensions EnableDelayedExpansion set "ROOT=%~1" if "%ROOT%"=="" set "ROOT=." if not exist "%ROOT%\" ( echo Folder not found: %ROOT% exit /b 1 ) pushd "%ROOT%" || exit /b 1 set "STATUS=0" set "FOUND=" echo License files: for %%f in (LICENSE LICENSE.txt LICENSE.md COPYING COPYING.txt) do ( if exist "%%f" ( echo %%f set "FOUND=1" findstr /i /c:"MIT License" /c:"Apache License" /c:"GNU GENERAL PUBLIC LICENSE" /c:"BSD" "%%f" >nul if errorlevel 1 ( echo Marker not recognized, review manually. ) else ( echo Known license marker found. ) ) ) if not defined FOUND ( echo No license file in project root. set "STATUS=1" ) echo. set /a TOTAL=0 set /a WITH=0 for /r %%f in (*.py *.js *.ts *.sh *.ps1 *.go *.rs *.java *.cs) do ( set "FILE=%%f" echo(!FILE! | findstr /i /c:"\.git\" /c:"\node_modules\" /c:"\.venv\" >nul if errorlevel 1 ( set /a TOTAL+=1 findstr /m /i /c:"SPDX-License-Identifier" "!FILE!" >nul if not errorlevel 1 set /a WITH+=1 ) ) echo Source files scanned: %TOTAL% echo Files with SPDX header: %WITH% if %TOTAL% GTR 0 if %WITH% LSS %TOTAL% ( echo Some source files have no SPDX header. ) popd exit /b %STATUS%