Last active
October 20, 2016 14:17
-
-
Save rflechner/cde0349812bae1280ee8f58bd90a50cb to your computer and use it in GitHub Desktop.
Get C# files not ending with LF (\n)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Get-CsharpFileNotEndingWithLF([string]$path) | |
{ | |
$files = Get-ChildItem -Path $path -Recurse -Include @("*.cs") | |
$files | Foreach { | |
$content = [System.IO.File]::ReadAllText($_) | |
if ($content -ne $null) | |
{ | |
$endsWithCRLF = $content.EndsWith("`n") | |
if (-not $endsWithCRLF -and -not $_.FullName.Contains("\obj\")) { | |
Write-Host "Invalid end of file in $($_.FullName)" | |
} | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(curl "https://gist.githubusercontent.com/rflechner/cde0349812bae1280ee8f58bd90a50cb/raw/4ac34f043c33921055b83ff07b75e1f69901bea1/Get-CsharpFileNotEndingWithLF.ps1").Content > $PROFILE | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment