-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
censorProjectWarnings in monorepo workspace spago.yaml
#1316
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,6 @@ import Control.Alternative as Alternative | |
import Control.Monad.Except.Trans (ExceptT(..), runExceptT) | ||
import Control.Monad.Trans.Class (lift) | ||
import Data.Array as Array | ||
import Data.Array.NonEmpty as NonEmptyArray | ||
import Data.Codec.JSON as CJ | ||
import Data.Either (blush) | ||
import Data.Map as Map | ||
|
@@ -106,12 +105,13 @@ toPathDecisions | |
, selectedPackages :: Array WorkspacePackage | ||
, psaCliFlags :: PsaOutputOptions | ||
, censorLibWarnings :: Maybe Core.CensorBuildWarnings | ||
, censorProjectWarnings :: Maybe Core.CensorBuildWarnings | ||
} | ||
-> Array (Effect (Array (LocalPath -> Maybe PathDecision))) | ||
toPathDecisions { rootPath, allDependencies, selectedPackages, psaCliFlags, censorLibWarnings } = | ||
toPathDecisions { rootPath, allDependencies, selectedPackages, psaCliFlags, censorLibWarnings, censorProjectWarnings } = | ||
projectDecisions <> dependencyDecisions | ||
where | ||
projectDecisions = selectedPackages <#> \selected -> toWorkspacePackagePathDecision { selected, psaCliFlags } | ||
projectDecisions = selectedPackages <#> \selected -> toWorkspacePackagePathDecision { selected, psaCliFlags, censorProjectWarnings } | ||
|
||
dependencyDecisions = | ||
map toDependencyDecision | ||
|
@@ -129,6 +129,7 @@ toPathDecisions { rootPath, allDependencies, selectedPackages, psaCliFlags, cens | |
toWorkspacePackagePathDecision | ||
{ selected: p | ||
, psaCliFlags | ||
, censorProjectWarnings | ||
} | ||
_ -> do | ||
let pkgLocation = Tuple.uncurry (Config.getLocalPackageLocation rootPath) dep | ||
|
@@ -144,23 +145,24 @@ toPathDecisions { rootPath, allDependencies, selectedPackages, psaCliFlags, cens | |
toWorkspacePackagePathDecision | ||
:: { selected :: WorkspacePackage | ||
, psaCliFlags :: PsaOutputOptions | ||
, censorProjectWarnings :: Maybe Core.CensorBuildWarnings | ||
} | ||
-> Effect (Array (LocalPath -> Maybe PathDecision)) | ||
toWorkspacePackagePathDecision { selected: { path, package }, psaCliFlags } = do | ||
toWorkspacePackagePathDecision { selected: { path, package }, psaCliFlags, censorProjectWarnings } = do | ||
let srcPath = path </> "src" | ||
let testPath = path </> "test" | ||
pure | ||
[ toPathDecision | ||
{ pathIsFromPackage: (srcPath `Path.isPrefixOf` _) | ||
, pathType: IsSrc | ||
, strict: fromMaybe false $ psaCliFlags.strict <|> (package.build >>= _.strict) | ||
, censorWarnings: package.build >>= _.censorProjectWarnings | ||
, censorWarnings: (package.build >>= _.censorProjectWarnings) <|> censorProjectWarnings | ||
} | ||
, toPathDecision | ||
{ pathIsFromPackage: (testPath `Path.isPrefixOf` _) | ||
, pathType: IsSrc | ||
, strict: fromMaybe false $ psaCliFlags.strict <|> (package.test >>= _.strict) | ||
, censorWarnings: package.test >>= _.censorTestWarnings | ||
, censorWarnings: (package.test >>= _.censorTestWarnings) <|> censorProjectWarnings | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to discuss I looked into pulling this out into a separate param like If you get me |
||
} | ||
] | ||
|
||
|
@@ -193,4 +195,4 @@ shouldPrintWarning = case _ of | |
-- We return `true` to print the warning. | ||
-- If an element was found (i.e. `Just` is returned), then one of the tests succeeded, | ||
-- so we should not print the warning and return false here. | ||
\code msg -> isNothing $ NonEmptyArray.find (\f -> f code msg) tests | ||
\code msg -> isNothing $ Array.find (\f -> f code msg) tests |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package: | ||
name: package-a | ||
dependencies: | ||
- prelude | ||
build: | ||
strict: true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Src.PACKAGE.A where | ||
|
||
import Prelude | ||
|
||
packageName :: String -> String | ||
packageName foo = | ||
"package" <> "package-a" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package: | ||
name: package-b | ||
dependencies: | ||
- package-a | ||
- prelude | ||
build: | ||
strict: true | ||
censor_project_warnings: [] # override workspace |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Src.PACKAGE.B where | ||
|
||
import Prelude | ||
|
||
packageName :: _ | ||
packageName foo = | ||
"package" <> "package-b" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package: | ||
name: package-c | ||
dependencies: | ||
- package-a | ||
- package-b | ||
- prelude | ||
build: | ||
strict: true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Src.PACKAGE.C where | ||
|
||
import Prelude | ||
|
||
packageName :: _ | ||
packageName foo = | ||
"package" <> "package-c" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
workspace: | ||
buildOpts: | ||
censor_project_warnings: all | ||
package_set: | ||
registry: 0.0.1 | ||
extra_packages: {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My editor auto-formatted this markdown on save - can revert if preferred.