Safe Haskell | None |
---|---|
Language | Haskell2010 |
Handling of .restyled.yaml
content and behavior driven there-by
Implementation note: This is a playground. I'm doing lots of HKD stuff here that I would not normally subject my collaborators to.
- We only do this stuff here, and
- It should stay encapsulated away from the rest of the system
References:
Synopsis
- data ConfigF f = ConfigF {
- cfEnabled :: f Bool
- cfExclude :: f (SketchyList Glob)
- cfChangedPaths :: f ChangedPathsConfig
- cfAuto :: f Bool
- cfRemoteFiles :: f (SketchyList RemoteFile)
- cfPullRequests :: f Bool
- cfComments :: f Bool
- cfStatuses :: f Statuses
- cfRequestReview :: f RequestReviewConfig
- cfLabels :: f (SketchyList (Name IssueLabel))
- cfIgnoreLabels :: f (SketchyList (Name IssueLabel))
- cfRestylersVersion :: f String
- cfRestylers :: f (SketchyList RestylerOverride)
- emptyConfig :: ConfigF Maybe
- resolveConfig :: ConfigF Maybe -> ConfigF Identity -> ConfigF Identity
- data Config = Config {
- cEnabled :: Bool
- cExclude :: [Glob]
- cChangedPaths :: ChangedPathsConfig
- cAuto :: Bool
- cRemoteFiles :: [RemoteFile]
- cPullRequests :: Bool
- cComments :: Bool
- cStatuses :: Statuses
- cRequestReview :: RequestReviewConfig
- cLabels :: Set (Name IssueLabel)
- cIgnoreLabels :: Set (Name IssueLabel)
- cRestylers :: [Restyler]
- configPullRequestReviewer :: PullRequest -> Config -> Maybe (Name User)
- loadConfig :: (HasLogFunc env, HasSystem env, HasDownloadFile env) => RIO env Config
- loadConfigF :: HasSystem env => [ConfigSource] -> RIO env (ConfigF Identity)
- decodeThrow' :: (MonadUnliftIO m, MonadThrow m, FromJSON a) => ByteString -> m a
- resolveRestylers :: ConfigF Identity -> [Restyler] -> RIO env Config
Documentation
A polymorphic representation of Config
- The
f
parameter can dictate if attributes are required (
) or optional (Identity
), or optional with override semantics (Maybe
)Last
- Any list keys use
so users can type a single scalar element or a list of many elements.SketchyList
- The
Restylers
attribute is a (sketchy) list of
, which is a function to apply to the later-fetched list of all Restylers.ConfigRestyler
See the various resolve
functions for how to get a real
out of
this beast.Config
ConfigF | |
|
resolveConfig :: ConfigF Maybe -> ConfigF Identity -> ConfigF Identity Source #
Fill out one
from anotherConfigF
Fully resolved configuration
This is what we work with throughout the system.
Config | |
|
Instances
configPullRequestReviewer :: PullRequest -> Config -> Maybe (Name User) Source #
If so configured, return the
from whom to request reviewUser
loadConfig :: (HasLogFunc env, HasSystem env, HasDownloadFile env) => RIO env Config Source #
Load a fully-inflated Config
Read any .restyled.yaml
, fill it out from defaults, grab the versioned set
of restylers data, and apply the configured choices and overrides.
loadConfigF :: HasSystem env => [ConfigSource] -> RIO env (ConfigF Identity) Source #
Load configuration if present and apply defaults
Returns
because defaulting has populated all fields.ConfigF
Identity
May throw any
. May through raw ConfigError
s if
there is a programmer error in our static default configuration YAML.ParseException
decodeThrow' :: (MonadUnliftIO m, MonadThrow m, FromJSON a) => ByteString -> m a Source #
, but wrapping YAML parse errors to decodeThrow
ConfigError
resolveRestylers :: ConfigF Identity -> [Restyler] -> RIO env Config Source #
Populate
using the versioned restylers datacRestylers
May throw
.ConfigErrorInvalidRestylers