From 0454d5edd424b60273f9d12cafd60f95f2098323 Mon Sep 17 00:00:00 2001 From: Jeroen Engels Date: Mon, 6 May 2024 00:23:16 +0200 Subject: [PATCH] Remove unused code --- src/Glob.elm | 11 +---- src/Review/Cache/ContentHash.elm | 7 +-- src/Review/Cache/ExtraFile.elm | 2 +- src/Review/Cache/Module.elm | 2 +- src/Review/Cache/ProjectFile.elm | 2 +- src/Review/FilePattern.elm | 1 + src/Review/Project.elm | 1 - src/Review/Rule.elm | 74 +------------------------------- 8 files changed, 8 insertions(+), 92 deletions(-) diff --git a/src/Glob.elm b/src/Glob.elm index 0de3e755..6b13d54c 100644 --- a/src/Glob.elm +++ b/src/Glob.elm @@ -1,5 +1,5 @@ module Glob exposing - ( Glob, fromString, never + ( Glob, fromString , match ) @@ -7,7 +7,7 @@ module Glob exposing [glob]: https://en.wikipedia.org/wiki/Glob_%28programming%29 -@docs Glob, fromString, never +@docs Glob, fromString @docs match -} @@ -70,13 +70,6 @@ matchComponents components segments = False -{-| A `glob` that never matches. --} -never : Glob -never = - Glob [] - - {-| Parse a string into a `glob`. -} fromString : String -> Result (List Parser.DeadEnd) Glob diff --git a/src/Review/Cache/ContentHash.elm b/src/Review/Cache/ContentHash.elm index 21d7e1c5..8acbb3b9 100644 --- a/src/Review/Cache/ContentHash.elm +++ b/src/Review/Cache/ContentHash.elm @@ -1,4 +1,4 @@ -module Review.Cache.ContentHash exposing (ContentHash, combine, hash, nil) +module Review.Cache.ContentHash exposing (ContentHash, combine, hash) import Dict exposing (Dict) import Vendor.Murmur3 as Murmur3 @@ -8,11 +8,6 @@ type ContentHash = ContentHash Int -nil : ContentHash -nil = - ContentHash 0 - - hash : String -> ContentHash hash source = ContentHash (Murmur3.hashString 0 source) diff --git a/src/Review/Cache/ExtraFile.elm b/src/Review/Cache/ExtraFile.elm index e90b1ed9..b3f0768c 100644 --- a/src/Review/Cache/ExtraFile.elm +++ b/src/Review/Cache/ExtraFile.elm @@ -14,7 +14,7 @@ module Review.Cache.ExtraFile exposing -} -import Review.Cache.ContentHash as ContentHash exposing (ContentHash) +import Review.Cache.ContentHash exposing (ContentHash) import Review.Cache.ContextHash as ContextHash exposing (ComparableContextHash, ContextHash) diff --git a/src/Review/Cache/Module.elm b/src/Review/Cache/Module.elm index 2c407e62..e4741840 100644 --- a/src/Review/Cache/Module.elm +++ b/src/Review/Cache/Module.elm @@ -14,7 +14,7 @@ module Review.Cache.Module exposing -} -import Review.Cache.ContentHash as ContentHash exposing (ContentHash) +import Review.Cache.ContentHash exposing (ContentHash) import Review.Cache.ContextHash as ContextHash exposing (ComparableContextHash, ContextHash) import Review.RequestedData exposing (RequestedData(..)) diff --git a/src/Review/Cache/ProjectFile.elm b/src/Review/Cache/ProjectFile.elm index e6ab6848..40ba7e8c 100644 --- a/src/Review/Cache/ProjectFile.elm +++ b/src/Review/Cache/ProjectFile.elm @@ -14,7 +14,7 @@ module Review.Cache.ProjectFile exposing -} -import Review.Cache.ContentHash as ContentHash exposing (ContentHash) +import Review.Cache.ContentHash exposing (ContentHash) import Review.Cache.ContextHash as ContextHash exposing (ComparableContextHash, ContextHash) diff --git a/src/Review/FilePattern.elm b/src/Review/FilePattern.elm index e0ea75c8..332407ef 100644 --- a/src/Review/FilePattern.elm +++ b/src/Review/FilePattern.elm @@ -3,6 +3,7 @@ module Review.FilePattern exposing , include, exclude, excludeDirectory , compact, match , toStrings + , Summary ) {-| A module for selecting multiple files from the file system diff --git a/src/Review/Project.elm b/src/Review/Project.elm index 322f91d0..e803c2de 100644 --- a/src/Review/Project.elm +++ b/src/Review/Project.elm @@ -67,7 +67,6 @@ import Review.Project.Dependency as Dependency exposing (Dependency) import Review.Project.Internal as Internal exposing (Project, ProjectInternals) import Review.Project.ProjectCache as ProjectCache import Review.Project.ProjectModule as ProjectModule -import Vendor.IntDict exposing (before) diff --git a/src/Review/Rule.elm b/src/Review/Rule.elm index 235ca46e..099214ac 100644 --- a/src/Review/Rule.elm +++ b/src/Review/Rule.elm @@ -315,7 +315,6 @@ import Elm.Syntax.ModuleName exposing (ModuleName) import Elm.Syntax.Node as Node exposing (Node(..)) import Elm.Syntax.Pattern exposing (Pattern) import Elm.Syntax.Range as Range exposing (Range) -import Glob exposing (Glob) import Json.Encode as Encode import Review.Cache.ContentHash exposing (ContentHash) import Review.Cache.ContextHash as ContextHash exposing (ComparableContextHash, ContextHash) @@ -328,7 +327,7 @@ import Review.Error exposing (InternalError) import Review.Exceptions as Exceptions exposing (Exceptions) import Review.FilePath exposing (FilePath) import Review.FilePattern as FilePattern exposing (FilePattern) -import Review.Fix as Fix exposing (Fix, FixResult(..)) +import Review.Fix as Fix exposing (Fix) import Review.Fix.FixProblem as FixProblem import Review.Fix.FixedErrors as FixedErrors exposing (FixedErrors) import Review.Fix.Internal as InternalFix @@ -347,7 +346,6 @@ import Review.Project.Valid as ValidProject exposing (ValidProject) import Review.RequestedData as RequestedData exposing (RequestedData(..)) import Vendor.Graph as Graph exposing (Graph) import Vendor.IntDict as IntDict -import Vendor.ListExtra as ListExtra import Vendor.Zipper as Zipper exposing (Zipper) @@ -419,12 +417,6 @@ type alias ExtraFileRequest = Result (List String) (List { files : List { pattern : String, included : Bool }, excludedDirectories : List String }) -type alias StringableGlob = - { glob : Glob - , string : String - } - - -- REVIEWING @@ -1201,11 +1193,6 @@ compactExtraFilesVisitor maybeExtraFilesVisitor = Nothing -globMatch : List Glob -> { a | path : String } -> Bool -globMatch globs file = - List.any (\glob -> Glob.match glob file.path) globs - - -- PROJECT RULES @@ -2056,65 +2043,6 @@ withExtraFilesProjectVisitor baseVisitor filePatterns (ProjectRuleSchema schema) } -parseGlobs : List String -> Result (List String) (List StringableGlob) -parseGlobs requestedFiles = - requestedFiles - |> List.map - (\str -> - Glob.fromString str - |> Result.map (\glob -> { glob = glob, string = str }) - |> Result.mapError (always str) - ) - |> toResults - - -combineGlobs : Result appendable appendable -> Result appendable appendable -> Result appendable appendable -combineGlobs previous new = - case ( previous, new ) of - ( Ok previousGlobs, Ok newGlobs ) -> - Ok (previousGlobs ++ newGlobs) - - ( Err previousErrors, Err newErrors ) -> - Err (previousErrors ++ newErrors) - - ( Err errors, _ ) -> - previous - - ( _, Err _ ) -> - new - - -toResults : List (Result String a) -> Result (List String) (List a) -toResults results = - toResultsHelp results [] - - -toResultsHelp : List (Result String a) -> List a -> Result (List String) (List a) -toResultsHelp results acc = - case results of - [] -> - Ok acc - - (Ok result) :: rest -> - toResultsHelp rest (result :: acc) - - (Err str) :: rest -> - collectErrs rest [ str ] - - -collectErrs : List (Result error value) -> List error -> Result (List error) never -collectErrs results acc = - case results of - [] -> - Err acc - - (Err str) :: rest -> - collectErrs rest (str :: acc) - - (Ok _) :: rest -> - collectErrs rest [] - - {-| Add a visitor to the [`ProjectRuleSchema`](#ProjectRuleSchema) which will examine the project's [dependencies](./Review-Project-Dependency).