1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 23:11:50 +03:00

Merge branch 'master' into operating-docs-updates

This commit is contained in:
Timothy Clem 2018-10-22 08:26:25 -07:00 committed by GitHub
commit 24f4161ae9
5 changed files with 21 additions and 8 deletions

View File

@ -293,7 +293,7 @@ library
, StrictData , StrictData
, TypeApplications , TypeApplications
if flag(release) if flag(release)
ghc-options: -Wall -Werror -Wmissing-export-lists -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints -fno-warn-name-shadowing -O1 -j ghc-options: -Wall -Werror -Wmissing-export-lists -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints -fno-warn-name-shadowing -O1 -j -DCOMPUTE_GIT_SHA
else else
ghc-options: -Wall -Wmissing-export-lists -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints -fno-warn-name-shadowing -O0 -j +RTS -A128m -n2m -RTS ghc-options: -Wall -Wmissing-export-lists -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints -fno-warn-name-shadowing -O0 -j +RTS -A128m -n2m -RTS
ghc-prof-options: -fprof-auto ghc-prof-options: -fprof-auto
@ -302,7 +302,7 @@ executable semantic
hs-source-dirs: app hs-source-dirs: app
main-is: Main.hs main-is: Main.hs
if flag(release) if flag(release)
ghc-options: -threaded -rtsopts "-with-rtsopts=-N -A4m -n2m" -static -j -O1 -j ghc-options: -threaded -rtsopts "-with-rtsopts=-N -A4m -n2m" -static -j -O1 -j -DCOMPUTE_GIT_SHA
else else
ghc-options: -threaded -rtsopts "-with-rtsopts=-N -A4m -n2m" -static -j -O0 -j ghc-options: -threaded -rtsopts "-with-rtsopts=-N -A4m -n2m" -static -j -O0 -j
cc-options: -DU_STATIC_IMPLEMENTATION=1 cc-options: -DU_STATIC_IMPLEMENTATION=1

View File

@ -46,7 +46,8 @@ optionsParser = do
(long "log-level" <> value (Just Log.Warning) <> help "Log messages at or above this level, or disable logging entirely.") (long "log-level" <> value (Just Log.Warning) <> help "Log messages at or above this level, or disable logging entirely.")
requestId <- optional (strOption $ long "request-id" <> help "A string to use as the request identifier for any logged messages." <> metavar "id") requestId <- optional (strOption $ long "request-id" <> help "A string to use as the request identifier for any logged messages." <> metavar "id")
failOnWarning <- switch (long "fail-on-warning" <> help "Fail on assignment warnings.") failOnWarning <- switch (long "fail-on-warning" <> help "Fail on assignment warnings.")
pure $ Options logLevel requestId failOnWarning failOnParseError <- switch (long "fail-on-parse-error" <> help "Fail on tree-sitter parse errors.")
pure $ Options logLevel requestId failOnWarning failOnParseError
argumentsParser :: Parser (Task.TaskEff ()) argumentsParser :: Parser (Task.TaskEff ())
argumentsParser = do argumentsParser = do

View File

@ -50,16 +50,17 @@ data Config
-- Options configurable via command line arguments. -- Options configurable via command line arguments.
data Options data Options
= Options = Options
{ optionsLogLevel :: Maybe Level -- ^ What level of messages to log. 'Nothing' disabled logging. { optionsLogLevel :: Maybe Level -- ^ What level of messages to log. 'Nothing' disables logging.
, optionsRequestID :: Maybe String -- ^ Optional request id for tracing across systems. , optionsRequestID :: Maybe String -- ^ Optional request id for tracing across systems.
, optionsFailOnWarning :: Bool -- ^ Should semantic fail fast on assignment warnings (for testing) , optionsFailOnWarning :: Bool -- ^ Should semantic fail fast on assignment warnings (for testing)
, optionsFailOnParseError :: Bool -- ^ Should semantic fail fast on tree-sitter parser errors (for testing)
} }
defaultOptions :: Options defaultOptions :: Options
defaultOptions = Options (Just Warning) Nothing False defaultOptions = Options (Just Warning) Nothing False False
debugOptions :: Options debugOptions :: Options
debugOptions = Options (Just Debug) Nothing False debugOptions = Options (Just Debug) Nothing False False
defaultConfig :: Options -> IO Config defaultConfig :: Options -> IO Config
defaultConfig options@Options{..} = do defaultConfig options@Options{..} = do

View File

@ -269,6 +269,7 @@ runParser blob@Blob{..} parser = case parser of
Just "ParseError" -> do Just "ParseError" -> do
writeStat (increment "parse.parse_errors" languageTag) writeStat (increment "parse.parse_errors" languageTag)
logError config Warning blob err (("task", "parse") : blobFields) logError config Warning blob err (("task", "parse") : blobFields)
when (optionsFailOnParseError (configOptions config)) $ throwError (toException err)
_ -> do _ -> do
writeStat (increment "parse.assign_warnings" languageTag) writeStat (increment "parse.assign_warnings" languageTag)
logError config Warning blob err (("task", "assign") : blobFields) logError config Warning blob err (("task", "assign") : blobFields)

View File

@ -1,17 +1,27 @@
{-# LANGUAGE CPP #-}
#ifdef COMPUTE_GIT_SHA
{-# OPTIONS_GHC -fforce-recomp #-} -- So that gitHash is correct. {-# OPTIONS_GHC -fforce-recomp #-} -- So that gitHash is correct.
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
#endif
module Semantic.Version module Semantic.Version
( buildSHA ( buildSHA
, buildVersion , buildVersion
) where ) where
import Data.Version (showVersion) import Data.Version (showVersion)
#ifdef COMPUTE_GIT_SHA
import Development.GitRev import Development.GitRev
#endif
import Paths_semantic (version) import Paths_semantic (version)
-- The SHA1 hash of this build of semantic. -- The SHA1 hash of this build of semantic.
-- If compiled as a development build, this will be @<development>@.
buildSHA :: String buildSHA :: String
#ifdef COMPUTE_GIT_SHA
buildSHA = $(gitHash) buildSHA = $(gitHash)
#else
buildSHA = "<development>"
#endif
-- The version string of this build of semantic. -- The version string of this build of semantic.
buildVersion :: String buildVersion :: String