Skip to content

Commit

Permalink
PLT-42 Added cabal-fmt to pre-commit hooks & reformatted all existing… (
Browse files Browse the repository at this point in the history
#505)

* PLT-42 Added cabal-fmt to pre-commit hooks & reformatted all existing cabal files
* Created fix-cabal-fmt script and added to shell
* Added CI test for cabal-fmt
* Updated CONTRIBUTING.adoc to include addition of cabal-fmt
* Replaced occurences of iohk/plutus with input-output-hk/plutus-apps
  • Loading branch information
zeme-wana authored and koslambrou committed Jun 22, 2022
1 parent dc91fd2 commit caa5014
Show file tree
Hide file tree
Showing 27 changed files with 2,821 additions and 2,562 deletions.
10 changes: 4 additions & 6 deletions CONTRIBUTING.adoc
Expand Up @@ -257,13 +257,11 @@ you could write a Note describing the trick (and justifying its usage!), and the

=== Code formatting

We use `stylish-haskell` for Haskell code formatting, and `purs-tidy` for Purescript.
CI checks that running these is a no-op, so if you don’t apply it them your PR will not go green.
To avoid annoyance, set up your editor to run them automatically.
The `nix-shell` environment provides `stylish-haskell` and `purs-tidy` binaries of the correct versions.
We use `stylish-haskell` for Haskell code formatting, `purs-tidy` for Purescript, and `cabal-fmt` for cabal files.
They are run automatically as pre-commit hooks, but CI will run them again and expect that to be a no-op, so if you somehow don’t apply them your PR will not go green.

You can run `stylish-haskell` or `purs-tidy` over your tree using the
`fix-stylish-haskell` or `fix-purs-tidy` script provided by the `nix-shell` environment.
To run `stylish-haskell`, `purs-tidy` or `cabal-fmt` manually over your tree, type `fix-stylish-haskell`, `fix-purs-tidy` or `fix-cabal-fmt` respectively.
They are provided by the `nix-shell` environment.

=== Compiler warnings

Expand Down
2 changes: 1 addition & 1 deletion default.nix
Expand Up @@ -67,7 +67,7 @@ rec {
tests = import ./nix/tests/default.nix {
inherit pkgs docs;
inherit (plutus-apps.lib) gitignore-nix;
inherit (plutus-apps) fixStylishHaskell fix-purs-tidy fixPngOptimization;
inherit (plutus-apps) fixStylishHaskell fix-purs-tidy fixPngOptimization fixCabalFmt;
inherit plutus-playground web-ghc;
src = ./.;
play-generated = plutus-playground.generated-purescript;
Expand Down
179 changes: 96 additions & 83 deletions doc/plutus-doc.cabal
@@ -1,97 +1,110 @@
cabal-version: 2.2
name: plutus-doc
version: 0.1.0.0
license: Apache-2.0
name: plutus-doc
version: 0.1.0.0
license: Apache-2.0
license-files:
LICENSE
NOTICE
maintainer: jann.mueller@iohk.io
author: Michael Peyton Jones, Jann Mueller
synopsis: Plutus documentation
description: Plutus documentation
category: Language
build-type: Simple

maintainer: jann.mueller@iohk.io
author: Michael Peyton Jones, Jann Mueller
synopsis: Plutus documentation
description: Plutus documentation
category: Language
build-type: Simple

source-repository head
type: git
location: https://github.com/input-output-hk/plutus-apps
type: git
location: https://github.com/input-output-hk/plutus-apps

flag defer-plugin-errors
description:
Defer errors from the plugin, useful for things like Haddock that can't handle it.
default: False
manual: True
description:
Defer errors from the plugin, useful for things like Haddock that can't handle it.

default: False
manual: True

common lang
default-language: Haskell2010
default-extensions: ExplicitForAll ScopedTypeVariables
DeriveGeneric StandaloneDeriving DeriveLift
GeneralizedNewtypeDeriving DeriveFunctor DeriveFoldable
DeriveTraversable MultiParamTypeClasses
ImportQualifiedPost
ghc-options: -Wall -Wnoncanonical-monad-instances
-Wincomplete-uni-patterns -Wincomplete-record-updates
-Wredundant-constraints -Widentities -Wmissing-import-lists
-- See Plutus Tx readme
-fobject-code -fno-ignore-interface-pragmas -fno-omit-interface-pragmas
default-language: Haskell2010
default-extensions:
DeriveFoldable
DeriveFunctor
DeriveGeneric
DeriveLift
DeriveTraversable
ExplicitForAll
GeneralizedNewtypeDeriving
ImportQualifiedPost
MultiParamTypeClasses
ScopedTypeVariables
StandaloneDeriving

-- See Plutus Tx readme for why we need the following flags:
-- -fobject-code -fno-ignore-interface-pragmas and -fno-omit-interface-pragmas
ghc-options:
-Wall -Wnoncanonical-monad-instances -Wincomplete-uni-patterns
-Wincomplete-record-updates -Wredundant-constraints -Widentities
-Wmissing-import-lists -fobject-code -fno-ignore-interface-pragmas
-fno-omit-interface-pragmas

if flag(defer-plugin-errors)
if flag(defer-plugin-errors)

executable doc-doctests
import: lang
if(impl(ghcjs) || os(windows))
buildable: False
hs-source-dirs:
plutus/tutorials
plutus/howtos
plutus/architecture/constraints
main-is: Main.hs
build-tool-depends: doctest:doctest -any
other-modules:
BasicPlutusTx
BasicValidators
BasicPolicies
BasicApps
BasicAppConstraints
GameModel
HandlingBlockchainEvents
HelloWorldApp
WriteScriptsTo
Escrow
Escrow2
Escrow3
Escrow4
Escrow5
Escrow6
EscrowImpl
build-depends:
base >=4.9 && <5,
template-haskell >=2.13.0.0,
bytestring -any,
data-default -any,
flat -any,
plutus-core -any,
plutus-chain-index-core -any,
plutus-tx -any,
plutus-ledger -any,
plutus-ledger-api -any,
plutus-ledger-constraints -any,
plutus-script-utils -any,
plutus-tx-constraints -any,
plutus-contract -any,
playground-common -any,
plutus-use-cases -any,
quickcheck-dynamic -any,
containers -any,
freer-extras -any,
lens -any,
serialise -any,
QuickCheck -any,
random -any,
text -any,
aeson -any,
tasty -any,
tasty-quickcheck -any
import: lang

if (impl(ghcjs) || os(windows))
buildable: False

hs-source-dirs: plutus/tutorials plutus/howtos plutus/architecture/constraints
main-is: Main.hs
ghc-options: -Wno-unused-imports
build-tool-depends: doctest:doctest
other-modules:
BasicApps
BasicAppConstraints
BasicPlutusTx
BasicPolicies
BasicValidators
Escrow
Escrow2
Escrow3
Escrow4
Escrow5
Escrow6
EscrowImpl
GameModel
HandlingBlockchainEvents
HelloWorldApp
WriteScriptsTo

build-depends:
, aeson
, base >=4.9 && <5
, bytestring
, containers
, data-default
, flat
, freer-extras
, lens
, playground-common
, plutus-chain-index-core
, plutus-contract
, plutus-core
, plutus-ledger
, plutus-ledger-api
, plutus-ledger-constraints
, plutus-script-utils
, plutus-tx
, plutus-tx-constraints
, plutus-use-cases
, QuickCheck
, quickcheck-dynamic
, random
, serialise
, tasty
, tasty-quickcheck
, template-haskell >=2.13.0.0
, text

if !(impl(ghcjs) || os(ghcjs))
build-depends: plutus-tx-plugin -any
if !(impl(ghcjs) || os(ghcjs))
build-depends: plutus-tx-plugin
153 changes: 83 additions & 70 deletions freer-extras/freer-extras.cabal
@@ -1,81 +1,94 @@
cabal-version: 2.2
name: freer-extras
version: 0.1.0.0
synopsis: Useful extensions to simple-freer
description: freer-extras provides logging and monitoring functions extending simple-freer
bug-reports: https://github.com/iohk/plutus/issues
license: Apache-2.0
license-file: LICENSE
author: Tobias Pflug
maintainer: tobias.pflug@iohk.io
build-type: Simple
cabal-version: 2.2
name: freer-extras
version: 0.1.0.0
synopsis: Useful extensions to simple-freer
description:
freer-extras provides logging and monitoring functions extending simple-freer

bug-reports: https://github.com/input-output-hk/plutus-apps/issues
license: Apache-2.0
license-file: LICENSE
author: Tobias Pflug
maintainer: tobias.pflug@iohk.io
build-type: Simple

source-repository head
type: git
location: https://github.com/input-output-hk/plutus-apps
type: git
location: https://github.com/input-output-hk/plutus-apps

common lang
default-language: Haskell2010
default-extensions: ExplicitForAll ScopedTypeVariables
DeriveGeneric StandaloneDeriving DeriveLift
GeneralizedNewtypeDeriving DeriveFunctor DeriveFoldable
DeriveTraversable ImportQualifiedPost
ghc-options: -Wall -Wnoncanonical-monad-instances -Wunused-packages
-Wincomplete-uni-patterns -Wincomplete-record-updates
-Wredundant-constraints -Widentities
default-language: Haskell2010
default-extensions:
DeriveFoldable
DeriveFunctor
DeriveGeneric
DeriveLift
DeriveTraversable
ExplicitForAll
GeneralizedNewtypeDeriving
ImportQualifiedPost
ScopedTypeVariables
StandaloneDeriving

ghc-options:
-Wall -Wnoncanonical-monad-instances -Wunused-packages
-Wincomplete-uni-patterns -Wincomplete-record-updates
-Wredundant-constraints -Widentities

library
import: lang
hs-source-dirs: src
import: lang
hs-source-dirs: src
exposed-modules:
Control.Monad.Freer.Extras
Control.Monad.Freer.Extras.Beam
Control.Monad.Freer.Extras.Log
Control.Monad.Freer.Extras.Modify
Control.Monad.Freer.Extras.Pagination
Control.Monad.Freer.Extras.State
Control.Monad.Freer.Extras.Stream
Control.Monad.Freer.Extras
Control.Monad.Freer.Extras.Beam
Control.Monad.Freer.Extras.Log
Control.Monad.Freer.Extras.Modify
Control.Monad.Freer.Extras.Pagination
Control.Monad.Freer.Extras.State
Control.Monad.Freer.Extras.Stream

build-depends:
aeson -any,
base >=4.7 && <5,
beam-core -any,
beam-sqlite -any,
containers -any,
data-default -any,
freer-simple -any,
iohk-monitoring -any,
lens -any,
mtl -any,
openapi3 -any,
prettyprinter -any,
resource-pool -any,
sqlite-simple -any,
streaming -any,
text -any,
, aeson
, base >=4.7 && <5
, beam-core
, beam-sqlite
, containers
, data-default
, freer-simple
, iohk-monitoring
, lens
, mtl
, openapi3
, prettyprinter
, resource-pool
, sqlite-simple
, streaming
, text

test-suite freer-extras-test
import: lang
type: exitcode-stdio-1.0
main-is: Spec.hs
hs-source-dirs: test
other-modules:
Control.Monad.Freer.Extras.BeamSpec
Control.Monad.Freer.Extras.PaginationSpec
build-depends:
hedgehog -any,
tasty -any,
tasty-hedgehog -any,
build-depends:
base >=4.7 && <5,
beam-core -any,
beam-migrate -any,
beam-sqlite -any,
containers -any,
contra-tracer -any,
freer-extras -any,
freer-simple -any,
lens -any,
resource-pool -any,
semigroups -any,
sqlite-simple -any,
import: lang
type: exitcode-stdio-1.0
main-is: Spec.hs
hs-source-dirs: test
other-modules:
Control.Monad.Freer.Extras.BeamSpec
Control.Monad.Freer.Extras.PaginationSpec

build-depends:
, hedgehog
, tasty
, tasty-hedgehog

build-depends:
, base >=4.7 && <5
, beam-core
, beam-migrate
, beam-sqlite
, containers
, contra-tracer
, freer-extras
, freer-simple
, lens
, resource-pool
, semigroups
, sqlite-simple

0 comments on commit caa5014

Please sign in to comment.