diff --git a/src/Semantic/IO.hs b/src/Semantic/IO.hs index 0beb84f9f..f63960ef3 100644 --- a/src/Semantic/IO.hs +++ b/src/Semantic/IO.hs @@ -11,7 +11,6 @@ module Semantic.IO , NoLanguageForBlob(..) , readBlob , readProject -, readProjectEntry , readBlobs , readBlobPairs , writeToOutput @@ -98,17 +97,6 @@ readProjectFromPaths path lang = do toFile path = File path (Just lang) exts = extensionsForLanguage lang -readProjectEntryFromPath :: MonadIO m => FilePath -> Language -> m Project -readProjectEntryFromPath path lang = do - isDir <- isDirectory path - let (filterFun, entryPoints) = if isDir then (id, []) else (filter (/= path), [toFile path]) - paths <- liftIO $ filterFun <$> fmap fold (globDir (compile . mappend "**/*." <$> exts) rootDir) - pure $ Project rootDir (toFile <$> paths) lang entryPoints - where - rootDir = takeDirectory path - toFile path = File path (Just lang) - exts = extensionsForLanguage lang - readBlobsFromDir :: MonadIO m => FilePath -> m [Blob.Blob] readBlobsFromDir path = do paths <- liftIO (globDir1 (compile "[^vendor]**/*[.rb|.js|.tsx|.go|.py]") path) @@ -174,9 +162,6 @@ readBlobPairs = send . ReadBlobPairs readProject :: Member Files effs => FilePath -> Language -> Eff effs Project readProject dir = send . ReadProject dir -readProjectEntry :: Member Files effs => FilePath -> Language -> Eff effs Project -readProjectEntry file = send . ReadProjectEntry file - -- | A task which writes a 'B.ByteString' to a 'Handle' or a 'FilePath'. writeToOutput :: Member Files effs => Either Handle FilePath -> B.ByteString -> Eff effs () writeToOutput path = send . WriteToOutput path @@ -188,7 +173,6 @@ data Files out where ReadBlobs :: Either Handle [File] -> Files [Blob.Blob] ReadBlobPairs :: Either Handle [Both File] -> Files [Blob.BlobPair] ReadProject :: FilePath -> Language -> Files Project - ReadProjectEntry :: FilePath -> Language -> Files Project WriteToOutput :: Either Handle FilePath -> B.ByteString -> Files () -- | Run a 'Files' effect in 'IO'. @@ -200,7 +184,6 @@ runFiles = interpret $ \ files -> case files of ReadBlobs (Right paths) -> rethrowing (readBlobsFromPaths paths) ReadBlobPairs source -> rethrowing (either readBlobPairsFromHandle (traverse (runBothWith readFilePair)) source) ReadProject dir language -> rethrowing (readProjectFromPaths dir language) - ReadProjectEntry file language -> rethrowing (readProjectEntryFromPath file language) WriteToOutput destination contents -> liftIO (either B.hPutStr B.writeFile destination contents) diff --git a/src/Semantic/Util.hs b/src/Semantic/Util.hs index 660ddc327..6a1c1665a 100644 --- a/src/Semantic/Util.hs +++ b/src/Semantic/Util.hs @@ -58,7 +58,6 @@ pythonPrelude = Just $ File (TypeLevel.symbolVal (Proxy :: Proxy (PreludePath Py -- Evaluate a project, starting at a single entrypoint. evaluateProject parser lang prelude path = evaluatePackage <$> runTask (readProject path lang >>= parsePackage parser prelude) -evaluateProjectEntry parser lang prelude path = evaluatePackage <$> runTask (readProjectEntry path lang >>= parsePackage parser prelude) parseFile :: Parser term -> FilePath -> IO term parseFile parser = runTask . (parse parser <=< readBlob . file) diff --git a/test/Analysis/Go/Spec.hs b/test/Analysis/Go/Spec.hs index 9222ed48f..97f9672ba 100644 --- a/test/Analysis/Go/Spec.hs +++ b/test/Analysis/Go/Spec.hs @@ -32,4 +32,4 @@ spec = parallel $ do where fixtures = "test/fixtures/go/analysis/" evaluate entry = evalGoProject (fixtures <> entry) - evalGoProject path = runAnalysis @(TestEvaluating Go.Term) <$> evaluateProjectEntry goParser Language.Go Nothing path + evalGoProject path = runAnalysis @(TestEvaluating Go.Term) <$> evaluateProject goParser Language.Go Nothing path diff --git a/test/Analysis/PHP/Spec.hs b/test/Analysis/PHP/Spec.hs index e32c64aed..e8a22cb9c 100644 --- a/test/Analysis/PHP/Spec.hs +++ b/test/Analysis/PHP/Spec.hs @@ -36,4 +36,4 @@ spec = parallel $ do where fixtures = "test/fixtures/php/analysis/" evaluate entry = evalPHPProject (fixtures <> entry) - evalPHPProject path = runAnalysis @(TestEvaluating PHP.Term) <$> evaluateProjectEntry phpParser Language.PHP Nothing path + evalPHPProject path = runAnalysis @(TestEvaluating PHP.Term) <$> evaluateProject phpParser Language.PHP Nothing path diff --git a/test/Analysis/Python/Spec.hs b/test/Analysis/Python/Spec.hs index 7c0c87282..c3b3e9fab 100644 --- a/test/Analysis/Python/Spec.hs +++ b/test/Analysis/Python/Spec.hs @@ -51,4 +51,4 @@ spec = parallel $ do addr = Address . Precise fixtures = "test/fixtures/python/analysis/" evaluate entry = evalPythonProject (fixtures <> entry) - evalPythonProject path = runAnalysis @(TestEvaluating Python.Term) <$> evaluateProjectEntry pythonParser Language.Python pythonPrelude path + evalPythonProject path = runAnalysis @(TestEvaluating Python.Term) <$> evaluateProject pythonParser Language.Python pythonPrelude path diff --git a/test/Analysis/Ruby/Spec.hs b/test/Analysis/Ruby/Spec.hs index 9296ee1ab..245738ae9 100644 --- a/test/Analysis/Ruby/Spec.hs +++ b/test/Analysis/Ruby/Spec.hs @@ -72,4 +72,4 @@ spec = parallel $ do addr = Address . Precise fixtures = "test/fixtures/ruby/analysis/" evaluate entry = evalRubyProject (fixtures <> entry) - evalRubyProject path = runAnalysis @(TestEvaluating Ruby.Term) <$> evaluateProjectEntry rubyParser Language.Ruby rubyPrelude path + evalRubyProject path = runAnalysis @(TestEvaluating Ruby.Term) <$> evaluateProject rubyParser Language.Ruby rubyPrelude path diff --git a/test/Analysis/TypeScript/Spec.hs b/test/Analysis/TypeScript/Spec.hs index c94d3dd26..0bff99808 100644 --- a/test/Analysis/TypeScript/Spec.hs +++ b/test/Analysis/TypeScript/Spec.hs @@ -43,4 +43,4 @@ spec = parallel $ do where fixtures = "test/fixtures/typescript/analysis/" evaluate entry = evalTypeScriptProject (fixtures <> entry) - evalTypeScriptProject path = runAnalysis @(TestEvaluating TypeScript.Term) <$> evaluateProjectEntry typescriptParser Language.TypeScript Nothing path + evalTypeScriptProject path = runAnalysis @(TestEvaluating TypeScript.Term) <$> evaluateProject typescriptParser Language.TypeScript Nothing path