Skip to content

Commit

Permalink
Rename string to pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
jfmengels committed Apr 7, 2024
1 parent 45842b2 commit 4ad1dcf
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions src/Review/FilePattern.elm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand All @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions src/Review/RequestedData.elm
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}


Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/Review/Rule.elm
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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) =
Expand Down
8 changes: 4 additions & 4 deletions tests/Review/FilePatternTest.elm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4ad1dcf

Please sign in to comment.