From 4ad1dcfcddf1d118622ba59ac65ebde9e7d39340 Mon Sep 17 00:00:00 2001 From: Jeroen Engels Date: Sun, 7 Apr 2024 23:23:01 +0200 Subject: [PATCH] Rename string to pattern --- src/Review/FilePattern.elm | 10 +++++----- src/Review/RequestedData.elm | 4 ++-- src/Review/Rule.elm | 4 ++-- tests/Review/FilePatternTest.elm | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Review/FilePattern.elm b/src/Review/FilePattern.elm index 38c5b1944..ed07c380e 100644 --- a/src/Review/FilePattern.elm +++ b/src/Review/FilePattern.elm @@ -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 } diff --git a/src/Review/RequestedData.elm b/src/Review/RequestedData.elm index dcf207b70..8505c1244 100644 --- a/src/Review/RequestedData.elm +++ b/src/Review/RequestedData.elm @@ -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 diff --git a/src/Review/Rule.elm b/src/Review/Rule.elm index 76eb0d2d9..837462ede 100644 --- a/src/Review/Rule.elm +++ b/src/Review/Rule.elm @@ -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) = diff --git a/tests/Review/FilePatternTest.elm b/tests/Review/FilePatternTest.elm index 40db2a186..bfaf1f25b 100644 --- a/tests/Review/FilePatternTest.elm +++ b/tests/Review/FilePatternTest.elm @@ -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