mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-09-19 06:28:39 +03:00
refactor(hlint): Demote Environment-from-OS to a suggestion
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8092 GitOrigin-RevId: 042aec936638fcb7890ecaa8cb368ed442100904
This commit is contained in:
parent
0271094df7
commit
1af8d53c6f
18
.hlint.yaml
18
.hlint.yaml
@ -31,14 +31,6 @@
|
||||
|
||||
- functions:
|
||||
|
||||
- name: "System.Environment.getEnvironment"
|
||||
within: ["Harness.**", "Main", "Spec.**", "SpecHook", "Test.**"]
|
||||
message: "Instead of 'getEnvironment', use the environment from the server context"
|
||||
|
||||
- name: "Data.Environment.getEnvironment"
|
||||
within: ["Harness.**", "Main", "Spec.**", "SpecHook", "Test.**"]
|
||||
message: "Instead of 'getEnvironment', use the environment from the server context"
|
||||
|
||||
- name: "Test.Hspec.focus"
|
||||
within: []
|
||||
message: "Specs with focusing should only be used during development"
|
||||
@ -246,6 +238,16 @@
|
||||
- error: {lhs: "Control.Concurrent.threadDelay", rhs: "Control.Concurrent.Extended.sleep", note: "Please use `sleep` instead (and read the docs!)"}
|
||||
- suggest: {lhs: "Control.Concurrent.Async.Lifted.Safe.async", rhs: "Control.Concurrent.Async.Lifted.Safe.withAsync", note: "Please use 'Control.Control.Concurrent.Async.Lifted.Safe.withAsync' or our 'forkImmortal' instead for more robust threading."}
|
||||
- suggest: {lhs: "Control.Concurrent.forkIO", rhs: "Control.Concurrent.Async.Lifted.Safe.withAsync", note: "Please use 'Control.Control.Concurrent.Async.Lifted.Safe.withAsync' or our 'forkImmortal' instead for more robust threading."}
|
||||
- suggest: {
|
||||
lhs: "System.Environment.getEnvironment",
|
||||
rhs: "env_from_function_argument",
|
||||
note: "Instead of 'getEnvironment', use the environment from the server context, typically accessible as a function argument"
|
||||
}
|
||||
- suggest: {
|
||||
lhs: "Data.Environment.getEnvironment",
|
||||
rhs: "env_from_function_argument",
|
||||
note: "Instead of 'getEnvironment', use the environment from the server context, typically accessible as a function argument"
|
||||
}
|
||||
|
||||
- ignore: {
|
||||
group: {name: "unsafe"},
|
||||
|
@ -36,7 +36,7 @@ import System.Exit qualified as Sys
|
||||
import System.Metrics qualified as EKG
|
||||
import System.Posix.Signals qualified as Signals
|
||||
|
||||
{-# ANN main ("HLint: ignore Avoid restricted function" :: String) #-}
|
||||
{-# ANN main ("HLINT: ignore Use env_from_function_argument" :: String) #-}
|
||||
main :: IO ()
|
||||
main = maybeWithGhcDebug $ do
|
||||
catch
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
|
||||
|
||||
module Data.Environment
|
||||
( Environment (),
|
||||
getEnvironment,
|
||||
@ -21,7 +23,7 @@ newtype Environment = Environment (M.Map String String) deriving (Eq, Show, Gene
|
||||
instance FromJSON Environment
|
||||
|
||||
-- 'getEnvironment' is allowed to use 'System.Environment.getEnvironment'
|
||||
{-# ANN getEnvironment ("HLINT: ignore Avoid restricted function" :: String) #-}
|
||||
{-# ANN getEnvironment ("HLINT: ignore Use env_from_function_argument" :: String) #-}
|
||||
getEnvironment :: IO Environment
|
||||
getEnvironment = mkEnvironment <$> System.Environment.getEnvironment
|
||||
|
||||
|
@ -49,6 +49,7 @@ import Test.Hasura.Server.MigrateSuite qualified as MigrateSuite
|
||||
import Test.Hasura.StreamingSubscriptionSuite qualified as StreamingSubscriptionSuite
|
||||
import Test.Hspec
|
||||
|
||||
{-# ANN main ("HLINT: ignore Use env_from_function_argument" :: String) #-}
|
||||
main :: IO ()
|
||||
main = do
|
||||
env <- getEnvironment
|
||||
|
Loading…
Reference in New Issue
Block a user