Rename string to pattern

This commit is contained in:
Jeroen Engels 2024-04-07 23:23:01 +02:00
parent 45842b2234
commit 4ad1dcfcdd
4 changed files with 13 additions and 13 deletions

View File

@ -13,12 +13,12 @@ type FilePattern
type alias Summary =
{ includeExclude : List CompactFilePattern
, excludedFolders : List Glob
, strings : List { string : String, included : Bool }
, strings : List { pattern : String, included : Bool }
, excludedFoldersStrings : List String
}
toStrings : Summary -> { files : List { string : String, included : Bool }, excludedFolders : List String }
toStrings : Summary -> { files : List { pattern : String, included : Bool }, excludedFolders : List String }
toStrings summary =
{ files = summary.strings
, excludedFolders = summary.excludedFoldersStrings
@ -117,7 +117,7 @@ compactHelp filePatterns accGlobs included accSummary =
True
{ includeExclude = CompactExclude accGlobs :: accSummary.includeExclude
, excludedFolders = accSummary.excludedFolders
, strings = { string = raw, included = True } :: accSummary.strings
, strings = { pattern = raw, included = True } :: accSummary.strings
, excludedFoldersStrings = accSummary.excludedFoldersStrings
}
@ -133,7 +133,7 @@ compactHelp filePatterns accGlobs included accSummary =
False
{ includeExclude = CompactInclude accGlobs :: accSummary.includeExclude
, excludedFolders = accSummary.excludedFolders
, strings = { string = raw, included = False } :: accSummary.strings
, strings = { pattern = raw, included = False } :: accSummary.strings
, excludedFoldersStrings = accSummary.excludedFoldersStrings
}
@ -179,7 +179,7 @@ addRawIncludeExclude : String -> Bool -> Summary -> Summary
addRawIncludeExclude string included summary =
{ includeExclude = summary.includeExclude
, excludedFolders = summary.excludedFolders
, strings = { string = string, included = included } :: summary.strings
, strings = { pattern = string, included = included } :: summary.strings
, excludedFoldersStrings = summary.excludedFoldersStrings
}

View File

@ -6,7 +6,7 @@ type RequestedData
{ moduleNameLookupTable : Bool
, sourceCodeExtractor : Bool
, ignoredFiles : Bool
, files : List { files : List { string : String, included : Bool }, excludedFolders : List String }
, files : List { files : List { pattern : String, included : Bool }, excludedFolders : List String }
}
@ -35,7 +35,7 @@ combine maybeA maybeB =
a
withFiles : List { files : List { string : String, included : Bool }, excludedFolders : List String } -> RequestedData -> RequestedData
withFiles : List { files : List { pattern : String, included : Bool }, excludedFolders : List String } -> RequestedData -> RequestedData
withFiles files ((RequestedData requested) as untouched) =
if List.isEmpty files then
untouched

View File

@ -415,7 +415,7 @@ type alias ModuleRuleSchemaData moduleContext =
type alias ExtraFileRequest =
Result (List String) (List { files : List { string : String, included : Bool }, excludedFolders : List String })
Result (List String) (List { files : List { pattern : String, included : Bool }, excludedFolders : List String })
type alias StringableGlob =
@ -894,7 +894,7 @@ ruleKnowsAboutIgnoredFiles (Rule rule) =
{-| REPLACEME
-}
ruleRequestedFiles : Rule -> List { files : List { string : String, included : Bool }, excludedFolders : List String }
ruleRequestedFiles : Rule -> List { files : List { pattern : String, included : Bool }, excludedFolders : List String }
ruleRequestedFiles (Rule rule) =
let
(RequestedData requestedData) =

View File

@ -98,19 +98,19 @@ toStringsTest : Test
toStringsTest =
describe "toStrings"
[ fuzz
(Fuzz.list (Fuzz.map2 (\str included -> { string = str, included = included }) Fuzz.string Fuzz.bool))
(Fuzz.list (Fuzz.map2 (\str included -> { pattern = str, included = included }) Fuzz.string Fuzz.bool))
"files should stay as before"
<|
\list ->
case
list
|> List.map
(\{ string, included } ->
(\{ pattern, included } ->
if included then
FilePattern.include string
FilePattern.include pattern
else
FilePattern.exclude string
FilePattern.exclude pattern
)
|> FilePattern.compact
of