Skip to content

Commit 13e58fa

Browse files
committed
merge master
2 parents 5457a06 + 60d92aa commit 13e58fa

File tree

13 files changed

+338
-146
lines changed

13 files changed

+338
-146
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,25 @@ jobs:
1919
ghc: ['9.12', '9.10', '9.8']
2020
include:
2121
- os: windows-latest
22-
ghc: '9.10'
22+
ghc: '9.12'
2323
- os: macOS-latest
24-
ghc: '9.10'
24+
ghc: '9.12'
2525
steps:
2626
- run: git config --global core.autocrlf false
27-
- uses: actions/checkout@v2
27+
- uses: actions/checkout@v4
2828
- uses: haskell-actions/setup@v2
2929
id: setup-haskell
3030
with:
3131
ghc-version: ${{ matrix.ghc }}
3232
- run: cabal install apply-refact --install-method=copy
33-
if: matrix.ghc == '9.8'
34-
- name: Get GHC libdir
35-
id: get-ghc-libdir
36-
run: echo "libdir=$(ghc --print-libdir)" >> $GITHUB_OUTPUT
37-
shell: bash
33+
# Not available on GHC 9.10, see https://github.com/mpickering/apply-refact/pull/149
34+
if: matrix.ghc == '9.12' || matrix.ghc == '9.8'
3835
- run: cabal v2-freeze --enable-tests
39-
- uses: actions/cache@v2
36+
- uses: actions/cache@v4
4037
with:
4138
path: ${{ steps.setup-haskell.outputs.cabal-store }}
42-
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ steps.get-ghc-libdir.outputs.libdir }}-${{ hashFiles('cabal.project.freeze') }}
43-
- run: cabal run exe:hlint -- --test
39+
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
40+
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
41+
- uses: ndmitchell/neil@master
42+
with:
43+
hlint-arguments: src

.github/workflows/release.yml

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,30 @@
11
name: release
22
on:
3-
# Match when pushing tags v*, i.e. v1.0, v20.15.10
4-
push:
5-
tags: ['v*']
6-
3+
workflow_dispatch:
4+
release:
5+
types: [created]
6+
77
jobs:
88
init:
99
runs-on: ubuntu-latest
1010
outputs:
11-
upload_url: ${{ steps.create-release.outputs.upload_url }}
11+
upload_url: ${{ steps.release.outputs.upload_url }}
1212
filename: hlint-${{ steps.reftags_version.outputs._1 }}
1313

1414
steps:
15+
- uses: joutvhu/get-release@v1
16+
id: release
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
with:
20+
latest: true
21+
1522
- uses: rishabhgupta/split-by@v1
1623
id: reftags_version
1724
with:
18-
string: ${{ github.ref }} # e.g. refs/tags/v0.11.1.1
25+
string: ${{ steps.release.outputs.tag_name }} # e.g. refs/tags/v0.11.1.1
1926
split-by: 'v'
2027

21-
- uses: actions/create-release@v1
22-
id: create-release
23-
env:
24-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25-
with:
26-
tag_name: v${{ steps.reftags_version.outputs._1 }}
27-
release_name: v${{ steps.reftags_version.outputs._1 }}
28-
2928
build:
3029
needs: init
3130
runs-on: ${{ matrix.os }}
@@ -37,16 +36,16 @@ jobs:
3736
- os: ubuntu-20.04
3837
SUFFIX: x86_64-linux.tar.gz
3938
- os: macOS-latest
40-
SUFFIX: x86_64-osx.tar.gz
39+
SUFFIX: arm64-osx.tar.gz
4140
- os: windows-latest
4241
SUFFIX: x86_64-windows.zip
4342

4443
steps:
4544
- run: git config --global core.autocrlf false
46-
- uses: actions/checkout@v2
47-
- uses: haskell/actions/setup@v2
45+
- uses: actions/checkout@v4
46+
- uses: haskell-actions/setup@v2
4847
with:
49-
ghc-version: '9.6'
48+
ghc-version: '9.12'
5049
- uses: ndmitchell/neil@master
5150
with:
5251
make-release: true

CHANGES.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
Changelog for HLint (* = breaking change)
22

