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

View File

@ -6,7 +6,7 @@ type RequestedData
{ moduleNameLookupTable : Bool { moduleNameLookupTable : Bool
, sourceCodeExtractor : Bool , sourceCodeExtractor : Bool
, ignoredFiles : 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 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) = withFiles files ((RequestedData requested) as untouched) =
if List.isEmpty files then if List.isEmpty files then
untouched untouched

View File

@ -415,7 +415,7 @@ type alias ModuleRuleSchemaData moduleContext =
type alias ExtraFileRequest = 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 = type alias StringableGlob =
@ -894,7 +894,7 @@ ruleKnowsAboutIgnoredFiles (Rule rule) =
{-| REPLACEME {-| 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) = ruleRequestedFiles (Rule rule) =
let let
(RequestedData requestedData) = (RequestedData requestedData) =

View File

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