mirror of
https://github.com/github/semantic.git
synced 2024-11-28 10:15:55 +03:00
Merge branch 'master' into remove-orphan-bytestring-listable
This commit is contained in:
commit
30fd1b4abf
@ -4,6 +4,7 @@ cache:
|
||||
directories:
|
||||
- $HOME/.cabal/packages
|
||||
- $HOME/.cabal/store
|
||||
- $TRAVIS_BUILD_DIR/dist-newstyle
|
||||
|
||||
before_cache:
|
||||
- rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
|
||||
@ -28,12 +29,12 @@ before_install:
|
||||
- cabal --version
|
||||
|
||||
install:
|
||||
- cabal new-update -v hackage.haskell.org
|
||||
- cabal new-configure --enable-tests --write-ghc-environment-files=always
|
||||
- cabal new-build --only-dependencies -j
|
||||
- cabal new-update -v
|
||||
- cabal new-configure --enable-tests --disable-optimization --write-ghc-environment-files=always --jobs=2
|
||||
- cabal new-build --only-dependencies
|
||||
|
||||
script:
|
||||
- cabal new-build -j
|
||||
- cabal new-build
|
||||
- cabal new-run semantic:test
|
||||
- cabal new-run semantic-core:spec
|
||||
# parse-examples is disabled because it slaughters our CI
|
||||
|
@ -108,7 +108,7 @@ cabal new-test
|
||||
cabal new-run semantic -- --help
|
||||
```
|
||||
|
||||
`semantic` requires at least GHC 8.6.4. We recommend using [`ghcup`][ghcup] to sandbox GHC versions. Our version bounds are based on [Stackage][stackage] LTS versions. The current LTS version is 13.13. `stack` as a build tool is not officially supported; there is an unofficial [`stack.yaml`](https://gist.github.com/jkachmar/f200caee83280f1f25e9cfa2dd2b16bb) available, though we cannot make guarantees as to its stability.
|
||||
`semantic` requires at least GHC 8.6.4 and Cabal 2.4. We recommend using [`ghcup`][ghcup] to sandbox GHC versions. `stack` as a build tool is not officially supported; there is an unofficial [`stack.yaml`](https://gist.github.com/jkachmar/f200caee83280f1f25e9cfa2dd2b16bb) available, though we cannot make guarantees as to its stability.
|
||||
|
||||
[nix]: https://www.haskell.org/cabal/users-guide/nix-local-build-overview.html
|
||||
[stackage]: https://stackage.org
|
||||
|
@ -1,4 +1,4 @@
|
||||
cabal-version: 2.2
|
||||
cabal-version: 2.4
|
||||
|
||||
name: semantic-core
|
||||
version: 0.0.0.0
|
||||
|
@ -1,4 +1,4 @@
|
||||
cabal-version: 2.2
|
||||
cabal-version: 2.4
|
||||
name: semantic
|
||||
version: 0.6.0.0
|
||||
synopsis: Framework and executable for analyzing and diffing untrusted code.
|
||||
@ -73,8 +73,11 @@ 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
|
||||
import: haskell, dependencies, ghc-warnings
|
||||
hs-source-dirs: src
|
||||
exposed-modules:
|
||||
-- Analyses & term annotations
|
||||
@ -321,7 +324,6 @@ library
|
||||
, tree-sitter-typescript ^>= 0.1.0.0
|
||||
, tree-sitter-tsx ^>= 0.1.0.0
|
||||
, tree-sitter-java ^>= 0.1.0.0
|
||||
ghc-options: -Wall -Wmissing-export-lists -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints -fno-warn-name-shadowing
|
||||
if flag(release)
|
||||
cpp-options: -DCOMPUTE_GIT_SHA
|
||||
else
|
||||
@ -337,10 +339,9 @@ executable semantic
|
||||
, semantic
|
||||
|
||||
test-suite test
|
||||
import: haskell, dependencies, executable-flags
|
||||
import: haskell, dependencies, executable-flags, ghc-warnings
|
||||
type: exitcode-stdio-1.0
|
||||
hs-source-dirs: test
|
||||
ghc-options: -Wunused-imports
|
||||
main-is: Spec.hs
|
||||
other-modules: Analysis.Go.Spec
|
||||
, Analysis.PHP.Spec
|
||||
|
@ -13,11 +13,8 @@ module Data.Language
|
||||
) where
|
||||
|
||||
import Data.Aeson
|
||||
import Data.Char (toUpper)
|
||||
import Data.String
|
||||
import qualified Data.Text as T
|
||||
import Prologue
|
||||
import Proto3.Suite
|
||||
import System.FilePath.Posix
|
||||
|
||||
-- | The various languages we support.
|
||||
@ -37,7 +34,7 @@ data Language
|
||||
| TypeScript
|
||||
| PHP
|
||||
| TSX
|
||||
deriving (Eq, Generic, Ord, Read, Show, Bounded, Hashable, ToJSON, Named, Enum, MessageField, NFData)
|
||||
deriving (Eq, Generic, Ord, Read, Show, Bounded, Hashable, ToJSON, Enum, NFData)
|
||||
|
||||
class SLanguage (lang :: Language) where
|
||||
reflect :: proxy lang -> Language
|
||||
@ -78,12 +75,6 @@ instance SLanguage 'TypeScript where
|
||||
instance SLanguage 'PHP where
|
||||
reflect _ = PHP
|
||||
|
||||
|
||||
-- This ensures that the protobuf file is generated with ALL_CAPS_NAMES.
|
||||
instance Finite Language where
|
||||
enumerate _ = fmap go [Unknown ..] where
|
||||
go x = (fromString (fmap toUpper (show x)), fromEnum x)
|
||||
|
||||
instance FromJSON Language where
|
||||
parseJSON = withText "Language" $ \l ->
|
||||
pure $ fromMaybe Unknown (parseLanguage l)
|
||||
@ -107,18 +98,6 @@ parseLanguage l = case T.toLower l of
|
||||
knownLanguage :: Language -> Bool
|
||||
knownLanguage = (/= Unknown)
|
||||
|
||||
-- | Defaults to 'Unknown'.
|
||||
instance HasDefault Language where def = Unknown
|
||||
|
||||
-- | Piggybacks on top of the 'Enumerated' instance, as the generated code would.
|
||||
-- This instance will get easier when we have DerivingVia.
|
||||
instance Primitive Language where
|
||||
primType _ = primType (Proxy @(Enumerated Language))
|
||||
encodePrimitive f = encodePrimitive f . Enumerated . Right
|
||||
decodePrimitive = decodePrimitive >>= \case
|
||||
(Enumerated (Right r)) -> pure r
|
||||
other -> Prelude.fail ("Language decodeMessageField: unexpected value" <> show other)
|
||||
|
||||
-- | Returns a Language based on the file extension (including the ".").
|
||||
languageForType :: String -> Language
|
||||
languageForType mediaType = case mediaType of
|
||||
|
@ -1,4 +1,4 @@
|
||||
{-# LANGUAGE ApplicativeDo, RankNTypes #-}
|
||||
{-# LANGUAGE ApplicativeDo #-}
|
||||
module Semantic.CLI (main) where
|
||||
|
||||
import Control.Exception as Exc (displayException)
|
||||
|
@ -225,7 +225,6 @@ blankDiff = merge (Nothing, Nothing) (inject [ inserting (termIn Nothing (inject
|
||||
|
||||
-- Diff helpers
|
||||
diffWithParser :: ( Eq1 syntax
|
||||
, Show1 syntax
|
||||
, Traversable syntax
|
||||
, Diffable syntax
|
||||
, HasDeclaration syntax
|
||||
@ -233,7 +232,6 @@ diffWithParser :: ( Eq1 syntax
|
||||
, Member Distribute sig
|
||||
, Member Task sig
|
||||
, Carrier sig m
|
||||
, Monad m
|
||||
)
|
||||
=> Parser (Term syntax Location)
|
||||
-> BlobPair
|
||||
|
@ -2,12 +2,12 @@
|
||||
|
||||
module Reprinting.Spec where
|
||||
|
||||
import SpecHelpers hiding (inject, project)
|
||||
import SpecHelpers
|
||||
|
||||
import Data.Foldable
|
||||
import qualified Data.Machine as Machine
|
||||
|
||||
import Control.Rewriting hiding (context)
|
||||
import Control.Rewriting
|
||||
import qualified Data.Language as Language
|
||||
import Data.Reprinting.Scope
|
||||
import Data.Reprinting.Token
|
||||
|
@ -19,7 +19,7 @@ module SpecHelpers
|
||||
, EdgeLabel(..)
|
||||
) where
|
||||
|
||||
import Control.Abstract hiding (lookupDeclaration)
|
||||
import Control.Abstract
|
||||
import Data.Abstract.ScopeGraph (EdgeLabel(..))
|
||||
import qualified Data.Abstract.ScopeGraph as ScopeGraph
|
||||
import qualified Data.Abstract.Heap as Heap
|
||||
@ -27,7 +27,7 @@ import Control.Effect.Trace as X (runTraceByIgnoring, runTraceByReturning)
|
||||
import Control.Monad ((>=>))
|
||||
import Data.Traversable as X (for)
|
||||
import Data.Abstract.Address.Precise as X
|
||||
import Data.Abstract.Evaluatable hiding (lookupDeclaration)
|
||||
import Data.Abstract.Evaluatable
|
||||
import Data.Abstract.FreeVariables as X
|
||||
import Data.Abstract.Module as X
|
||||
import Data.Abstract.ModuleTable as X hiding (lookup)
|
||||
@ -51,7 +51,7 @@ import Data.String
|
||||
import Data.Sum
|
||||
import Data.Term as X
|
||||
import Parsing.Parser as X
|
||||
import Semantic.Task as X hiding (parsePackage)
|
||||
import Semantic.Task as X
|
||||
import Semantic.Util as X
|
||||
import Semantic.Graph (runHeap, runScopeGraph)
|
||||
import System.FilePath as X
|
||||
|
Loading…
Reference in New Issue
Block a user