Add “Ignore warning” option to cabal check
commit08591a9982f4f2c79e7fbfb86b4e4b1b07332ad7
authorFrancesco Ariis <fa-ml@ariis.it>
Fri, 2 Sep 2022 07:54:23 +0000 (2 09:54 +0200)
committerMikolaj <281893+Mikolaj@users.noreply.github.com>
Wed, 10 Jan 2024 21:58:01 +0000 (10 21:58 +0000)
tree7c062aea8359a6b5aa9bdb2a10c0c431df9bbc25
parent71d6669005130ba2de69c5cc630a3a999edc0b53
Add “Ignore warning” option to cabal check

* Introduce `-i/--ignore` command-line option.
    e.g.  cabal check --ignore=missing-upper-bounds  will not display
    “Missing upper bounds” warnings.

* Additionally, a filterPackageChecksById function is now exported
  in Distribution.PackageDescription.Check.Warning; this can be
  used by third party tools.

* Add CheckExplanationIDString to `cabal check` messages.
    e.g. from
      Error: The 'license' field is missing or is NONE.
    to
      Error: [license-none] The 'license' field is missing or is NONE.

    This makes using the cabal check `--ignore` option more immediate.

* Spool `MissingField` into separate constructors.
  Introducing five new constructors for `CheckExplanation`
    MissingFieldCategory
    MissingFieldMaintainer
    MissingFieldSynopsis
    MissingFieldDescription
    MissingFieldSynOrDesc
  This provides better ergonomic for `cabal check --ignore` and makes
  it easier to update the manual if the need arises.

* Add tests for desiderable `--ignore` string qualities (not too long,
  without too many '-', unique).

* Warn when `--ignore` string is not recognised.
    Also add a test for this.

* Add documentation.

