Skip to content

Commit

Permalink
Hush doctest
Browse files Browse the repository at this point in the history
  • Loading branch information
ffaf1 committed Sep 19, 2022
1 parent e44f74f commit 65aa389
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions Cabal/src/Distribution/PackageDescription/Check.hs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ checkGenericPackageDescription
condLibrary_ condSubLibraries_ condForeignLibs_ condExecutables_
condTestSuites_ condBenchmarks_)
= do
-- * Description and names.
-- § Description and names.
checkPackageDescription packageDescription_
-- Targets should be present...
let condAllLibraries = maybeToList condLibrary_ ++
Expand All @@ -219,13 +219,13 @@ checkGenericPackageDescription
-- Flag names.
mapM_ checkFlagName genPackageFlags_

-- * Feature checks.
-- § Feature checks.
checkSpecVer CabalSpecV2_0 (not . null $ condSubLibraries_)
(PackageDistInexcusable CVMultiLib)
checkSpecVer CabalSpecV1_8 (not . null $ condTestSuites_)
(PackageDistInexcusable CVTestSuite)

-- * Conditional targets
-- § Conditional targets
case condLibrary_ of
Just cl -> checkCondTarget
genPackageFlags_
Expand Down Expand Up @@ -295,7 +295,7 @@ checkPackageDescription
_subLibraries_ _executables_ _foreignLibs_ _testSuites_ _benchmarks_
dataFiles_ dataDir_ extraSrcFiles_ extraTmpFiles_ extraDocFiles_) = do

-- * Sanity checks.
-- § Sanity checks.
checkPackageId package_
-- TODO `name` is caught at parse level, remove this test.
let pn = packageName package_
Expand All @@ -309,7 +309,7 @@ checkPackageDescription
checkP (any (== prettyShow pn) (prettyShow <$> nsubs))
(PackageBuildImpossible $ IllegalLibraryName pn)

-- * Fields check.
-- § Fields check.
checkNull category_
(PackageDistSuspicious $ MissingField CEFCategory)
checkNull maintainer_
Expand All @@ -326,7 +326,7 @@ checkPackageDescription
ShortText.length description_ <= ShortText.length synopsis_)
(PackageDistSuspicious ShortDesc)

-- * Paths.
-- § Paths.
mapM_ (checkPath False "extra-source-files" PathKindGlob) extraSrcFiles_
mapM_ (checkPath False "extra-tmp-files" PathKindFile) extraTmpFiles_
mapM_ (checkPath False "extra-doc-files" PathKindGlob) extraDocFiles_
Expand All @@ -340,7 +340,7 @@ checkPackageDescription
mapM_ (checkGlob "extra-source-files") extraSrcFiles_
mapM_ (checkGlob "extra-doc-files") extraDocFiles_

-- * Datafield checks.
-- § Datafield checks.
checkSetupBuildInfo setupBuildInfo_
mapM_ checkTestedWith testedWith_
either checkNewLicense
Expand Down Expand Up @@ -567,7 +567,7 @@ checkLibrary isSub lib@(Library
(view L.autogenIncludes lib)) $
(PackageBuildImpossible AutogenIncludesNotIncluded)

-- * Build infos.
-- § Build infos.
checkBuildInfo BITLib (explicitLibModules lib) libBuildInfo_

