mirror of
https://github.com/github/semantic.git
synced 2024-11-27 03:09:48 +03:00
Enable hard-mode warnings project-wide.
This commit is contained in:
parent
17f860a6bd
commit
f68fa5ea30
@ -2,31 +2,22 @@
|
||||
|
||||
module Evaluation (benchmarks) where
|
||||
|
||||
import Algebra.Graph
|
||||
import Control.Monad
|
||||
import Control.Carrier.Parse.Simple
|
||||
import qualified Data.Duration as Duration
|
||||
import Data.Abstract.Evaluatable
|
||||
import Data.Abstract.FreeVariables
|
||||
import Data.Blob
|
||||
import Data.Blob.IO (readBlobFromFile')
|
||||
import Data.Bifunctor
|
||||
import Data.Functor.Classes
|
||||
import Data.Functor.Foldable (Base, Recursive)
|
||||
import "semantic" Data.Graph (Graph (..), topologicalSort)
|
||||
import Data.Graph.ControlFlowVertex
|
||||
import "semantic" Data.Graph (topologicalSort)
|
||||
import qualified Data.Language as Language
|
||||
import Data.Project
|
||||
import Data.Proxy
|
||||
import Data.Term
|
||||
import Gauge.Main
|
||||
import Parsing.Parser
|
||||
import Semantic.Config (defaultOptions)
|
||||
import Semantic.Graph
|
||||
import Semantic.Task (SomeException, TaskSession (..), runTask, withOptions)
|
||||
import Semantic.Task (TaskSession (..), runTask, withOptions)
|
||||
import Semantic.Util
|
||||
import Source.Loc
|
||||
import Source.Span (HasSpan)
|
||||
import qualified System.Path as Path
|
||||
import System.Path ((</>))
|
||||
|
||||
@ -40,20 +31,22 @@ callGraphProject' :: ( Language.SLanguage lang
|
||||
-> Path.RelFile
|
||||
-> IO (Either String ())
|
||||
callGraphProject' session proxy path
|
||||
| let lang = Language.reflect proxy
|
||||
, Just (SomeParser parser) <- parserForLanguage analysisParsers lang = fmap (bimap show (const ())) . runTask session $ do
|
||||
| Just (SomeParser parser) <- parserForLanguage analysisParsers lang = fmap (bimap show (const ())) . runTask session $ do
|
||||
blob <- readBlobFromFile' (fileForTypedPath path)
|
||||
package <- fmap snd <$> runParse (Duration.fromSeconds 10) (parsePackage parser (Project (Path.toString (Path.takeDirectory path)) [blob] lang []))
|
||||
modules <- topologicalSort <$> runImportGraphToModules proxy package
|
||||
runCallGraph proxy False modules package
|
||||
| otherwise = error $ "Analysis not supported for: " <> show lang
|
||||
where lang = Language.reflect proxy
|
||||
|
||||
callGraphProject proxy paths = withOptions defaultOptions $ \ config logger statter ->
|
||||
callGraphProject' (TaskSession config "" False logger statter) proxy paths
|
||||
|
||||
evaluateProject proxy path
|
||||
| let lang = Language.reflect proxy
|
||||
, Just (SomeParser parser) <- parserForLanguage analysisParsers lang = withOptions defaultOptions $ \ config logger statter ->
|
||||
| Just (SomeParser parser) <- parserForLanguage analysisParsers lang = withOptions defaultOptions $ \ config logger statter ->
|
||||
fmap (const ()) . justEvaluating =<< evaluateProject' (TaskSession config "" False logger statter) proxy parser [Path.toString path]
|
||||
| otherwise = error $ "Analysis not supported for: " <> show lang
|
||||
where lang = Language.reflect proxy
|
||||
|
||||
pyEval :: Path.RelFile -> Benchmarkable
|
||||
pyEval p = nfIO $ evaluateProject (Proxy @'Language.Python) (Path.relDir "bench/bench-fixtures/python" </> p)
|
||||
|
@ -1,4 +1,4 @@
|
||||
module Main where
|
||||
module Main (main) where
|
||||
|
||||
import Gauge
|
||||
import qualified Evaluation
|
||||
|
@ -26,6 +26,21 @@ flag release
|
||||
common haskell
|
||||
default-language: Haskell2010
|
||||
default-extensions: StrictData
|
||||
ghc-options:
|
||||
-Weverything
|
||||
-Wno-missing-local-signatures
|
||||
-Wno-missing-import-lists
|
||||
-Wno-implicit-prelude
|
||||
-Wno-safe
|
||||
-Wno-unsafe
|
||||
-Wno-name-shadowing
|
||||
-Wno-monomorphism-restriction
|
||||
-Wno-missed-specialisations
|
||||
-Wno-all-missed-specialisations
|
||||
-Wno-star-is-type
|
||||
if (impl(ghc >= 8.8))
|
||||
ghc-options: -Wno-missing-deriving-strategies
|
||||
|
||||
|
||||
-- Except in case of vendored dependencies, these deps should be expressed
|
||||
-- as caret-operator bounds relative to a version in Stackage.
|
||||
@ -61,11 +76,8 @@ common dependencies
|
||||
common executable-flags
|
||||
ghc-options: -threaded -rtsopts "-with-rtsopts=-N -A4m -n2m"
|
||||
|
||||
common ghc-warnings
|
||||
ghc-options: -Wall -Wmissing-export-lists -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints -Wno-name-shadowing
|
||||
|
||||
library
|
||||
import: haskell, dependencies, ghc-warnings
|
||||
import: haskell, dependencies
|
||||
hs-source-dirs: src
|
||||
exposed-modules:
|
||||
-- Analyses & term annotations
|
||||
@ -304,7 +316,7 @@ executable semantic
|
||||
, semantic
|
||||
|
||||
test-suite test
|
||||
import: haskell, dependencies, executable-flags, ghc-warnings
|
||||
import: haskell, dependencies, executable-flags
|
||||
type: exitcode-stdio-1.0
|
||||
hs-source-dirs: test
|
||||
main-is: Spec.hs
|
||||
|
@ -1,5 +1,5 @@
|
||||
{-# LANGUAGE DataKinds, FlexibleContexts, PartialTypeSignatures, TypeApplications, TypeOperators #-}
|
||||
{-# OPTIONS_GHC -Wno-missing-signatures -Wno-partial-type-signatures -O0 #-}
|
||||
{-# OPTIONS_GHC -Wno-missing-signatures -Wno-missing-exported-signatures -Wno-partial-type-signatures -O0 #-}
|
||||
module Semantic.Util
|
||||
( evaluateProject'
|
||||
, justEvaluating
|
||||
|
Loading…
Reference in New Issue
Block a user