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

Add .cabal and cabal.project as recognised file types for comments #1089

Merged
merged 1 commit into from
Oct 16, 2024

Conversation

ozkutuk
Copy link
Contributor

@ozkutuk ozkutuk commented Oct 14, 2024

This PR adds .cabal and cabal.project as recognized file types for comments. These files are used by the Cabal build tool.

  • Added a change log entry in changelog.d/<directory>/.
  • My changes do not contradict
    the current specification.
  • I agree to license my contribution under the licenses indicated in the
    changed files.

@ozkutuk ozkutuk changed the title Add .cabal as a recognised file type for comments Add .cabal and cabal.project as recognised file types for comments Oct 14, 2024
@ozkutuk
Copy link
Contributor Author

ozkutuk commented Oct 14, 2024

Hmm, I have now realized that the modified .cabal files are not accepted by Cabal anymore, because Cabal mandates that the cabal-version field is the first thing that appears in the file, apparently including comments:

Errors encountered when parsing cabal file ./test.cabal:

test.cabal:6:1: error:
cabal-version should be at the beginning of the file starting with spec version 2.2.
Current cabal-version values are listed at https://cabal.readthedocs.io/en/stable/file-format-changelog.html.

    6 | cabal-version:      3.0
      | ^

There is nothing wrong with this PR per se, but this will probably not be of much use unless this is somehow resolved on the Cabal side.

Copy link
Member

@carmenbianca carmenbianca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you @ozkutuk

@carmenbianca carmenbianca merged commit 2b26734 into fsfe:main Oct 16, 2024
15 checks passed
@carmenbianca
Copy link
Member

Oops, I hadn't read your second comment! That is indeed a bit of a thing. You could solve that by adding cabal-version: as a shebang to the HaskellCommentStyle class. It's not 100% perfect, but should work.

@ozkutuk ozkutuk mentioned this pull request Oct 16, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants