Skip to content

Commit

Permalink
FileConventions: fix csharp namespace
Browse files Browse the repository at this point in the history
Function DoesNamespaceInclude doesn't working on *.cs namespace.
  • Loading branch information
Mersho committed Aug 17, 2023
1 parent b0acb0c commit 7823ab2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/FileConventions/Library.fs
Original file line number Diff line number Diff line change
Expand Up @@ -414,17 +414,17 @@ let DoesNamespaceInclude (fileInfo: FileInfo) (word: string) =
let fileText = File.ReadLines fileInfo.FullName

if fileText.Any() then
let firstLine = fileText.First()
let rightNamespace =
fileText
|> Seq.tryFind(fun x -> x.Contains "namespace" && x.Contains word)

if firstLine.Contains "namespace" then
firstLine.Contains word
else
false
rightNamespace <> None
else
false

let NotFollowingNamespaceConvention(fileInfo: FileInfo) =
assert (fileInfo.FullName.EndsWith(".fs"))
assert
(fileInfo.FullName.EndsWith(".fs") || fileInfo.FullName.EndsWith(".cs"))

let fileName = Path.GetFileNameWithoutExtension fileInfo.FullName
let parentDir = Path.GetDirectoryName fileInfo.FullName |> DirectoryInfo
Expand Down

0 comments on commit 7823ab2

Please sign in to comment.