Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to see 255 exit code in isolation #873

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/hlint-repro.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: HLint Repro

on:
pull_request:

jobs:
restyled:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: "hlint, then same exact refactor command as 2 steps (works)"
working-directory: hlint
run: |
docker run \
--rm \
--net=none \
--cpu-shares=512 \
--memory=128m \
--volume "$PWD":/code \
public.ecr.aws/restyled-io/restyler-hlint:v3.5 sh -c '
hlint --serialise --no-exit-code ./BadFile.hs > hlint.refact;
exec refactor ./BadFile.hs -v2 -i --refact-file hlint.refact -X TypeFamilies -X TypeApplications -X StandaloneDeriving -X ScopedTypeVariables -X RecordWildCards -X RankNTypes -X QuasiQuotes -X OverloadedStrings -X OverloadedRecordDot -X MultiParamTypeClasses -X LambdaCase -X GeneralizedNewtypeDeriving -X GADTs -X FlexibleInstances -X FlexibleContexts -X DerivingStrategies -X DeriveTraversable -X DeriveLift -X DeriveGeneric -X DeriveFunctor -X DeriveFoldable -X DeriveAnyClass -X DataKinds -X BangPatterns -X Cpp -X OverlappingInstances -X UndecidableInstances -X IncoherentInstances -X UndecidableSuperClasses -X MonoLocalBinds -X DeepSubsumption -X RelaxedPolyRec -X ExtendedDefaultRules -X ForeignFunctionInterface -X UnliftedFFITypes -X InterruptibleFFI -X CApiFFI -X GHCForeignImportPrim -X JavaScriptFFI -X ParallelArrays -X TemplateHaskell -X TemplateHaskellQuotes -X QualifiedDo -X ImplicitParams -X AllowAmbiguousTypes -X UnliftedNewtypes -X UnliftedDatatypes -X TypeFamilyDependencies -X TypeInType -X OverloadedLists -X NumDecimals -X DisambiguateRecordFields -X NamedFieldPuns -X ViewPatterns -X GADTSyntax -X NPlusKPatterns -X DoAndIfThenElse -X BlockArguments -X RebindableSyntax -X ConstraintKinds -X PolyKinds -X InstanceSigs -X ApplicativeDo -X LinearTypes -X DeriveDataTypeable -X AutoDeriveTypeable -X DefaultSignatures -X DerivingVia -X TypeSynonymInstances -X ConstrainedClassMethods -X NullaryTypeClasses -X FunctionalDependencies -X UnicodeSyntax -X ExistentialQuantification -X MagicHash -X EmptyDataDecls -X KindSignatures -X RoleAnnotations -X ParallelListComp -X PostfixOperators -X TupleSections -X PatternGuards -X LiberalTypeSynonyms -X ImpredicativeTypes -X TypeOperators -X ExplicitNamespaces -X PackageImports -X ExplicitForAll -X AlternativeLayoutRuleTransitional -X DatatypeContexts -X NondecreasingIndentation -X RelaxedLayout -X TraditionalRecordSyntax -X MultiWayIf -X BinaryLiterals -X HexFloatLiterals -X DuplicateRecordFields -X OverloadedLabels -X EmptyCase -X PatternSynonyms -X PartialTypeSignatures -X NamedWildCards -X Strict -X StrictData -X EmptyDataDeriving -X NumericUnderscores -X QuantifiedConstraints -X ImportQualifiedPost -X CUSKs -X StandaloneKindSignatures -X FieldSelectors -X NoMonomorphismRestriction -X NoImplicitPrelude
'

- name: "hlint --refactor (exits 255)"
working-directory: hlint
run: |
docker run \
--rm \
--net=none \
--cpu-shares=512 \
--memory=128m \
--volume "$PWD":/code \
public.ecr.aws/restyled-io/restyler-hlint:v3.5 \
hlint \
--verbose \
--refactor \
--refactor-options="-i" \
-- \
./BadFile.hs
18 changes: 9 additions & 9 deletions _docs/restylers.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Restylers

Built from `715cfdecadad1cdd42a3e6b46ff6980278336ea7`.
Built from `0324e2ee61ab295d8eeaa927501d4e09445b9d48`.