3+
3.10, released 2024-02-02
34
#1617, hints for when x <*> y could be y, e.g. []
4-
* #1594, upgrade to GHC 9.10
5+
* #1594, upgrade to GHC 9.12
56
#1568, add mapMaybe f (reverse x) ==> reverse (mapMaybe f x)
67
#1569, avoid redundant Foldable.toList calls in Foldable operations
78
#1571, rename a few hints to make them clearer

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright Neil Mitchell 2006-2024.
1+
Copyright Neil Mitchell 2006-2025.
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,6 @@ If you're using git, it may be helpful to only run hlint on changed files. This
184184
{ git diff --diff-filter=d --name-only $(git merge-base HEAD origin/master) -- "***.hs" && git ls-files -o --exclude-standard -- "***.hs"; } | xargs hlint
185185
```
186186

187-
Because hlint's `--refactor` option only works when you pass a single file, this approach is also helpful to enable refactoring many files in a single command:
188-
189-
```bash
190-
{ git diff --diff-filter=d --name-only $(git merge-base HEAD origin/master) -- "***.hs" && git ls-files -o --exclude-standard -- "***.hs"; } | xargs -I file hlint file --refactor --refactor-options="--inplace --step"
191-
```
192-
193187
### Configuration
194188

195189
#### Why doesn't HLint know the fixity for my custom !@%$ operator?

data/hlint.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,16 @@
937937
- warn: {lhs: find f (Data.Foldable.toList x), rhs: find f x}
938938
- warn: {lhs: concat (Data.Foldable.toList x), rhs: concat x}
939939
- warn: {lhs: concatMap f (Data.Foldable.toList x), rhs: concatMap f x}
940+
- warn: {lhs: foldrM f c (Data.Foldable.toList x), rhs: foldrM f c x}
941+
- warn: {lhs: foldlM f c (Data.Foldable.toList x), rhs: foldlM f c x}
942+
- warn: {lhs: traverse_ f (Data.Foldable.toList x), rhs: traverse_ f x}
943+
- warn: {lhs: for_ (Data.Foldable.toList x) f, rhs: for_ x f}
944+
- warn: {lhs: sequenceA_ (Data.Foldable.toList x), rhs: sequenceA_ x}
945+
- warn: {lhs: asum (Data.Foldable.toList x), rhs: asum x}
946+
- warn: {lhs: mapM_ f (Data.Foldable.toList x), rhs: mapM_ f x}
947+
- warn: {lhs: forM_ (Data.Foldable.toList x) f, rhs: forM_ x f}
948+
- warn: {lhs: sequence_ (Data.Foldable.toList x), rhs: sequence_ x}
949+
- warn: {lhs: msum (Data.Foldable.toList x), rhs: msum x}
940950

941951
# STATE MONAD
942952

hints.md

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13686,6 +13686,166 @@ concatMap f x
1368613686
<td>Warning</td>
1368713687
</tr>
1368813688
<tr>
13689+
<td>Redundant toList</td>
13690+
<td>
13691+
LHS:
13692+
<code>
13693+
foldrM f c (Data.Foldable.toList x)
13694+
</code>
13695+
<br>
13696+
RHS:
13697+
<code>
13698+
foldrM f c x
13699+
</code>
13700+
<br>
13701+
</td>
13702+
<td>Warning</td>
13703+
</tr>
13704+
<tr>
13705+
<td>Redundant toList</td>
13706+
<td>
13707+
LHS:
13708+
<code>
13709+
foldlM f c (Data.Foldable.toList x)
13710+
</code>
13711+
<br>
13712+
RHS:
13713+
<code>
13714+
foldlM f c x
13715+
</code>
13716+
<br>
13717+
</td>
13718+
<td>Warning</td>
13719+
</tr>
13720+
<tr>
13721+
<td>Redundant toList</td>
13722+
<td>
13723+
LHS:
13724+
<code>
13725+
traverse_ f (Data.Foldable.toList x)
13726+
</code>
13727+
<br>
13728+
RHS:
13729+
<code>
13730+
traverse_ f x
13731+
</code>
13732+
<br>
13733+
</td>
13734+
<td>Warning</td>
13735+
</tr>
13736+
<tr>
13737+
<td>Redundant toList</td>
13738+
<td>
13739+
LHS:
13740+
<code>
13741+
for_ (Data.Foldable.toList x) f
13742+
</code>
13743+
<br>
13744+
RHS:
13745+
<code>
13746+
for_ x f
13747+
</code>
13748+
<br>
13749+
</td>
13750+
<td>Warning</td>
13751+
</tr>
13752+
<tr>
13753+
<td>Redundant toList</td>
13754+
<td>
13755+
LHS:
13756+
<code>
13757+
sequenceA_ (Data.Foldable.toList x)
13758+
</code>
13759+
<br>
13760+
RHS:
13761+
<code>
13762+
sequenceA_ x
13763+
</code>
13764+
<br>
13765+
</td>
13766+
<td>Warning</td>
13767+
</tr>
13768+
<tr>
13769+
<td>Redundant toList</td>
13770+
<td>
13771+
LHS:
13772+
<code>
13773+
asum (Data.Foldable.toList x)
13774+
</code>
13775+
<br>
13776+
RHS:
13777+
<code>
13778+
asum x
13779+
</code>
13780+
<br>
13781+
</td>
13782+
<td>Warning</td>
13783+
</tr>
13784+
<tr>
13785+
<td>Redundant toList</td>
13786+
<td>
13787+
LHS:
13788+
<code>
13789+
mapM_ f (Data.Foldable.toList x)
13790+
</code>
13791+
<br>
13792+
RHS:
13793+
<code>
13794+
mapM_ f x
13795+
</code>
13796+
<br>
13797+
</td>
13798+
<td>Warning</td>
13799+
</tr>
13800+
<tr>
13801+
<td>Redundant toList</td>
13802+
<td>
13803+
LHS:
13804+
<code>
13805+
forM_ (Data.Foldable.toList x) f
13806+
</code>
13807+
<br>
13808+
RHS:
13809+
<code>
13810+
forM_ x f
13811+
</code>
13812+
<br>
13813+
</td>
13814+
<td>Warning</td>
13815+
</tr>
13816+
<tr>
13817+
<td>Redundant toList</td>
13818+
<td>
13819+
LHS:
13820+
<code>
13821+
sequence_ (Data.Foldable.toList x)
13822+
</code>
13823+
<br>
13824+
RHS:
13825+
<code>
13826+
sequence_ x
13827+
</code>
13828+
<br>
13829+
</td>
13830+
<td>Warning</td>
13831+
</tr>
13832+
<tr>
13833+
<td>Redundant toList</td>
13834+
<td>
13835+
LHS:
13836+
<code>
13837+
msum (Data.Foldable.toList x)
13838+
</code>
13839+
<br>
13840+
RHS:
13841+
<code>
13842+
msum x
13843+
</code>
13844+
<br>
13845+
</td>
13846+
<td>Warning</td>
13847+
</tr>
13848+
<tr>
1368913849
<td>Use gets</td>
1369013850
<td>
1369113851
LHS:

hlint.cabal

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
cabal-version: 1.18
22
build-type: Simple
33
name: hlint
4-
version: 3.8
4+
version: 3.10
55
license: BSD3
66
license-file: LICENSE
77
category: Development
88
author: Neil Mitchell <[email protected]>
99
maintainer: Neil Mitchell <[email protected]>
10-
copyright: Neil Mitchell 2006-2024
10+
copyright: Neil Mitchell 2006-2025
1111
synopsis: Source code suggestions
1212
description:
1313
HLint gives suggestions on how to improve your source code.
@@ -36,7 +36,7 @@ extra-source-files:
3636
extra-doc-files:
3737
README.md
3838
CHANGES.txt
39-
tested-with: GHC==9.10, GHC==9.8, GHC==9.6
39+
tested-with: GHC==9.12, GHC==9.10, GHC==9.8
4040

4141
source-repository head
4242
type: git

src/CmdLine.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ mode = cmdArgsMode $ modes
183183
,"To check all Haskell files in 'src' and generate a report type:"
184184
," hlint src --report"]
185185
] &= program "hlint" &= verbosity
186-
&= summary ("HLint v" ++ showVersion version ++ ", (C) Neil Mitchell 2006-2024")
186+
&= summary ("HLint v" ++ showVersion version ++ ", (C) Neil Mitchell 2006-2025")
187187
where
188188
nam xs = nam_ xs &= name [NE.head $ NE.fromList xs]
189189
nam_ xs = def &= explicit &= name xs

0 commit comments

Comments
 (0)