Skip to content

Commit

Permalink
Merge pull request #8950 from Kleidukos/8936-formatting-codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Kleidukos authored May 28, 2023
2 parents 94615d6 + c7a5ac6 commit 4a99076
Show file tree
Hide file tree
Showing 455 changed files with 85,517 additions and 69,157 deletions.
7 changes: 7 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 2023
########################################

# Format the source with fourmolu
10a14397e7295f79bb65ff505e52895f4864270a

# 2022
########################################

Expand Down Expand Up @@ -33,3 +39,4 @@ b0333ec5b73ba8f7a18223b203d999b38c75281d

# Move source files under 'src/'.
52d506bb4e25489f40cb5eb594dda5595aeb93ed

23 changes: 23 additions & 0 deletions .githooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

set -euxo pipefail

if [[ $(uname -s) != "Linux" ]]
then
PROCS=$(sysctl -n hw.logicalcpu)
else
PROCS=$(nproc)
fi

if which fourmolu > /dev/null ; then
find Cabal Cabal-syntax cabal-install -name '*.hs' -print0 \
! -path Cabal-syntax/src/Distribution/Fields/Lexer.hs \
! -path Cabal-syntax/src/Distribution/SPDX/LicenseExceptionId.hs \
! -path Cabal-syntax/src/Distribution/SPDX/LicenseId.hs \
! -path Cabal/src/Distribution/Simple/Build/Macros/Z.hs \
! -path Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs \
| xargs -P "${PROCS}" -I {} fourmolu -q --mode check {}
else
echo "Fourmolu not found, aborting."
exit 1
fi
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
---
Please include the following checklist in your PR:

* [ ] Patches conform to the [coding conventions](https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#conventions).
* [ ] Patches conform to the [coding conventions](https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#other-conventions).
* [ ] Any changes that could be relevant to users [have been recorded in the changelog](https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#changelog).
* [ ] The documentation has been updated, if necessary.
* [ ] Include [manual QA notes](https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#qa-notes) if your PR relates to cabal-install.
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Linting

on:
pull_request:
push:
branches: ["master"]

jobs:
fourmolu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: haskell-actions/run-fourmolu@v8
with:
pattern: |
Cabal/**/*.hs
Cabal-syntax/**/*.hs
Cabal-install/**/*.hs
!Cabal-syntax/src/Distribution/Fields/Lexer.hs
!Cabal-syntax/src/Distribution/SPDX/LicenseExceptionId.hs
!Cabal-syntax/src/Distribution/SPDX/LicenseId.hs
!Cabal/src/Distribution/Simple/Build/Macros/Z.hs
!Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs
57 changes: 0 additions & 57 deletions .github/workflows/whitespace.yml

This file was deleted.

34 changes: 4 additions & 30 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,38 +137,16 @@ For instance:
Manual QA is not expected to find every possible bug, but to really challenge the assumptions of the contributor, and to verify that their own testing
of their patch is not influenced by their setup or implicit knowledge of the system.

Whitespace Conventions
----------------------

* No tab characters allowed.
* No trailing whitespace allowed.
* File needs to be terminated by a newline character.

These conventions are enforced by the
[fix-whitespace](https://hackage.haskell.org/package/fix-whitespace)
tool. Install it from hackage as usual (`cabal install fix-whitespace`)
and run it in the project root to fix whitespace violations.

The files included in the automatic whitespace check are specified in
`fix-whitespace.yaml`. Please add to this file if you add textfiles
to this repository that are not included by the rules given there.
Note that files that make essential use of tab characters (like `Makefile`)
should _not_ be included in the automatic check.

Whitespace conventions are enforced by
[CI](https://github.com/haskell/cabal/actions/workflows/whitespace.yml).
If you push a fix of a whitespace violation, please do so in a
_separate commit_.


Code Style
---------------

We use automated formatting with Fourmolu to enforce a unified style across the code bases. It is checked in the CI process.
You can automatically format the code bases with `make style` at the top level of the project.

Other Conventions
-----------------

* Try to follow style conventions of a file you are modifying, and
avoid gratuitous reformatting (it makes merges harder!)

* Format your commit messages [in the standard way](https://chris.beams.io/posts/git-commit/#seven-rules).

* A lot of Cabal does not have top-level comments. We are trying to
Expand Down Expand Up @@ -227,10 +205,6 @@ Other Conventions
#endif
```

We like [this style guide][guide].

[guide]: https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md

GitHub Ticket Conventions
-------------------

Expand Down
1 change: 1 addition & 0 deletions Cabal-syntax/Setup.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Distribution.Simple

main :: IO ()
main = defaultMain
Loading

0 comments on commit 4a99076

Please sign in to comment.