From a883a55a026a2af3474cbc03385959f463741b54 Mon Sep 17 00:00:00 2001 From: lunaticare Date: Sun, 24 Jul 2022 11:13:33 +0100 Subject: [PATCH 1/4] Add Github precommit workflow --- .github/workflows/pre-commit.yml | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000000..bd398e8501 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,42 @@ +name: pre-commit + +on: + pull_request: + push: + branches: [master] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: ./.github/actions/setup-build + with: + ghc: "9.2.3" + os: ${{ runner.os }} + + - name: "Install stylish-haskell" + run: | + cabal install stylish-haskell + echo "${HOME}/.cabal/bin" >> $GITHUB_PATH + + - name: "Check stylish-haskell is available" + run: | + echo $(which stylish-haskell) + + - name: Compiled deps cache + id: stylish-haskell-compiled-cache + uses: actions/cache@v2 + env: + cache-name: stylish-haskell-compiled-cache + with: + path: ${{ env.CABAL_PKGS_DIR }} + key: ${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project.freeze') }} + restore-keys: | + ${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}-${{ env.INDEX_STATE }}- + ${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}-${{ inputs.ghc }}- + ${{ inputs.cache-prefix }}${{ env.cache-name }}-${{ inputs.os }}- + + - uses: actions/setup-python@v3 + - uses: pre-commit/action@v3.0.0 From 5e983fc3382f4ac860d291384e60b009d9f7b5fe Mon Sep 17 00:00:00 2001 From: lunaticare Date: Thu, 28 Jul 2022 22:08:26 +0100 Subject: [PATCH 2/4] Reformat remaining files --- plugins/hls-stan-plugin/src/Ide/Plugin/Stan.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/hls-stan-plugin/src/Ide/Plugin/Stan.hs b/plugins/hls-stan-plugin/src/Ide/Plugin/Stan.hs index 0d3607a6b3..7eb46e05b0 100644 --- a/plugins/hls-stan-plugin/src/Ide/Plugin/Stan.hs +++ b/plugins/hls-stan-plugin/src/Ide/Plugin/Stan.hs @@ -6,8 +6,8 @@ import Control.Monad.IO.Class (liftIO) import Control.Monad.Trans.Class (lift) import Control.Monad.Trans.Maybe (MaybeT (MaybeT), runMaybeT) import Data.Foldable (toList) -import qualified Data.HashMap.Strict as HM import Data.Hashable (Hashable) +import qualified Data.HashMap.Strict as HM import qualified Data.Map as Map import Data.Maybe (fromJust, mapMaybe) import qualified Data.Text as T @@ -24,9 +24,9 @@ import Development.IDE (Action, FileDiagnostic, getFilesOfInterestUntracked, hscEnv, msrModSummary, tmrTypechecked, use, uses) +import Development.IDE.Core.Rules (getHieFile, + getSourceFileSource) import Development.IDE.Core.RuleTypes (HieAstResult (..)) -import Development.IDE.Core.Rules (getSourceFileSource, - getHieFile) import qualified Development.IDE.Core.Shake as Shake import Development.IDE.GHC.Compat (HieASTs (HieASTs), RealSrcSpan (..), mkHieFile', From 58619dbd2d23ad2794ccae4a5ef22eb5855fde67 Mon Sep 17 00:00:00 2001 From: lunaticare Date: Thu, 28 Jul 2022 22:11:49 +0100 Subject: [PATCH 3/4] Don't shorten project name --- .github/workflows/pre-commit.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index bd398e8501..fe363ef650 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -15,6 +15,7 @@ jobs: with: ghc: "9.2.3" os: ${{ runner.os }} + shorten-hls: false - name: "Install stylish-haskell" run: | From b2479427af4f38d382a577dccbb1995d6aa0ad02 Mon Sep 17 00:00:00 2001 From: lunaticare Date: Thu, 28 Jul 2022 22:16:24 +0100 Subject: [PATCH 4/4] Fix pre-commit file exclusion pattern --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b2bac28fcd..ba541e83e3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ { "id": "mixed-line-ending", "args": ["--fix", "lf"], - "exclude": "test/testdata/.*CRLF*.hs$" + "exclude": "test/testdata/.*CRLF.*?\\.hs$" } ] }