diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000000..fe363ef650 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,43 @@ +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 }} + shorten-hls: false + + - 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 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$" } ] } 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',