Skip to content

Run fourmolu against plutus-tx-plugin files #7105

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SeungheonOh
Copy link
Collaborator

Formatted plutus-tx-plugin files with fourmolu and stylish haskell(through pre-commit hook)

@SeungheonOh SeungheonOh requested a review from Unisay May 19, 2025 12:22
@SeungheonOh SeungheonOh added the No Changelog Required Add this to skip the Changelog Check label May 19, 2025
]
, goldenPirReadable "coverageCode" boolOtherFunction ]
coverage =
testNested "Coverage" . pure $
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These test are failing:

    Coverage
      9.6
        Application heads and line coverage
          noBool
            correct application heads:             OK
            correct line coverage:                 FAIL
              test/Plugin/Coverage/Spec.hs:84:
              Lines [31] are not covered by [(30,30)]
              Use -p '/noBool.correct line coverage/' to rerun this test only.
          boolTrueFalse
            correct application heads:             OK
            correct line coverage:                 FAIL
              test/Plugin/Coverage/Spec.hs:84:
              Lines [34] are not covered by [(33,33),(33,33),(33,33),(33,33)]
              Use -p '/boolTrueFalse.correct line coverage/' to rerun this test only.
          boolOtherFunction
            correct application heads:             OK
            correct line coverage:                 FAIL
              test/Plugin/Coverage/Spec.hs:84:
              Lines [37,40,41,42] are not covered by [(36,36),(39,39),(39,41),(39,41),(40,40),(40,40),(40,40),(40,40),(41,41),(45,45),(45,45),(45,45),(45,45),(45,45),(45,45)]
              Use -p '/boolOtherFunction.correct line coverage/' to rerun this test only.
          boolQualifiedDisappears
            correct application heads:             OK
            correct line coverage:                 FAIL
              test/Plugin/Coverage/Spec.hs:84:
              Lines [49] are not covered by [(48,48),(48,48)]
              Use -p '/boolQualifiedDisappears.correct line coverage/' to rerun this test only.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Line numbers here are changed as fourmolu shifted the lines

@SeungheonOh SeungheonOh force-pushed the seungheonoh/format-plutus-tx-plugin branch from b040c32 to 1dd31b6 Compare May 19, 2025 13:36
Comment on lines 284 to 290
{- Note [Non-regular data types in tests]
A non-regular data type, a.k.a. a nested data type is, quoting "Nested Datatypes" by Richard Bird
and Lambert Meertens, a parametrised data type whose declaration involves different instances of the
accompanying type parameters. Such data types cannot be encoded with regular @fix :: (* -> *) -> *@
and require our fancy @ifix@ business, hence they make for good tests, which is how we have so many
of them.
-}
Copy link
Contributor

Choose a reason for hiding this comment

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

This one too, we need to fix it.

Copy link
Contributor

@Unisay Unisay left a comment

Choose a reason for hiding this comment

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

99% good, but some comments got detached from their bindings and floated to the top of a module in one file.

@SeungheonOh SeungheonOh force-pushed the seungheonoh/format-plutus-tx-plugin branch from 1dd31b6 to 05dbce5 Compare May 20, 2025 01:56
@SeungheonOh
Copy link
Collaborator Author

Turns out there is a bug in ourmolu/fourmolu that makes all comments get pushed to the very top if there's a OPTIONS_GHC pragma in the middle of the code. Found a workaround: one can wrap the pragma to disable fourmolu like following:

{- FOURMOLU_DISABLE -}
{-# OPTIONS_GHC -Wno-incomplete-patterns #-}
{- FOURMOLU_ENABLE -}

@SeungheonOh SeungheonOh force-pushed the seungheonoh/format-plutus-tx-plugin branch from 05dbce5 to 86e949f Compare May 20, 2025 08:22
@Unisay
Copy link
Contributor

Unisay commented May 21, 2025

Turns out there is a bug in ourmolu/fourmolu that makes all comments get pushed to the very top if there's a OPTIONS_GHC pragma in the middle of the code. Found a workaround: one can wrap the pragma to disable fourmolu like following:

{- FOURMOLU_DISABLE -}
{-# OPTIONS_GHC -Wno-incomplete-patterns #-}
{- FOURMOLU_ENABLE -}

Do you mind linking a bug in the fourmolu repository in the comment in our code so that we can remove the workaround once its fixed?

@SeungheonOh SeungheonOh force-pushed the seungheonoh/format-plutus-tx-plugin branch from 86e949f to 2a7d9ff Compare May 21, 2025 11:36
@SeungheonOh SeungheonOh force-pushed the seungheonoh/format-plutus-tx-plugin branch from 2a7d9ff to 7bad870 Compare May 21, 2025 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
No Changelog Required Add this to skip the Changelog Check
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants