1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 10:15:55 +03:00

Fix weird spacing and overly complicated callGraphPythonProject.

This commit is contained in:
Patrick Thomson 2019-09-20 12:41:05 -04:00
parent 090b014eed
commit 2e7a236f82
2 changed files with 4 additions and 4 deletions

View File

@ -36,12 +36,12 @@ readBlobFromFile' file = do
maybeFile <- readBlobFromFile file
maybeM (Prelude.fail ("cannot read '" <> show file <> "', file not found or language not supported.")) maybeFile
-- | Read all blobs in the directory with Language.supportedExts
-- | Read all blobs in the directory with Language.supportedExts.
readBlobsFromDir :: MonadIO m => FilePath -> m [Blob]
readBlobsFromDir path = liftIO . fmap catMaybes $
findFilesInDir path supportedExts mempty >>= Async.mapConcurrently (readBlobFromFile . fileForPath)
readBlobsFromGitRepoPath :: (Part.AbsRel ar, MonadIO m) => Path.Dir ar -> Git.OID -> [Path.RelFile] -> [Path.RelFile] -> m [Blob]
readBlobsFromGitRepoPath :: (Part.AbsRel ar, MonadIO m) => Path.Dir ar -> Git.OID -> [Path.RelFile] -> [Path.RelFile] -> m [Blob]
readBlobsFromGitRepoPath path oid excludePaths includePaths
= readBlobsFromGitRepo (Path.toString path) oid (fmap Path.toString excludePaths) (fmap Path.toString includePaths)

View File

@ -17,8 +17,8 @@ callGraphPythonProject :: Path.RelFile -> IO (Semantic.Graph.Graph ControlFlowVe
callGraphPythonProject path = runTaskOrDie $ do
let proxy = Proxy @'Language.Python
let lang = Language.Python
blobs <- catMaybes <$> traverse readBlobFromFile (flip File lang <$> [Path.toString path])
package <- fmap snd <$> parsePackage pythonParser (Project (Path.toString (Path.takeDirectory path)) blobs lang [])
blob <- readBlobFromFile' (fileForRelPath path)
package <- fmap snd <$> parsePackage pythonParser (Project (Path.toString (Path.takeDirectory path)) [blob] lang [])
modules <- topologicalSort <$> runImportGraphToModules proxy package
runCallGraph proxy False modules package