* Add changelog.
176 files changed:
Cabal-tests/Cabal-tests.cabal
Cabal-tests/tests/ParserTests/regressions/all-upper-bound.check
Cabal-tests/tests/ParserTests/regressions/assoc-cpp-options.check
Cabal-tests/tests/ParserTests/regressions/bad-glob-syntax.check
Cabal-tests/tests/ParserTests/regressions/cc-options-with-optimization.check
Cabal-tests/tests/ParserTests/regressions/cxx-options-with-optimization.check
Cabal-tests/tests/ParserTests/regressions/decreasing-indentation.check
Cabal-tests/tests/ParserTests/regressions/denormalised-paths.check
Cabal-tests/tests/ParserTests/regressions/extensions-paths-5054.check
Cabal-tests/tests/ParserTests/regressions/ghc-option-j.check
Cabal-tests/tests/ParserTests/regressions/issue-6288-d.check
Cabal-tests/tests/ParserTests/regressions/issue-774.check
Cabal-tests/tests/ParserTests/regressions/issue-7776-a.check
Cabal-tests/tests/ParserTests/regressions/issue-7776-b.check
Cabal-tests/tests/ParserTests/regressions/issue-7776-c.check
Cabal-tests/tests/ParserTests/regressions/multiple-libs-2.check
Cabal-tests/tests/ParserTests/regressions/nothing-unicode.check
Cabal-tests/tests/ParserTests/regressions/pre-1.6-glob.check
Cabal-tests/tests/ParserTests/regressions/pre-2.4-globstar.check
Cabal-tests/tests/ParserTests/regressions/pre-3.8-globstar-literal.check
Cabal-tests/tests/ParserTests/regressions/public-multilib-1.check
Cabal-tests/tests/ParserTests/regressions/public-multilib-2.check
Cabal-tests/tests/UnitTests.hs
Cabal-tests/tests/UnitTests/Distribution/PackageDescription/Check.hs [new file with mode: 0644]
Cabal/src/Distribution/PackageDescription/Check.hs
Cabal/src/Distribution/PackageDescription/Check/Monad.hs
Cabal/src/Distribution/PackageDescription/Check/Warning.hs
cabal-install/src/Distribution/Client/Check.hs
cabal-install/src/Distribution/Client/Main.hs
cabal-install/src/Distribution/Client/Setup.hs
cabal-testsuite/PackageTests/AutogenModules/Package/setup.cabal.out
cabal-testsuite/PackageTests/AutogenModules/Package/setup.out
cabal-testsuite/PackageTests/Backpack/Reexport2/setup.cabal.out
cabal-testsuite/PackageTests/Backpack/Reexport2/setup.out
cabal-testsuite/PackageTests/BuildAutogenPackageGuard/cabal.out
cabal-testsuite/PackageTests/BuildToolDependsInternalMissing/setup.cabal.out
cabal-testsuite/PackageTests/BuildToolDependsInternalMissing/setup.out
cabal-testsuite/PackageTests/CCompilerOverride/setup.cabal.out
cabal-testsuite/PackageTests/CCompilerOverride/setup.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/COptions/CCOptionsExtraLibDirs/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/COptions/CCOptionsInclude/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/COptions/CppNotPortable/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/COptions/CxxOptionsExtraLibraries/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/COptions/CxxOs/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/CabalVersion/AutoGenMods/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/CabalVersion/CustomSetup/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/CabalVersion/DefaultExtension/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/CabalVersion/DefaultLanguage/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/CabalVersion/DefaultLanguageSpec/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/CabalVersion/ExtensionBreak/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/CabalVersion/Extensions/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/CabalVersion/ExtraDoc/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/CabalVersion/ExtraDynamicLibraryFlavour/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/CabalVersion/ExtraFrameworkDirs/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/CabalVersion/Mixins/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/CabalVersion/MultiLibs/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/CabalVersion/Reexported/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/CabalVersion/SourceRepository/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/CabalVersion/Sources/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/CabalVersion/Testsuite1.8/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/CabalVersion/VirtualModules/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Fields/DeprecatedExtension/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Fields/ImpossibleVersionRangeLib/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Fields/InvalidTestedWithRange/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Fields/LanguageAsExtension/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Fields/NoBuildTypeSpecified/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Fields/NoCategory/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Fields/NoCustom/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Fields/NoDescription/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Fields/NoMaintainer/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Fields/NoSynopsis/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Fields/NoZPrefix/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Fields/ShortDescription/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Fields/UnknownCompiler/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Fields/UnknownExtension/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Fields/UnknownLanguage/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/GHCOptions/GHCOptions/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/GHCOptions/GHCProfOptions/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/GHCOptions/GHCSharedOptions/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/GHCOptions/NoWarnFlagManual/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/GHCOptions/NoWarnFlagOut/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/License/Compatibility/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/License/NoFileSpecified/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/License/NoLicense/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/License/NoneLicense/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/License/SuspiciousLicense/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/License/SuspiciousVersion/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/License/UnknownLicence/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/License/WarnAllRightsReserved/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Paths/AbsolutePath/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Paths/DistPoint/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Paths/InvalidWin/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Paths/RecursiveGlobInRoot/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Paths/RelativeOutside/RelativeOutsideInner/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Sanity/AutogenExposedOther/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Sanity/AutogenExposedOtherBenchmark/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Sanity/AutogenExposedOtherExe/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Sanity/AutogenExposedOtherTestsuite/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Sanity/AutogenIncludes/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Sanity/AutogenIncludesBenchmark/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Sanity/AutogenIncludesExe/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Sanity/AutogenIncludesTestsuite/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Sanity/AutogenVersion/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Sanity/CMainIsVersion/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Sanity/CMainIsVersionTestsuite/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Sanity/MalformedMainIs/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Sanity/MalformedMainIsBenchmark/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Sanity/MalformedMainIsTestsuite/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Sanity/NoBody/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Sanity/NoDupNames/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Sanity/NoExposedModules/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Sanity/NoInternalNameClash/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Sanity/NoMainIs/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Sanity/VersionSignatures/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/SourceRepos/NoGoodRelative/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/SourceRepos/NoLocation/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/SourceRepos/NoModuleCVS/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/SourceRepos/NoType/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/SourceRepos/NonRecognisedRepo/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/SourceRepos/SubdirRelative/cabal.out
cabal-testsuite/PackageTests/Check/ConfiguredPackage/SourceRepos/ThisTag/cabal.out
cabal-testsuite/PackageTests/Check/DifferentGhcOptions/cabal.out
cabal-testsuite/PackageTests/Check/IgnoreWarning/Missing/cabal.out [new file with mode: 0644]
cabal-testsuite/PackageTests/Check/IgnoreWarning/Missing/cabal.test.hs [new file with mode: 0644]
cabal-testsuite/PackageTests/Check/IgnoreWarning/Missing/pkg.cabal [new file with mode: 0644]
cabal-testsuite/PackageTests/Check/IgnoreWarning/Ok/cabal.out [new file with mode: 0644]
cabal-testsuite/PackageTests/Check/IgnoreWarning/Ok/cabal.test.hs [new file with mode: 0644]
cabal-testsuite/PackageTests/Check/IgnoreWarning/Ok/pkg.cabal [new file with mode: 0644]
cabal-testsuite/PackageTests/Check/InvalidGlob/cabal.out
cabal-testsuite/PackageTests/Check/MissingGlobDirectory/cabal.out
cabal-testsuite/PackageTests/Check/MissingGlobDirectory2/cabal.out
cabal-testsuite/PackageTests/Check/MultiDotGlob2.2/check.out
cabal-testsuite/PackageTests/Check/NoGlobMatches/cabal.out
cabal-testsuite/PackageTests/Check/NonConfCheck/Conditionals/UnknownArch/cabal.out
cabal-testsuite/PackageTests/Check/NonConfCheck/Conditionals/UnknownCompiler/cabal.out
cabal-testsuite/PackageTests/Check/NonConfCheck/Conditionals/UnknownOS/cabal.out
cabal-testsuite/PackageTests/Check/NonConfCheck/DevOnlyFlags/DebugFlag/cabal.out
cabal-testsuite/PackageTests/Check/NonConfCheck/DevOnlyFlags/ElseCheck/cabal.out
cabal-testsuite/PackageTests/Check/NonConfCheck/DevOnlyFlags/FDeferTypeErrors/cabal.out
cabal-testsuite/PackageTests/Check/NonConfCheck/DevOnlyFlags/Jn/cabal.out
cabal-testsuite/PackageTests/Check/NonConfCheck/DevOnlyFlags/Profiling/cabal.out
cabal-testsuite/PackageTests/Check/NonConfCheck/DevOnlyFlags/WError/cabal.out
cabal-testsuite/PackageTests/Check/NonConfCheck/DuplicatedModules/cabal.out
cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersions/cabal.out
cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersionsInternalSimple/cabal.out
cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersionsLibInt/cabal.out
cabal-testsuite/PackageTests/Check/NonConfCheck/PathsExtensions/cabal.out
cabal-testsuite/PackageTests/Check/NonConfCheck/SetupBounds/cabal.out
cabal-testsuite/PackageTests/Check/NonConfCheck/UnusedFlags/cabal.out
cabal-testsuite/PackageTests/Check/PackageFiles/BOM/cabal.out
cabal-testsuite/PackageTests/Check/PackageFiles/ExtensionMatch/cabal.out
cabal-testsuite/PackageTests/Check/PackageFiles/FileName/cabal.out
cabal-testsuite/PackageTests/Check/PackageFiles/LocalPaths/cabal.out
cabal-testsuite/PackageTests/Check/PackageFiles/MissingExpectedDocFiles/ChangeLog/NotIncluded/V1.12/cabal.out
cabal-testsuite/PackageTests/Check/PackageFiles/MissingExpectedDocFiles/ChangeLog/NotIncluded/V3.0/cabal.out
cabal-testsuite/PackageTests/Check/PackageFiles/MissingExpectedDocFiles/ChangeLog/WrongField/V1.12/cabal.out
cabal-testsuite/PackageTests/Check/PackageFiles/MissingExpectedDocFiles/ChangeLog/WrongField/V3.0/cabal.out
cabal-testsuite/PackageTests/Check/PackageFiles/NoConfigureFile/cabal.out
cabal-testsuite/PackageTests/Check/PackageFiles/NoLicenseFile/cabal.out
cabal-testsuite/PackageTests/Check/PackageFiles/NoSetupFile/cabal.out
cabal-testsuite/PackageTests/Check/PackageFiles/PathTooLong/cabal.out
cabal-testsuite/PackageTests/Check/PackageFiles/VCSInfo/cabal.out
cabal-testsuite/PackageTests/CustomPlain/setup.out
cabal-testsuite/PackageTests/InternalVersions/BuildDependsBad/setup.cabal.out
cabal-testsuite/PackageTests/InternalVersions/BuildDependsBad/setup.out
cabal-testsuite/PackageTests/InternalVersions/BuildToolDependsBad/setup.cabal.out
cabal-testsuite/PackageTests/InternalVersions/BuildToolDependsBad/setup.out
cabal-testsuite/PackageTests/InternalVersions/BuildToolsBad/setup.cabal.out
cabal-testsuite/PackageTests/InternalVersions/BuildToolsBad/setup.out
cabal-testsuite/PackageTests/Project/CoverageProject/cabal.out
cabal-testsuite/PackageTests/Regression/T3847/setup.cabal.out
cabal-testsuite/PackageTests/Regression/T3847/setup.out
cabal-testsuite/PackageTests/Regression/T6440/cabal.out
cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single.out
changelog.d/pr-check-ignore [new file with mode: 0644]
doc/cabal-commands.rst