1
1
mirror of https://github.com/tweag/ormolu.git synced 2024-07-07 09:26:22 +03:00

Prioritize fixity overrides and module re-exports from command line

This commit is contained in:
Mark Karpov 2024-02-01 17:21:56 +01:00 committed by Mark Karpov
parent e4bdf8127a
commit 6cf491c5ca
4 changed files with 15 additions and 6 deletions

View File

@ -4,6 +4,9 @@
1087](https://github.com/tweag/ormolu/issues/1087).
* Improve comment placement in if-then-else blocks. [Issue
998](https://github.com/tweag/ormolu/issues/998).
* Now command line options for fixity overrides and module re-exports
overwrite information from `.ormolu` files. [Issue
1030](https://github.com/tweag/ormolu/issues/1030).
## Ormolu 0.7.3.0

View File

@ -168,15 +168,17 @@ formatOne ConfigFileOpts {..} mode reqSourceType rawConfig mpath =
fromMaybe
ModuleSource
(reqSourceType <|> mdetectedSourceType)
let mfixityOverrides = fst <$> mdotOrmolu
mmoduleReexports = snd <$> mdotOrmolu
return $
refineConfig
sourceType
mcabalInfo
mfixityOverrides
mmoduleReexports
rawConfig
(Just (cfgFixityOverrides rawConfig))
(Just (cfgModuleReexports rawConfig))
( rawConfig
{ cfgFixityOverrides = maybe defaultFixityOverrides fst mdotOrmolu,
cfgModuleReexports = maybe defaultModuleReexports snd mdotOrmolu
}
)
handleDiff originalInput formattedInput fileRepr =
case diffText originalInput formattedInput fileRepr of
Nothing -> return ExitSuccess

View File

@ -16,6 +16,8 @@
ormolu --check-idempotence --mode inplace --no-cabal --no-dot-ormolu --fixity 'infixr 8 .=' --fixity 'infixr 5 :>' test-0-with-fixity-info-manual.hs
cp test-0-input.hs test-0-with-fixity-info-dotormolu.hs
ormolu --check-idempotence --mode inplace --no-cabal -p base test-0-with-fixity-info-dotormolu.hs
cp test-0-input.hs test-0-cli-overrides-dotormolu.hs
ormolu --check-idempotence --mode inplace --no-cabal -p base --fixity 'infixr 5 .=' test-0-cli-overrides-dotormolu.hs
cp test-1-input.hs test-1-no-extra-info.hs
ormolu --check-idempotence --mode inplace --no-cabal --no-dot-ormolu test-1-no-extra-info.hs
cp test-1-input.hs test-1-with-fixity-info-manual.hs
@ -33,11 +35,13 @@
'';
checkPhase = ''
echo test-0-no-extra-info.hs
diff --color=always test-0-no-extra-info-expected.hs test-0-no-extra-info.hs
diff --color=always test-0-ugly-expected.hs test-0-no-extra-info.hs
echo test-0-with-fixity-info-manual.hs
diff --color=always test-0-with-fixity-info-expected.hs test-0-with-fixity-info-manual.hs
echo test-0-with-fixity-info-dotormolu.hs
diff --color=always test-0-with-fixity-info-expected.hs test-0-with-fixity-info-dotormolu.hs
echo test-0-cli-overrides-dotormolu.hs
diff --color=always test-0-ugly-expected.hs test-0-cli-overrides-dotormolu.hs
echo test-1-no-extra-info.hs
diff --color=always test-1-no-extra-info-expected.hs test-1-no-extra-info.hs
echo test-1-with-fixity-info-manual.hs