Skip to content
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

Reimplement cabal check #8427

Merged
merged 19 commits into from
Nov 13, 2023
Merged

Reimplement cabal check #8427

merged 19 commits into from
Nov 13, 2023

Commits on Nov 11, 2023

  1. Fix Semigroup target instance

    When two target names are the same, `mappend`ing them should not
    error but just pick the first name.
    ffaf1 committed Nov 11, 2023
    Configuration menu
    Copy the full SHA
    1d2765a View commit details
    Browse the repository at this point in the history
  2. Add desugarBuildToolSimple

    ffaf1 committed Nov 11, 2023
    Configuration menu
    Copy the full SHA
    152bed8 View commit details
    Browse the repository at this point in the history
  3. Reimplement cabal check

    ffaf1 committed Nov 11, 2023
    Configuration menu
    Copy the full SHA
    eef2be1 View commit details
    Browse the repository at this point in the history
  4. Reorder test output

    ffaf1 committed Nov 11, 2023
    Configuration menu
    Copy the full SHA
    b24c601 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    1a2f184 View commit details
    Browse the repository at this point in the history
  6. Add a number of tests

    * Add test for haskell#7423
    
    i.e. Do not warn on -O2 if under off-by-default package configuration
    flag conditional.
    
    * Add a regression for:
    
        * Add another -WErrr test
            This is to make sure we do *not* report it if it is under
            a user, off-by-default flag.
        * Add test for non manual user flags.
        * Add “absolute path in extra-lib-dirs” test
        * Add if/else test
        * Add “dircheck on abspath” check
        * Add Package version internal test
        * Add PackageVersionsStraddle test
    ffaf1 committed Nov 11, 2023
    Configuration menu
    Copy the full SHA
    083a642 View commit details
    Browse the repository at this point in the history
  7. Add changelog for haskell#8427

    ffaf1 committed Nov 11, 2023
    Configuration menu
    Copy the full SHA
    7566f7d View commit details
    Browse the repository at this point in the history
  8. Integrate various reviews

    * Integrate Artem’s review
    
    (review) Clarify `combineNames` documentation
    
    By explaining the way it operates (working if the two names are equal
    or one is empty) and renaming the function from `combineName` to
    `combineNames`.
    
    (review) Use guards instead of if/then/else
    
    (review) Match inside argument list
    
    (review) Replace “white” with “allow”
    
    (review) Fix typo in comment
    
    (review) Fix typo in Check module documentation
    
    (review) Harmonise indentation for `data` decls
    
    First field goes in a new line than the data constructor, so we
    have more space.
    
    (review) Rename `Prim` module to `Types`
    
    (review) Add checkPackageFilesGPD
    
    `checkPackageFiles` — which works on PD — was used to perform IO. We
    introduce a function that does the same thing but works on GPD (which
    is more principled).
    
    `checkPackageFiles` cannot just be removed, since it is part of the
    interface of Distribution.PackageDescription.Check. Deprecation can
    be planned once “new check” is up and running.
    
    * Integrate Andreas’ review
    
    (review) Add named section to missing upper bound check
    
    “miss upper bound” checks will now list target type and name (“On
    executable 'myexe', these packages miss upper bounds”) for easier
    fixing by the user.
    
    (review) remove `cabal gen-bounds` suggestion
    
    Reasonable as `cabal gen-bounds` is stricter than `cabal check`, see
    haskell#8427 (comment)
    Once `gen-bounds` behaves in line with `check` we can readd the
    suggestion.
    
    (review) Do not warn on shared bounds
    
    When a target which depends on an internal library shares some
    dependencies with the latter, do not warn on upper bounds.
    
    An example is clearer
    
        library
         build-depends: text < 5
        ⁝
         build-depends: myPackage,        ← no warning, internal
                        text,             ← no warning, shared bound
                        monadacme         ← warning!
    
    * Integrate Artem’s review /II
    
    (review) Split Check.hs
    
    Check.hs has been split in multiple file, each une sub 1000 lines:
    
    Check              857 lines
    Check.Common       147 lines
    Check.Conditional  204 lines
    Check.Monad        352 lines
    Check.Paths        387 lines
    Check.Target       765 lines
    Check.Warning      865 lines
    
    Migration guide:
    - Check              GPD/PD checks plus work-tree checks.
    - Check.Common       common types and functions that are
                         *not* part of monadic checking setup.
    - Check.Conditional  checks on CondTree and related matter
                         (variables, duplicate modules).
    - Check.Monad        Backbone of the checks, monadic inter-
                         face and related functions.
    - Check.Paths        Checks on files, directories, globs.
    - Check.Target       Checks on realised targets (libraries,
                         executables, benchmarks, testsuites).
    - Check.Warning      Datatypes and strings for warnings
                         and severities.
    
    (review) remove useless section header
    
    (review) Fix typo
    
    (review) Add warnings documentation (list)
    
    For each warning, we document constructor/brief description
    in the manual.  This might not be much useful as not but it
    will come handy when introducing `--ignore=WARN` and similar
    flags.
    
    * (review Andreas) Clarify CheckExplanation comment
    
    Whoever modifies `CheckExplanation` data constructors needs to be
    aware that the documentation in  doc/cabal-commands.rst  has to be
    updated too.
    ffaf1 committed Nov 11, 2023
    Configuration menu
    Copy the full SHA
    09a4d82 View commit details
    Browse the repository at this point in the history
  9. Move internal Check modules to other-modules

    No need to expose Distribution.PackageDescription.Check.*
    to the world. API for checking, for cabal-install and other
    tools, should be in Distribution.PackageDescription.Check.
    ffaf1 committed Nov 11, 2023
    Configuration menu
    Copy the full SHA
    a0ac130 View commit details
    Browse the repository at this point in the history
  10. Make fourmolu happy

    Cabal codebase has now a formatter/style standard (see haskell#8950).
    
    “Ravioli ravioli, give me the formuoli”
    ffaf1 committed Nov 11, 2023
    Configuration menu
    Copy the full SHA
    bd5bbad View commit details
    Browse the repository at this point in the history
  11. Do not check for OptO in scripts

    See haskell#8963 for reason and clarification requests.
    ffaf1 committed Nov 11, 2023
    Configuration menu
    Copy the full SHA
    148d8dd View commit details
    Browse the repository at this point in the history
  12. Remove useless PackageId parameter

    It is now in the Reader part of CheckM monad.
    ffaf1 committed Nov 11, 2023
    Configuration menu
    Copy the full SHA
    87ca482 View commit details
    Browse the repository at this point in the history
  13. Do not check PVP on internal targets

    Internal: testsuite, benchmark.
    See haskell#8361.
    ffaf1 committed Nov 11, 2023
    Configuration menu
    Copy the full SHA
    3237766 View commit details
    Browse the repository at this point in the history
  14. Make hlint happy

    ffaf1 committed Nov 11, 2023
    Configuration menu
    Copy the full SHA
    822ada5 View commit details
    Browse the repository at this point in the history
  15. Fix haskell#9122

    When checking internal version ranges, we need to make sure we
    are not mistaking a libraries with the same name but from different
    packages. See haskell#9132.
    ffaf1 committed Nov 11, 2023
    Configuration menu
    Copy the full SHA
    e0cbccc View commit details
    Browse the repository at this point in the history
  16. Fix grammar

    neither…nor, completing what done in haskell#9162
    ffaf1 committed Nov 11, 2023
    Configuration menu
    Copy the full SHA
    d52f1e9 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    a051dd6 View commit details
    Browse the repository at this point in the history
  18. Remove unnecessary -fvia-C check

    Brandon’s review/II.
    ffaf1 committed Nov 11, 2023
    Configuration menu
    Copy the full SHA
    d4e43fc View commit details
    Browse the repository at this point in the history

Commits on Nov 13, 2023

  1. Configuration menu
    Copy the full SHA
    e6917e1 View commit details
    Browse the repository at this point in the history