Skip to content

Commit 10993b2

Browse files
committed
Add “Ignore warning” option to cabal check
* Command line option: -i/--ignore. 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.
1 parent f31f2cd commit 10993b2

File tree

172 files changed

+1024
-427
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+1024
-427
lines changed

Cabal-tests/Cabal-tests.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ test-suite unit-tests
3535
UnitTests.Distribution.Compat.Graph
3636
UnitTests.Distribution.Compat.Time
3737
UnitTests.Distribution.Described
38+
UnitTests.Distribution.PackageDescription.Check
3839
UnitTests.Distribution.PkgconfigVersion
3940
UnitTests.Distribution.Simple.Command
4041
UnitTests.Distribution.Simple.Glob

Cabal-tests/tests/ParserTests/regressions/all-upper-bound.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
On library, these packages miss upper bounds:
1+
[missing-upper-bounds] On library, these packages miss upper bounds:
22
- somelib
33
- alphalib
44
- betalib
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
'cpp-options: -traditional' is not a portable C-preprocessor flag.
1+
[cpp-options] 'cpp-options: -traditional' is not a portable C-preprocessor flag.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
In the 'extra-source-files' field: invalid file glob 'foo/*/bar'. A wildcard '**' is only allowed as the final parent directory. Stars must not otherwise appear in the parent directories.
2-
In the 'extra-source-files' field: invalid file glob 'foo/blah-*.hs'. Wildcards '*' may only totally replace the file's base name, not only parts of it.
1+
[glob-syntax-error] In the 'extra-source-files' field: invalid file glob 'foo/*/bar'. A wildcard '**' is only allowed as the final parent directory. Stars must not otherwise appear in the parent directories.
2+
[glob-syntax-error] In the 'extra-source-files' field: invalid file glob 'foo/blah-*.hs'. Wildcards '*' may only totally replace the file's base name, not only parts of it.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
'cc-options: -O[n]' is generally not needed. When building with optimisations Cabal automatically adds '-O2' for C code. Setting it yourself interferes with the --disable-optimization flag.
1+
[option-opt-c] 'cc-options: -O[n]' is generally not needed. When building with optimisations Cabal automatically adds '-O2' for C code. Setting it yourself interferes with the --disable-optimization flag.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
'cxx-options: -O[n]' is generally not needed. When building with optimisations Cabal automatically adds '-O2' for C++ code. Setting it yourself interferes with the --disable-optimization flag.
1+
[option-opt-c] 'cxx-options: -O[n]' is generally not needed. When building with optimisations Cabal automatically adds '-O2' for C++ code. Setting it yourself interferes with the --disable-optimization flag.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
decreasing-indentation.cabal:38:3: Inconsistent indentation. Indentation jumps at lines 38, 49, 56, 57, 69
2-
No 'main-is' field found for executable warnings
2+
[no-main-is] No 'main-is' field found for executable warnings
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
'hs-source-dirs: ../../assoc/src' is a relative path outside of the source tree. This will not work when generating a tarball with 'sdist'.
2-
The 'subdir' field of a source-repository is not a good relative path: "trailing same directory segment: ."
3-
'extra-source-files: files/**/*.txt/' is not a good relative path: "trailing slash"
4-
'extra-source-files: files/../foo.txt' is not a good relative path: "parent directory segment: .."
5-
'hs-source-dirs: ../../assoc/src' is not a good relative path: "parent directory segment: .."
6-
'hs-source-dirs: src/.' is not a good relative path: "trailing same directory segment: ."
7-
'hs-source-dirs: src/../../assoc/src' is not a good relative path: "parent directory segment: .."
8-
'hs-source-dirs: src/../src' is not a good relative path: "parent directory segment: .."
9-
'license-file: .' is not a good relative path: "trailing dot segment"
10-
'license-file: LICENSE2/' is not a good relative path: "trailing slash"
11-
The path 'C:foo/bar' is invalid on Windows, which would cause portability problems for this package. Windows file names cannot contain any of the characters ":*?<>|" and there a few reserved names including "aux", "nul", "con", "prn", "com1-9", "lpt1-9" and "clock$".
12-
The path 'c/**/*.c' is invalid on Windows, which would cause portability problems for this package. Windows file names cannot contain any of the characters ":*?<>|" and there a few reserved names including "aux", "nul", "con", "prn", "com1-9", "lpt1-9" and "clock$".
13-
The path 'files/<>/*.txt' is invalid on Windows, which would cause portability problems for this package. Windows file names cannot contain any of the characters ":*?<>|" and there a few reserved names including "aux", "nul", "con", "prn", "com1-9", "lpt1-9" and "clock$".
14-
The path '||s' is invalid on Windows, which would cause portability problems for this package. Windows file names cannot contain any of the characters ":*?<>|" and there a few reserved names including "aux", "nul", "con", "prn", "com1-9", "lpt1-9" and "clock$".
1+
[relative-path-outside] 'hs-source-dirs: ../../assoc/src' is a relative path outside of the source tree. This will not work when generating a tarball with 'sdist'.
2+
[repo-malformed-subdir] The 'subdir' field of a source-repository is not a good relative path: "trailing same directory segment: ."
3+
[malformed-relative-path] 'extra-source-files: files/**/*.txt/' is not a good relative path: "trailing slash"
4+
[malformed-relative-path] 'extra-source-files: files/../foo.txt' is not a good relative path: "parent directory segment: .."
5+
[malformed-relative-path] 'hs-source-dirs: ../../assoc/src' is not a good relative path: "parent directory segment: .."
6+
[malformed-relative-path] 'hs-source-dirs: src/.' is not a good relative path: "trailing same directory segment: ."
7+
[malformed-relative-path] 'hs-source-dirs: src/../../assoc/src' is not a good relative path: "parent directory segment: .."
8+
[malformed-relative-path] 'hs-source-dirs: src/../src' is not a good relative path: "parent directory segment: .."
9+
[malformed-relative-path] 'license-file: .' is not a good relative path: "trailing dot segment"
10+
[malformed-relative-path] 'license-file: LICENSE2/' is not a good relative path: "trailing slash"
11+
[invalid-path-win] The path 'C:foo/bar' is invalid on Windows, which would cause portability problems for this package. Windows file names cannot contain any of the characters ":*?<>|" and there a few reserved names including "aux", "nul", "con", "prn", "com1-9", "lpt1-9" and "clock$".
12+
[invalid-path-win] The path 'c/**/*.c' is invalid on Windows, which would cause portability problems for this package. Windows file names cannot contain any of the characters ":*?<>|" and there a few reserved names including "aux", "nul", "con", "prn", "com1-9", "lpt1-9" and "clock$".
13+
[invalid-path-win] The path 'files/<>/*.txt' is invalid on Windows, which would cause portability problems for this package. Windows file names cannot contain any of the characters ":*?<>|" and there a few reserved names including "aux", "nul", "con", "prn", "com1-9", "lpt1-9" and "clock$".
14+
[invalid-path-win] The path '||s' is invalid on Windows, which would cause portability problems for this package. Windows file names cannot contain any of the characters ":*?<>|" and there a few reserved names including "aux", "nul", "con", "prn", "com1-9", "lpt1-9" and "clock$".
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Packages using RebindableSyntax with OverloadedStrings or OverloadedLists in default-extensions, in conjunction with the autogenerated module Paths_*, are known to cause compile failures with Cabal < 2.2. To use these default-extensions with a Paths_* autogen module, specify at least 'cabal-version: 2.2'.
1+
[rebindable-clash-paths] Packages using RebindableSyntax with OverloadedStrings or OverloadedLists in default-extensions, in conjunction with the autogenerated module Paths_*, are known to cause compile failures with Cabal < 2.2. To use these default-extensions with a Paths_* autogen module, specify at least 'cabal-version: 2.2'.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
'ghc-options: -j[N]' can make sense for a particular user's setup, but it is not appropriate for a distributed package. Alternatively, if you want to use this, make it conditional based on a Cabal configuration flag (with 'manual: True' and 'default: False') and enable that flag during development.
2-
'ghc-shared-options: -j[N]' can make sense for a particular user's setup, but it is not appropriate for a distributed package. Alternatively, if you want to use this, make it conditional based on a Cabal configuration flag (with 'manual: True' and 'default: False') and enable that flag during development.
1+
[unneeded-j] 'ghc-options: -j[N]' can make sense for a particular user's setup, but it is not appropriate for a distributed package. Alternatively, if you want to use this, make it conditional based on a Cabal configuration flag (with 'manual: True' and 'default: False') and enable that flag during development.
2+
[unneeded-j] 'ghc-shared-options: -j[N]' can make sense for a particular user's setup, but it is not appropriate for a distributed package. Alternatively, if you want to use this, make it conditional based on a Cabal configuration flag (with 'manual: True' and 'default: False') and enable that flag during development.

0 commit comments

Comments
 (0)