Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
50fe215
FileConventions: add failing test
tehraninasab Aug 1, 2023
186213e
FileConventions: implement the function
tehraninasab Aug 1, 2023
2ebd2b5
FileConventions: add failing test
tehraninasab Aug 1, 2023
cc82850
FileConventions: implement the function
tehraninasab Aug 3, 2023
a0272d6
FileConventions: add failing test
tehraninasab Aug 7, 2023
482d4d6
FileConventions: implement the function
tehraninasab Aug 7, 2023
5f06394
FileConventions.Test: add failing test
tehraninasab Aug 7, 2023
12f4d0b
FileConventions: fix the function
tehraninasab Aug 7, 2023
b0acb0c
FileConventions: add failing test
Mersho Aug 17, 2023
7823ab2
FileConventions: fix csharp namespace
Mersho Aug 17, 2023
9b8afb3
FileConventions: add failing test
Mersho Aug 17, 2023
21f3749
FileConventions: `Contains()` is not suitable here
Mersho Aug 17, 2023
81bfb57
FileConventions: use BetterAssert() & update Fsdk
Mersho Aug 21, 2023
e124a91
FileConventions(.Test): applying f# standard style
Mersho Aug 21, 2023
eb5f76c
FileConventions: add failing test
Mersho Aug 21, 2023
885a60a
FileConventions: fix the function
Mersho Aug 21, 2023
4e0c6e1
FileConventions: add failing test
Mersho Aug 22, 2023
6e80056
FileConvention: fix the function
Mersho Aug 22, 2023
46f3dae
FileConventions: add failing test
Mersho Aug 22, 2023
45e298b
FileConvention: fix the function
Mersho Aug 22, 2023
c190f9c
FileConventions(.Test): fix proj file indent
Mersho Aug 28, 2023
d49a99c
FileConvention: properly naming variables
Mersho Aug 28, 2023
19b442d
FileConventions: add failing test
Mersho Aug 29, 2023
e6fc879
FileConvention: fix the function
Mersho Aug 29, 2023
5358b96
FileConventions.Test: add failing test
Mersho Aug 23, 2023
ce4c0c6
FileConventions: fix empty string false-positives
Mersho Aug 23, 2023
18b828e
FileConventions: load Helpers.fs first
Mersho Aug 24, 2023
1fd7576
FileConventions: improvements to Library.fs
Mersho Aug 24, 2023
a326d09
FileConventions: dotnetFileConvention
Mersho Aug 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env -S dotnet fsi

open System
open System.IO

let emptyString = String.Empty
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env -S dotnet fsi

open System
open System.IO

let emptyString = ""
54 changes: 54 additions & 0 deletions src/FileConventions.Test/FileConventions.Test.fs
Original file line number Diff line number Diff line change
Expand Up @@ -586,3 +586,57 @@ let IsExecutableTest2() =
))

Assert.That(IsExecutable fileInfo, Is.EqualTo false)


[<Test>]
let DefiningEmptyStringsWithDoubleQuotes1() =
let fileInfo =
(FileInfo(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra parens

Path.Combine(
dummyFilesDirectory.FullName,
"DummyScriptWithConventionalEmptyString.fsx"
)
))

Assert.That(DefiningEmptyStringsWithDoubleQuotes fileInfo, Is.EqualTo false)


[<Test>]
let DefiningEmptyStringsWithDoubleQuotes2() =
let fileInfo =
(FileInfo(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra parens

Path.Combine(
dummyFilesDirectory.FullName,
"DummyScriptWithNonConventionalEmptyString.fsx"
)
))

Assert.That(DefiningEmptyStringsWithDoubleQuotes fileInfo, Is.EqualTo true)


[<Test>]
let ProjFilesNamingConvention1() =
let fileInfo =
(FileInfo(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra paren

Path.Combine(
dummyFilesDirectory.FullName,
"DummyProjFileWithTheSameNameAsItsParentFolder",
"DummyProjFileWithTheSameNameAsItsParentFolder.fsproj"
)
))

Assert.That(ProjFilesNamingConvention fileInfo, Is.EqualTo false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assert.False?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope



[<Test>]
let ProjFilesNamingConvention2() =
let fileInfo =
(FileInfo(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra paren.

Path.Combine(
dummyFilesDirectory.FullName,
"DummyProject",
"DummyProjFileWithoutTheSameNameAsItsParentFolder.fsproj"
)
))

Assert.That(ProjFilesNamingConvention fileInfo, Is.EqualTo true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it easier to use Assert.True?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, Assert.That is fine

8 changes: 8 additions & 0 deletions src/FileConventions/Library.fs
Original file line number Diff line number Diff line change
Expand Up @@ -390,3 +390,11 @@ let NonVerboseFlags(fileInfo: FileInfo) =
let IsExecutable(fileInfo: FileInfo) =
let hasExecuteAccess = Syscall.access(fileInfo.FullName, AccessModes.X_OK)
hasExecuteAccess = 0

let DefiningEmptyStringsWithDoubleQuotes(fileInfo: FileInfo) =
let fileText = File.ReadAllText fileInfo.FullName
fileText.Contains "\"\""

let ProjFilesNamingConvention(fileInfo: FileInfo) =
printfn "%s" fileInfo.FullName
false