|
- $projectRoot = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
- $sourcePaths = @(
- (Join-Path $projectRoot 'Core/OS/Cfg/app_cfg.h'),
- (Join-Path $projectRoot 'Core/Src/main.c')
- )
- $forbiddenSymbols = @(
- 'APP_MODBUS_REG_OPERATION_RX_COUNT',
- 'APP_MODBUS_REG_OPERATION_TX_COUNT',
- 'APP_MODBUS_REG_ERROR_COUNT',
- 'ModbusOperationRxCount',
- 'ModbusOperationTxCount',
- 'ModbusProtocolErrorCount',
- 'ModbusReceiveErrorCount',
- 'ModbusSemaphoreErrorCount',
- 'AppUpdateStatusRegisters',
- 'AppRecordIsrError'
- )
-
- $violations = @()
- foreach ($sourcePath in $sourcePaths) {
- $source = Get-Content -Raw $sourcePath
- foreach ($symbol in $forbiddenSymbols) {
- if ($source.Contains($symbol)) {
- $violations += "$sourcePath still contains $symbol"
- }
- }
- }
-
- if ($violations.Count -ne 0) {
- $violations | ForEach-Object { Write-Error $_ }
- exit 1
- }
-
- Write-Output 'Communication counter logic is absent.'
|