Skip to content

Commit 758ee35

Browse files
committed
FileConventions: improvements to Library.fs
An assert error message has been added for *.fsx files & renaming the func.
1 parent 13f1dec commit 758ee35

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

scripts/dotnetFileConvention.fsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ if args.Length > 1 then
2727
let rootDir = DirectoryInfo args.[0]
2828

2929
// DefiningEmptyStringsWithDoubleQuotes
30-
let allSourceFiles = ReturnAllProjectSourceFile rootDir [ "*.cs"; "*.fs" ] true
30+
let allSourceFiles = ReturnAllProjectSourceFiles rootDir [ "*.cs"; "*.fs" ] true
3131
printfn "%A" (String.Join("\n", allSourceFiles))
3232

3333
let allProjFiles =
34-
ReturnAllProjectSourceFile rootDir [ "*.csproj"; "*.fsproj" ] true
34+
ReturnAllProjectSourceFiles rootDir [ "*.csproj"; "*.fsproj" ] true
3535

3636
for sourceFile in allSourceFiles do
3737
let isStringEmpty = DefiningEmptyStringsWithDoubleQuotes sourceFile

src/FileConventions/Library.fs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ open Fsdk
1212
let ymlAssertionError = "Bug: file should be a .yml file"
1313
let projAssertionError = "Bug: file should be a proj file"
1414
let sourceFileAssertionError = "Bug: file was not a F#/C# source file"
15+
let fsxAssertionError = "Bug: file was not a F# script source file"
1516

1617
let HasCorrectShebang(fileInfo: FileInfo) =
1718
let fileText = File.ReadLines fileInfo.FullName
@@ -88,9 +89,7 @@ let DetectAsteriskInPackageReferenceItems(fileInfo: FileInfo) =
8889
asteriskInPackageReference.IsMatch fileText
8990

9091
let DetectMissingVersionsInNugetPackageReferences(fileInfo: FileInfo) =
91-
Misc.BetterAssert
92-
(fileInfo.FullName.EndsWith ".fsx")
93-
sourceFileAssertionError
92+
Misc.BetterAssert (fileInfo.FullName.EndsWith ".fsx") fsxAssertionError
9493

9594
let fileLines = File.ReadLines fileInfo.FullName
9695

@@ -320,9 +319,7 @@ let DetectInconsistentVersionsInNugetRefsInFSharpScripts
320319
=
321320
fileInfos
322321
|> Seq.iter(fun fileInfo ->
323-
Misc.BetterAssert
324-
(fileInfo.FullName.EndsWith ".fsx")
325-
sourceFileAssertionError
322+
Misc.BetterAssert (fileInfo.FullName.EndsWith ".fsx") fsxAssertionError
326323
)
327324

328325
DetectInconsistentVersions
@@ -491,7 +488,7 @@ let ContainsConsoleMethods(fileInfo: FileInfo) =
491488
checkLine fileLines
492489

493490

494-
let ReturnAllProjectSourceFile
491+
let ReturnAllProjectSourceFiles
495492
(parentDir: DirectoryInfo)
496493
(patterns: List<string>)
497494
(shouldFilter: bool)
@@ -521,7 +518,7 @@ let NotFollowingConsoleAppConvention (fileInfo: FileInfo) (shouldFilter: bool) =
521518

522519
if not(fileText.Contains "<OutputType>Exe</OutputType>") then
523520
let sourceFiles =
524-
ReturnAllProjectSourceFile
521+
ReturnAllProjectSourceFiles
525522
(DirectoryInfo parentDir)
526523
[ "*.cs"; "*.fs" ]
527524
shouldFilter

0 commit comments

Comments
 (0)