You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ignore patterns relative to the directory of .fantomasignore, such as vendored/*.fs or src/Generated.fs, don't match any files (unless the ignore file is at the root directory). A simple repro is adding the latter pattern to .fantomasignore and testing in an F# script or FSI session:
#r "nuget:Fantomas.Extras"// Prints "IsIgnored: false"
Fantomas.Extras.IgnoreFile.isIgnoredFile "src/Generated.fs"|> printfn "IsIgnored: %b"
This is because IsIgnored is being given an absolute path, but this API interprets paths as relative to the root of the patterns, which is meant to be directory of .fantomasignore.
A simple fix would be calling Path.GetRelativePath(ignoreFileDirFullPath, fileFullPath), but for that Fantomas.Extras would have to target netstandard2.1, which is a breaking change. Alternatively, a base directory could be prepended to these patterns so they match absolute paths. That would ideally be a feature of MAB.DotIgnore, but it can be done before adding relative patterns to IgnoreList. I can create a PR once it's clear which is the best fix.
The text was updated successfully, but these errors were encountered:
amongonz
changed the title
Relative patterns in .fantomasignore don't match files any files
Relative patterns in .fantomasignore don't match any files
May 10, 2021
Ignore patterns relative to the directory of .fantomasignore, such as
vendored/*.fs
orsrc/Generated.fs
, don't match any files (unless the ignore file is at the root directory). A simple repro is adding the latter pattern to .fantomasignore and testing in an F# script or FSI session:This is because
IsIgnored
is being given an absolute path, but this API interprets paths as relative to the root of the patterns, which is meant to be directory of .fantomasignore.A simple fix would be calling
Path.GetRelativePath(ignoreFileDirFullPath, fileFullPath)
, but for that Fantomas.Extras would have to target netstandard2.1, which is a breaking change. Alternatively, a base directory could be prepended to these patterns so they match absolute paths. That would ideally be a feature of MAB.DotIgnore, but it can be done before adding relative patterns toIgnoreList
. I can create a PR once it's clear which is the best fix.The text was updated successfully, but these errors were encountered: