Skip to content

Commit

Permalink
Reimplement cabal check
Browse files Browse the repository at this point in the history
Pure checks
  • Loading branch information
ffaf1 committed Aug 30, 2022
1 parent 9de8967 commit c92f202
Show file tree
Hide file tree
Showing 12 changed files with 1,237 additions and 1,415 deletions.
2 changes: 1 addition & 1 deletion Cabal-tests/tests/CheckTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ checkTest fp = cabalGoldenTest fp correct $ do
-- Note: parser warnings are reported by `cabal check`, but not by
-- D.PD.Check functionality.
unlines (map (showPWarning fp) ws) ++
unlines (map show (checkPackage gpd Nothing))
unlines (map show (checkPackage gpd))
Left (_, errs) -> unlines $ map (("ERROR: " ++) . showPError fp) $ NE.toList errs
where
input = "tests" </> "ParserTests" </> "regressions" </> fp
Expand Down
2 changes: 1 addition & 1 deletion Cabal-tests/tests/HackageTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ parseCheckTest fpath bs = do
Parsec.parseGenericPackageDescription bs
case parsec of
Right gpd -> do
let checks = checkPackage gpd Nothing
let checks = checkPackage gpd
let w [] = 0
w _ = 1

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,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.
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.
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.
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
The 'subdir' field of a source-repository is not a good relative path: "trailing same directory segment: ."
The paths 'files/<>/*.txt', 'c/**/*.c', 'C:foo/bar', '||s' are 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$".
'hs-source-dirs: ../../assoc/src' is a relative path outside of the source tree. This will not work when generating a tarball with 'sdist'.
The 'subdir' field of a source-repository is not a good relative path: "trailing same directory segment: ."
'extra-source-files: files/**/*.txt/' is not a good relative path: "trailing slash"
'extra-source-files: files/../foo.txt' is not a good relative path: "parent directory segment: .."
'license-file: LICENSE2/' is not a good relative path: "trailing slash"
'license-file: .' is not a good relative path: "trailing dot segment"
'hs-source-dirs: ../../assoc/src' is not a good relative path: "parent directory segment: .."
'hs-source-dirs: src/.' is not a good relative path: "trailing same directory segment: ."
'hs-source-dirs: src/../src' is not a good relative path: "parent directory segment: .."
'hs-source-dirs: src/../../assoc/src' is not a good relative path: "parent directory segment: .."
'hs-source-dirs: ../../assoc/src' is not a good relative path: "parent directory segment: .."
'hs-source-dirs: src/../src' is not a good relative path: "parent directory segment: .."
'license-file: .' is not a good relative path: "trailing dot segment"
'license-file: LICENSE2/' is not a good relative path: "trailing slash"
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$".
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$".
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$".
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$".
6 changes: 3 additions & 3 deletions Cabal-tests/tests/ParserTests/regressions/issue-774.check
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
issue-774.cabal:13:22: Packages with 'cabal-version: 1.12' or later should specify a specific version of the Cabal spec of the form 'cabal-version: x.y'. Use 'cabal-version: 1.12'.
No 'category' field.
No 'maintainer' field.
The 'license' field is missing or is NONE.
'ghc-options: -threaded' has no effect for libraries. It should only be used for executables.
'ghc-options: -rtsopts' has no effect for libraries. It should only be used for executables.
'ghc-options: -with-rtsopts' has no effect for libraries. It should only be used for executables.
No 'category' field.
No 'maintainer' field.
The 'license' field is missing or is NONE.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Potential duplicate modules (subject to conditionals) in benchmark: Data.Hashable.RandomSource
Duplicate modules in library: Data.Hashable.RandomSource
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
In the 'data-files' field: invalid file glob 'foo/**/*.dat'. Using the double-star syntax requires 'cabal-version: 2.4' or greater. Alternatively, for compatibility with earlier Cabal versions, list the included directories explicitly.
In the 'extra-source-files' field: invalid file glob 'foo/**/*.hs'. Using the double-star syntax requires 'cabal-version: 2.4' or greater. Alternatively, for compatibility with earlier Cabal versions, list the included directories explicitly.
In the 'extra-doc-files' field: invalid file glob 'foo/**/*.html'. Using the double-star syntax requires 'cabal-version: 2.4' or greater. Alternatively, for compatibility with earlier Cabal versions, list the included directories explicitly.
In the 'extra-source-files' field: invalid file glob 'foo/**/*.hs'. Using the double-star syntax requires 'cabal-version: 2.4' or greater. Alternatively, for compatibility with earlier Cabal versions, list the included directories explicitly.
Loading

0 comments on commit c92f202

Please sign in to comment.