-- Feature checks.
Expand All @@ -591,7 +591,7 @@ checkForeignLib (ForeignLib
checkExecutable :: Monad m => PackageId -> Executable -> CheckM m ()
checkExecutable pid exe@(Executable
exeName_ modulePath_ _exeScope_ buildInfo_) = do
-- * Exe specific checks
-- § Exe specific checks
checkP (null modulePath_)
(PackageBuildImpossible (NoMainIs exeName_))
-- This check does not apply to scripts.
Expand All @@ -600,7 +600,7 @@ checkExecutable pid exe@(Executable
not (fileExtensionSupportedLanguage $ modulePath_))
(PackageBuildImpossible NoHsLhsMain)

-- * Features check
-- § Features check
checkSpecVer CabalSpecV1_18
(fileExtensionSupportedLanguage modulePath_ &&
takeExtension modulePath_ `notElem` [".hs", ".lhs"])
Expand All @@ -614,14 +614,14 @@ checkExecutable pid exe@(Executable
(view L.autogenIncludes exe))
(PackageBuildImpossible AutogenIncludesNotIncludedExe)

-- * Build info checks.
-- § Build info checks.
checkBuildInfo BITOther [] buildInfo_

checkTestSuite :: Monad m => TestSuite -> CheckM m ()
checkTestSuite ts@(TestSuite
testName_ testInterface_ testBuildInfo_
_testCodeGenerators_) = do
-- * TS specific checks.
-- § TS specific checks.
-- TODO caught by the parser, can remove safely
case testInterface_ of
TestSuiteUnsupported tt@(TestTypeUnknown _ _) ->
Expand All @@ -638,12 +638,12 @@ checkTestSuite ts@(TestSuite
(view L.autogenIncludes ts))
(PackageBuildImpossible AutogenIncludesNotIncludedExe)

-- * Feature checks.
-- § Feature checks.
checkSpecVer CabalSpecV1_18
(mainIsNotHsExt && not mainIsWrongExt)
(PackageDistInexcusable MainCCabal1_18)

-- * Build info checks.
-- § Build info checks.
checkBuildInfo BITTestBench [] testBuildInfo_
where
mainIsWrongExt =
Expand All @@ -660,7 +660,7 @@ checkBenchmark :: Monad m => Benchmark -> CheckM m ()
checkBenchmark bm@(Benchmark
benchmarkName_ benchmarkInterface_
benchmarkBuildInfo_) = do
-- * Interface & bm specific tests.
-- § Interface & bm specific tests.
case benchmarkInterface_ of
BenchmarkUnsupported tt@(BenchmarkTypeUnknown _ _) ->
tellP (PackageBuildWarning $ BenchmarkTypeNotKnown tt)
Expand All @@ -678,7 +678,7 @@ checkBenchmark bm@(Benchmark
(view L.autogenIncludes bm))
(PackageBuildImpossible AutogenIncludesNotIncludedExe)

-- * BuildInfo checks.
-- § BuildInfo checks.
checkBuildInfo BITTestBench [] benchmarkBuildInfo_
where
-- Cannot abstract with similar function in checkTestSuite,
Expand Down Expand Up @@ -708,7 +708,7 @@ data BITarget = BITLib | BITTestBench | BITOther
checkBuildInfo :: Monad m => BITarget -> [ModuleName] -> BuildInfo ->
CheckM m ()
checkBuildInfo t ams bi = do
-- * Options.
-- § Options.
checkGHCOptions "ghc-options" t (hcOptions GHC bi)
checkGHCOptions "ghc-prof-options" t (hcProfOptions GHC bi)
checkGHCOptions "ghc-shared-options" t (hcSharedOptions GHC bi)
Expand All @@ -717,7 +717,7 @@ checkBuildInfo t ams bi = do
checkCLikeOptions "C++" "cxx-options" (cxxOptions bi) ldOpts
checkCPPOptions (cppOptions bi)

-- * Paths: content.
-- § Paths: content.
mapM_ checkLang (allLanguages bi)
mapM_ checkExt (allExtensions bi)
mapM_ checkDep (targetBuildDepends bi)
Expand All @@ -726,7 +726,7 @@ checkBuildInfo t ams bi = do
let ds = buildToolDepends bi ++ catMaybes (map df $ buildTools bi)
mapM_ checkBTDep ds

-- * Paths: well formedness
-- § Paths: well formedness
mapM_ (checkPath False "asm-sources" PathKindFile) (asmSources bi)
mapM_ (checkPath False "cmm-sources" PathKindFile) (cmmSources bi)
mapM_ (checkPath False "c-sources" PathKindFile) (cSources bi)
Expand All @@ -746,7 +746,7 @@ checkBuildInfo t ams bi = do
(extraLibDirsStatic bi)
mapM_ checkOptionPath (perCompilerFlavorToList $ options bi)

-- * Feature checks --
-- § Feature checks --
sv <- asksCM ccSpecVersion
checkSpecVer CabalSpecV1_10 (isJust $ defaultLanguage bi)
(PackageBuildWarning CVDefaultLanguage)
Expand Down

0 comments on commit 65aa389

Please sign in to comment.