Fix some SonarCloud warnings (#1138)

* r

* hdr

* sc

* StyleCop.Analyzers
This commit is contained in:
Stef Heyenrath
2024-07-22 21:24:30 +02:00
committed by GitHub
parent 6ab1a6fd13
commit 6055b0df1a
8 changed files with 64 additions and 33 deletions

View File

@@ -7,11 +7,12 @@ function Write-Header ($file) {
$content = Get-Content $file -Raw # Using -Raw to read the entire file as a single string
$filename = Split-Path -Leaf $file
# Check if the file content starts with the auto-generated line
if ($content.TrimStart().StartsWith("// <auto-generated>")) {
Write-Host "Skipping auto-generated file: $filename"
if ($content.TrimStart().StartsWith($header.Trim())) {
# Write-Host "Skipping existing: $filename"
} elseif ($content.TrimStart().StartsWith("// <auto-generated>")) {
# Write-Host "Skipping auto-generated file: $filename"
} else {
# If not an auto-generated file, prepend the header
Write-Host "Prepend the header for file: $filename"
Set-Content $file $header
Add-Content $file $content -NoNewline # Writing back to the file without an extra newline
}