| Restyler | Language(s) | Version | Runs automatically? |
| -------- | ----------- | ------- | ------------------- |
| [astyle](#astyle) | C, C++, C#, Java*, Objective-C | `v3.6.2` | Yes |
| [autopep8](#autopep8) | Python | `v2.3.1` | Yes |
| [autopep8](#autopep8) | Python | `v2.3.2` | Yes |
| [black](#black) | Python | `v24.10.0` | Yes |
| [brittany](#brittany) | Haskell | `v0.14.0.2` | No |
| [cabal-fmt](#cabal-fmt) | Haskell | `v0.1.12` | No |
Expand All @@ -17,7 +17,7 @@ Built from `715cfdecadad1cdd42a3e6b46ff6980278336ea7`.
| [dotnet-format](#dotnet-format) | C#, VB.NET | `v5.1.250801` | No |
| [elm-format](#elm-format) | Elm | `v0.6.1-alpha-3` | Yes |
| [fantomas](#fantomas) | F# | `v3.3.0` | Yes |
| [fourmolu](#fourmolu) | Haskell | `v0.16.2.0` | No |
| [fourmolu](#fourmolu) | Haskell | `v0.17.0.0` | No |
| [gn](#gn) | GN | `v2` | Yes |
| [gofmt](#gofmt) | Go | `go1.23.0` | Yes |
| [google-java-format](#google-java-format) | Java | `v1.9` | No |
Expand All @@ -34,7 +34,7 @@ Built from `715cfdecadad1cdd42a3e6b46ff6980278336ea7`.
| [ormolu](#ormolu) | Haskell | `v0.5.3.0` | No |
| [perltidy](#perltidy) | Perl | `v20230701` | Yes |
| [pg_format](#pg_format) | PSQL | `v5.3` | Yes |
| [php-cs-fixer](#php-cs-fixer) | PHP | `v3.67.1` | Yes |
| [php-cs-fixer](#php-cs-fixer) | PHP | `v3.68.1` | Yes |
| [prettier](#prettier) | JavaScript | `v3.4.2-3` | Yes |
| [prettier-json](#prettier-json) | JSON | `v3.4.2-3` | Yes |
| [prettier-markdown](#prettier-markdown) | Markdown | `v3.4.2-3` | Yes |
Expand All @@ -51,7 +51,7 @@ Built from `715cfdecadad1cdd42a3e6b46ff6980278336ea7`.
| [shellharden](#shellharden) | POSIX sh, Bash | `v4.1.1-3` | Yes |
| [shfmt](#shfmt) | POSIX sh, Bash | `v3.4.3` | Yes |
| [sqlformat](#sqlformat) | SQL, PSQL | `0.5.3` | No |
| [standardrb](#standardrb) | Ruby | `v1.43.0` | Yes |
| [standardrb](#standardrb) | Ruby | `v1.44.0` | Yes |
| [stylish-haskell](#stylish-haskell) | Haskell | `v0.14.3.0` | Yes |
| [taplo](#taplo) | TOML | `0.9.3` | Yes |
| [terraform](#terraform) | Terraform | `v0.12.24-2` | Yes |
Expand Down Expand Up @@ -210,7 +210,7 @@ restylers:
command:
- autopep8
- --in-place
image: restyled/restyler-autopep8:v2.3.1
image: public.ecr.aws/restyled-io/restyler-autopep8:v2.3.2
include:
- '**/*.py'
interpreters:
Expand Down Expand Up @@ -1314,7 +1314,7 @@ restylers:
- fourmolu
- --mode
- inplace
image: restyled/restyler-fourmolu:v0.16.2.0
image: public.ecr.aws/restyled-io/restyler-fourmolu:v0.17.0.0
include:
- '**/*.hs'
interpreters: []
Expand Down Expand Up @@ -2892,7 +2892,7 @@ restylers:
command:
- php-cs-fixer
- fix
image: public.ecr.aws/restyled-io/restyler-php-cs-fixer:v3.67.1
image: public.ecr.aws/restyled-io/restyler-php-cs-fixer:v3.68.1
include:
- '**/*.php'
interpreters: []
Expand Down Expand Up @@ -4346,7 +4346,7 @@ restylers:
command:
- standardrb
- --fix
image: public.ecr.aws/restyled-io/restyler-standardrb:v1.43.0
image: public.ecr.aws/restyled-io/restyler-standardrb:v1.44.0
include:
- '**/*.rb'
interpreters:
Expand Down
152 changes: 152 additions & 0 deletions hlint/.hlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
#
# Meanings of hlint severity levels:
#
# error ┃ A rule that is enforced and fails the build.
# ─────────╂─────────────────────────────────────────────────────
# warn ┃ A rule that we intend to enforce soon.
# ┃
# ┃ Any warning severity should only be *temporary*;
# ┃ once all the violatations are fixed, a warning
# ┃ will escalated to error severity.
# ┃
# ┃ Place a TODO and date on each warning to indicate
# ┃ when each rule enforcement was disabled so that we
# ┃ can notice neglect.
# ─────────╂─────────────────────────────────────────────────────
# hint ┃ A sujective suggestion that is sometimes useful but
# ┃ not a rule and should not be applied blindly.
# ─────────╂─────────────────────────────────────────────────────
# ignore ┃ Used to suppress hlint defaults that we don't want.
#
#
# If a rule truly does not apply in a particular situation, see
# https://github.com/ndmitchell/hlint/#ignoring-hints
# for ad hoc ways to suppress hlint.

---

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[PATCH 2/2] Restyled by prettier-yaml

Suggested change

# By default, everything is an error
- error: {name: ""}

# Some things we don't care about at all
- ignore: {name: "Use module export list"}
- ignore: {name: "Redundant bracket due to operator fixities"}
- ignore: {name: "Use explicit module export list"}
- ignore: {name: "Redundant do"}
- ignore: {name: "Eta reduce"}
- ignore: {name: "Use list comprehension"}
- ignore: {name: "Reduce duplication"}
- ignore: {name: "Use fmap"} # we use classy prelude so this would be in error
- ignore: {name: "Avoid restricted function", within: Application}
- ignore: {name: "Use ."} # commonly broken or less readable
- ignore: {name: "Use &&"} # we like "and" at 3+ elements
- ignore: {name: "Use ||"} # we like "or" at 3+ elements
- ignore: {name: "Use join"} # this often leads to cryptic code when do notation is easier to read
- ignore: {name: "Redundant ^."} # confused by esqueleto's (^.)
- ignore: {name: "Fuse on/on"} # confused by esqueleto's on

# Custom errors
- error: {lhs: mapM, rhs: traverse}
- error: {lhs: mapM_, rhs: traverse_}
- error: {lhs: forM, rhs: for}
- error: {lhs: forM_, rhs: for_}
- error: {lhs: return, rhs: pure}
- error: {lhs: "only (entityKey x)", rhs: "onlyKey x"}

- error:
name: "Avoid unsafePerformIO"
lhs: "unsafePerformIO"
rhs: "unsafePerformIO"
note: |
Avoid `unsafePerformIO`, which bypasses the type system to perform arbitrary
`IO` effects from pure code

- warn: # TODO (2023-08-17) escalate to error severity
name: "Avoid error"
lhs: "error"
rhs: "error"
note: |
`error` will not raise until the value is demanded, which can lead to a
confusing debugging experience. Prefer modeling the error in the type
system via `Maybe` or `Either` or `fail` in an appropriate `Monad`. If
that's not possible, throw an actual exception. Lastly, if an error in a
pure context cannot be avoided (e.g. `fromString`), ignore this specific
case via an `ANN` pragma.

- error:
name: "Avoid fromJust"
lhs: "fromJust"
rhs: "fromJust"
note: |
`fromJust` uses `error` internally, and comes with all the same caveats
(see "Avoid error"). Prefer `fromJustNoteM`.

- warn: # TODO (2023-08-17) escalate to error severity
name: "Avoid fromJustNote"
lhs: "fromJustNote"
rhs: "fromJustNote"
note: |
`fromJustNote` uses `error` internally, and comes with all the same
caveats (see "Avoid error"). Prefer `fromJustNoteM`.

# Ignore everything within our generated clients
- ignore: {within: "FreckleCurriculaApi.**.*"}
- ignore: {within: "RenaissanceGUR.**.*"}
- ignore: {within: "PerformanceAnalysisService.**.*"}
- ignore: {within: "BenchmarkService.**.*"}
- ignore: {within: "RecurlyApi.**.*"}

# Specify additional command line arguments
- arguments:
- -XBangPatterns
- -XDataKinds
- -XDeriveAnyClass
- -XDeriveFoldable
- -XDeriveFunctor
- -XDeriveGeneric
- -XDeriveLift
- -XDeriveTraversable
- -XDerivingStrategies
- -XFlexibleContexts
- -XFlexibleInstances
- -XGADTs
- -XGeneralizedNewtypeDeriving
- -XLambdaCase
- -XMultiParamTypeClasses
- -XNoImplicitPrelude
- -XNoMonomorphismRestriction
- -XOverloadedRecordDot
- -XOverloadedStrings
- -XQuasiQuotes
- -XRankNTypes
- -XRecordWildCards
- -XScopedTypeVariables
- -XStandaloneDeriving
- -XTypeApplications
- -XTypeFamilies
Comment on lines +101 to +126

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[PATCH 2/2] Restyled by prettier-yaml

Suggested change
- -XBangPatterns
- -XDataKinds
- -XDeriveAnyClass
- -XDeriveFoldable
- -XDeriveFunctor
- -XDeriveGeneric
- -XDeriveLift
- -XDeriveTraversable
- -XDerivingStrategies
- -XFlexibleContexts
- -XFlexibleInstances
- -XGADTs
- -XGeneralizedNewtypeDeriving
- -XLambdaCase
- -XMultiParamTypeClasses
- -XNoImplicitPrelude
- -XNoMonomorphismRestriction
- -XOverloadedRecordDot
- -XOverloadedStrings
- -XQuasiQuotes
- -XRankNTypes
- -XRecordWildCards
- -XScopedTypeVariables
- -XStandaloneDeriving
- -XTypeApplications
- -XTypeFamilies


- modules:
- {name: [Data.Set], as: Set}
- {name: [Data.Map], as: Map}
- {name: [Data.HashSet], as: HashSet}
- {name: [Data.HashMap.Strict], as: HashMap}
- {name: [Data.Text], as: T}
- {name: [Data.Text.Encoding], as: T}
- {name: [Data.Text.IO], as: T}
- {name: [Data.Text.Lazy], as: TL}
- {name: [Data.Text.Lazy.Encoding], as: TL}
- {name: [Data.Text.IO.Lazy], as: TL}
- {name: [Data.ByteString], as: BS}
- {name: [Data.ByteString.Lazy], as: BSL}
- {name: [Data.ByteString.Char8], as: BS8}
- {name: [Data.ByteString.Lazy.Char8], as: BSL8}
- {name: [Data.List.NonEmpty], as: NE}
- {name: [Data.Sequence], as: Seq}
- {name: Database.Esqueleto.Legacy, within: []}
- {name: Freckle.CurriculaApi, as: CurriculaApi}
- name:
- Freckle.App.OpenTelemetry
- OpenTelemetry.Context
- OpenTelemetry.Context.ThreadLocal
- OpenTelemetry.Trace
as: Trace
Comment on lines +129 to +152

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[PATCH 2/2] Restyled by prettier-yaml

Suggested change
- {name: [Data.Set], as: Set}
- {name: [Data.Map], as: Map}
- {name: [Data.HashSet], as: HashSet}
- {name: [Data.HashMap.Strict], as: HashMap}
- {name: [Data.Text], as: T}
- {name: [Data.Text.Encoding], as: T}
- {name: [Data.Text.IO], as: T}
- {name: [Data.Text.Lazy], as: TL}
- {name: [Data.Text.Lazy.Encoding], as: TL}
- {name: [Data.Text.IO.Lazy], as: TL}
- {name: [Data.ByteString], as: BS}
- {name: [Data.ByteString.Lazy], as: BSL}
- {name: [Data.ByteString.Char8], as: BS8}
- {name: [Data.ByteString.Lazy.Char8], as: BSL8}
- {name: [Data.List.NonEmpty], as: NE}
- {name: [Data.Sequence], as: Seq}
- {name: Database.Esqueleto.Legacy, within: []}
- {name: Freckle.CurriculaApi, as: CurriculaApi}
- name:
- Freckle.App.OpenTelemetry
- OpenTelemetry.Context
- OpenTelemetry.Context.ThreadLocal
- OpenTelemetry.Trace
as: Trace

Loading