on master help sign in
Replace “idempotency” with “idempotence”
commit5d1612f153aaf52c864d1cd12d57e4249a8576c8 authorMark Karpov <markkarpov92@gmail.com> dateMon 27 Apr 2020, 15:06 (6 years ago) parentbc62131
8 files changed+20−17
CHANGELOG.md+3 CONTRIBUTING.md+1−1 app/Main.hs+1−1 default.nix+7−7 nix/ormolize/default.nix+1−1 src/Ormolu.hs+2−2 src/Ormolu/Config.hs+2−2 tests/Ormolu/PrinterSpec.hs+3−3
CHANGELOG.md+3
@@ -3,6 +3,9 @@
33* Fixed rendering of type signatures concerning several identifiers. [Issue
44 566](https://github.com/tweag/ormolu/issues/566).
55
6+* Renamed the `--check-idempotency` flag to `--check-idempotence`.
7+ Apparently only the latter is correct.
8+
69## Ormolu 0.0.5.0
710
811* Grouping of statements in `do`-blocks is now preserved. [Issue
CONTRIBUTING.md+1−1
@@ -30,7 +30,7 @@ Testing is performed as following:
3030* The result of printing is parsed back again and the AST is compared to the
3131 AST obtained from the original file. They should match.
3232* The output of printer is checked against the expected output.
33−* Idempotency property is verified: formatting already formatted code
33+* Idempotence property is verified: formatting already formatted code
3434 results in exactly the same output.
3535
3636Examples can be organized in sub-directories, see the existing ones for
app/Main.hs+1−1
@@ -167,7 +167,7 @@ configParser =
167167 help "Output information useful for debugging"
168168 ]
169169 <*> (switch . mconcat)
170− [ long "check-idempotency",
170+ [ long "check-idempotence",
171171 short 'c',
172172 help "Fail if formatting is not idempotent"
173173 ]
default.nix+7−7
@@ -131,19 +131,19 @@ in {
131131 doCheck = true;
132132 buildPhase = ''
133133 cp src.hs result-all-implicit.hs
134− ormolu --check-idempotency --mode inplace result-all-implicit.hs
134+ ormolu --check-idempotence --mode inplace result-all-implicit.hs
135135 cp src.hs result-all-explicit.hs
136− ormolu --check-idempotency --mode inplace --start-line 1 --end-line 13 result-all-explicit.hs
136+ ormolu --check-idempotence --mode inplace --start-line 1 --end-line 13 result-all-explicit.hs
137137 cp src.hs result-only-start.hs
138− ormolu --check-idempotency --mode inplace --start-line 1 result-only-start.hs
138+ ormolu --check-idempotence --mode inplace --start-line 1 result-only-start.hs
139139 cp src.hs result-only-end.hs
140− ormolu --check-idempotency --mode inplace --end-line 13 result-only-end.hs
140+ ormolu --check-idempotence --mode inplace --end-line 13 result-only-end.hs
141141 cp src.hs result-6-7.hs
142− ormolu --check-idempotency --mode inplace --start-line 6 --end-line 7 result-6-7.hs
142+ ormolu --check-idempotence --mode inplace --start-line 6 --end-line 7 result-6-7.hs
143143 cp src.hs result-6-8.hs
144− ormolu --check-idempotency --mode inplace --start-line 6 --end-line 8 result-6-8.hs
144+ ormolu --check-idempotence --mode inplace --start-line 6 --end-line 8 result-6-8.hs
145145 cp src.hs result-9-13.hs
146− ormolu --check-idempotency --mode inplace --start-line 9 --end-line 13 result-9-13.hs
146+ ormolu --check-idempotence --mode inplace --start-line 9 --end-line 13 result-9-13.hs
147147 '';
148148 checkPhase = ''
149149 echo result-all-implicit.hs
nix/ormolize/default.nix+1−1
@@ -32,7 +32,7 @@
3232 cp "$hs_file" "''${hs_file}-original"
3333 done
3434
35− (ormolu --check-idempotency --mode inplace $hs_files || true) 2> log.txt
35+ (ormolu --check-idempotence --mode inplace $hs_files || true) 2> log.txt
3636 '';
3737 inherit doCheck;
3838 checkPhase =
src/Ormolu.hs+2−2
@@ -63,7 +63,7 @@ ormolu cfgWithIndices path str = do
6363 -- to parse the rendered code back, inside of GHC monad wrapper which will
6464 -- lead to error messages presenting the exceptions as GHC bugs.
6565 let !txt = printModule result0
66− when (not (cfgUnsafe cfg) || cfgCheckIdempotency cfg) $ do
66+ when (not (cfgUnsafe cfg) || cfgCheckIdempotence cfg) $ do
6767 let pathRendered = path ++ "<rendered>"
6868 -- Parse the result of pretty-printing again and make sure that AST
6969 -- is the same as AST of original snippet module span positions.
@@ -79,7 +79,7 @@ ormolu cfgWithIndices path str = do
7979 Different ss -> liftIO $ throwIO (OrmoluASTDiffers path ss)
8080 -- Try re-formatting the formatted result to check if we get exactly
8181 -- the same output.
82− when (cfgCheckIdempotency cfg) $
82+ when (cfgCheckIdempotence cfg) $
8383 let txt2 = printModule result1
8484 in case diffText txt txt2 pathRendered of
8585 Nothing -> return ()
src/Ormolu/Config.hs+2−2
@@ -24,7 +24,7 @@ data Config region = Config
2424 -- | Output information useful for debugging
2525 cfgDebug :: !Bool,
2626 -- | Checks if re-formatting the result is idempotent
27− cfgCheckIdempotency :: !Bool,
27+ cfgCheckIdempotence :: !Bool,
2828 -- | Region selection
2929 cfgRegion :: !region
3030 }
@@ -56,7 +56,7 @@ defaultConfig =
5656 { cfgDynOptions = [],
5757 cfgUnsafe = False,
5858 cfgDebug = False,
59− cfgCheckIdempotency = False,
59+ cfgCheckIdempotence = False,
6060 cfgRegion =
6161 RegionIndices
6262 { regionStartLine = Nothing,
tests/Ormolu/PrinterSpec.hs+3−3
@@ -62,7 +62,7 @@ deriveOutput path =
6262-- | A version of 'shouldBe' that is specialized to comparing 'Text' values.
6363-- It also prints multi-line snippets in a more readable form.
6464shouldMatch :: Bool -> Text -> Text -> Expectation
65−shouldMatch idempotencyTest actual expected =
65+shouldMatch idempotenceTest actual expected =
6666 when (actual /= expected) . expectationFailure $
6767 unlines
6868 [ ">>>>>>>>>>>>>>>>>>>>>> expected (" ++ pass ++ "):",
@@ -72,8 +72,8 @@ shouldMatch idempotencyTest actual expected =
7272 ]
7373 where
7474 pass =
75− if idempotencyTest
76− then "idempotency pass"
75+ if idempotenceTest
76+ then "idempotence pass"
7777 else "first pass"
7878
7979examplesDir :: Path Rel Dir