Skip to content

cabal init does not respect --no-comments for empty (commented out) fields #7769

@fgaz

Description

@fgaz

Describe the bug

When using cabal init --no-comments, empty (commented out) fields still have a comment before them

To Reproduce

In an empty directory:

$ cabal init --non-interactive --no-comments

Using --interactive and answering "no" to the last question has the same effect.

Here's the resulting cabal file

cabal-version:      3.0
name:               tmp-UGqoRCTx7k
version:            0.1.0.0

-- A short (one-line) description of the package.
-- synopsis:

-- A longer description of the package.
-- description:
license:            NONE
author:             [email protected]
maintainer:         Example Example

-- A copyright notice.
-- copyright:
build-type:         Simple
extra-doc-files:    CHANGELOG.md

-- Extra source files to be distributed with the package, such as examples, or a tutorial module.
-- extra-source-files:

common warnings
    ghc-options: -Wall


executable tmp-UGqoRCTx7k
    import:           warnings
    main-is:          Main.hs

    -- Modules included in this executable, other than Main.
    -- other-modules:

    -- LANGUAGE extensions used by modules in this package.
    -- other-extensions:
    build-depends:    base ^>=4.14.1.0
    hs-source-dirs:   app
    default-language: Haskell2010

Expected behavior

No extra comment on any field

System information

cabal 3.7 / current master

/cc @emilypi @ptkato

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions