From d330c4910ef787fcc1dd66a15ca1a380bf96dffd Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Fri, 27 Nov 2020 12:40:43 -0800 Subject: [PATCH] check-dupes: rename to check-leafnames, per "How to check for errors" --- CONTRIBUTING.md | 2 +- hledger/CHANGES.md | 4 ++-- hledger/Hledger/Cli/Commands.hs | 10 +++++----- .../{Checkdupes.hs => Checkleafnames.hs} | 18 +++++++++--------- .../{Checkdupes.md => Checkleafnames.md} | 4 ++-- .../{Checkdupes.txt => Checkleafnames.txt} | 0 hledger/hledger.cabal | 6 +++--- hledger/hledger.m4.md | 4 ++-- hledger/package.yaml | 4 ++-- 9 files changed, 26 insertions(+), 26 deletions(-) rename hledger/Hledger/Cli/Commands/{Checkdupes.hs => Checkleafnames.hs} (69%) rename hledger/Hledger/Cli/Commands/{Checkdupes.md => Checkleafnames.md} (70%) rename hledger/Hledger/Cli/Commands/{Checkdupes.txt => Checkleafnames.txt} (100%) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0e25de244..5867223eb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -92,7 +92,7 @@ Syntax: http://www.pandoc.org/MANUAL.html#tables -> pipe_tables | [balancesheet](https://github.com/simonmichael/hledger/issues?q=is:open+label:balancesheet) | [bugs](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+label:balancesheet) ([good first](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+label:%22good+first+issue%22+label:balancesheet)/[easy](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+-label:%22good+first+issue%22+label:easy?+label:balancesheet)/[other](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+-label:%22good+first+issue%22+-label:easy?+label:balancesheet)) | [wishes](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+WISH%22+label:balancesheet) | [PRs](https://github.com/simonmichael/hledger/issues?q=is:open+is:pr+label:balancesheet) | [other](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+-label:%22A+BUG%22+-label:%22A+WISH%22+label:balancesheet) | [cashflow](https://github.com/simonmichael/hledger/issues?q=is:open+label:cashflow) | [bugs](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+label:cashflow) ([good first](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+label:%22good+first+issue%22+label:cashflow)/[easy](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+-label:%22good+first+issue%22+label:easy?+label:cashflow)/[other](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+-label:%22good+first+issue%22+-label:easy?+label:cashflow)) | [wishes](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+WISH%22+label:cashflow) | [PRs](https://github.com/simonmichael/hledger/issues?q=is:open+is:pr+label:cashflow) | [other](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+-label:%22A+BUG%22+-label:%22A+WISH%22+label:cashflow) | [checkdates](https://github.com/simonmichael/hledger/issues?q=is:open+label:checkdates) | [bugs](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+label:checkdates) ([good first](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+label:%22good+first+issue%22+label:checkdates)/[easy](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+-label:%22good+first+issue%22+label:easy?+label:checkdates)/[other](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+-label:%22good+first+issue%22+-label:easy?+label:checkdates)) | [wishes](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+WISH%22+label:checkdates) | [PRs](https://github.com/simonmichael/hledger/issues?q=is:open+is:pr+label:checkdates) | [other](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+-label:%22A+BUG%22+-label:%22A+WISH%22+label:checkdates) -| [checkdupes](https://github.com/simonmichael/hledger/issues?q=is:open+label:checkdupes) | [bugs](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+label:checkdupes) ([good first](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+label:%22good+first+issue%22+label:checkdupes)/[easy](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+-label:%22good+first+issue%22+label:easy?+label:checkdupes)/[other](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+-label:%22good+first+issue%22+-label:easy?+label:checkdupes)) | [wishes](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+WISH%22+label:checkdupes) | [PRs](https://github.com/simonmichael/hledger/issues?q=is:open+is:pr+label:checkdupes) | [other](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+-label:%22A+BUG%22+-label:%22A+WISH%22+label:checkdupes) +| [checkleafnames](https://github.com/simonmichael/hledger/issues?q=is:open+label:checkleafnames) | [bugs](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+label:checkleafnames) ([good first](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+label:%22good+first+issue%22+label:checkleafnames)/[easy](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+-label:%22good+first+issue%22+label:easy?+label:checkleafnames)/[other](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+-label:%22good+first+issue%22+-label:easy?+label:checkleafnames)) | [wishes](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+WISH%22+label:checkleafnames) | [PRs](https://github.com/simonmichael/hledger/issues?q=is:open+is:pr+label:checkleafnames) | [other](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+-label:%22A+BUG%22+-label:%22A+WISH%22+label:checkleafnames) | [close](https://github.com/simonmichael/hledger/issues?q=is:open+label:close) | [bugs](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+label:close) ([good first](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+label:%22good+first+issue%22+label:close)/[easy](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+-label:%22good+first+issue%22+label:easy?+label:close)/[other](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+-label:%22good+first+issue%22+-label:easy?+label:close)) | [wishes](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+WISH%22+label:close) | [PRs](https://github.com/simonmichael/hledger/issues?q=is:open+is:pr+label:close) | [other](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+-label:%22A+BUG%22+-label:%22A+WISH%22+label:close) | [import](https://github.com/simonmichael/hledger/issues?q=is:open+label:import) | [bugs](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+label:import) ([good first](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+label:%22good+first+issue%22+label:import)/[easy](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+-label:%22good+first+issue%22+label:easy?+label:import)/[other](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+-label:%22good+first+issue%22+-label:easy?+label:import)) | [wishes](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+WISH%22+label:import) | [PRs](https://github.com/simonmichael/hledger/issues?q=is:open+is:pr+label:import) | [other](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+-label:%22A+BUG%22+-label:%22A+WISH%22+label:import) | [incomestatement](https://github.com/simonmichael/hledger/issues?q=is:open+label:incomestatement) | [bugs](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+label:incomestatement) ([good first](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+label:%22good+first+issue%22+label:incomestatement)/[easy](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+-label:%22good+first+issue%22+label:easy?+label:incomestatement)/[other](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+BUG%22+-label:%22good+first+issue%22+-label:easy?+label:incomestatement)) | [wishes](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+label:%22A+WISH%22+label:incomestatement) | [PRs](https://github.com/simonmichael/hledger/issues?q=is:open+is:pr+label:incomestatement) | [other](https://github.com/simonmichael/hledger/issues?q=is:open+is:issue+-label:%22A+BUG%22+-label:%22A+WISH%22+label:incomestatement) diff --git a/hledger/CHANGES.md b/hledger/CHANGES.md index 10d89f81d..1e06f4ac8 100644 --- a/hledger/CHANGES.md +++ b/hledger/CHANGES.md @@ -1268,7 +1268,7 @@ Migration notes: - new tags command: lists tags in matched transactions - most addons formerly shipped in bin/ are now builtin commands. These - include: check-dates, check-dupes, equity, prices, print-unique, + include: check-dates, check-leafnames, equity, prices, print-unique, register-match, rewrite. - refactor: new Commands module and subdirectory. @@ -1385,7 +1385,7 @@ New addons added/included: - budget - experimental budget reporting command supporting Ledger-like periodic transactions and automated transactions (Mykola Orliuk) - chart - pie-chart-generating prototype, a repackaging of the old hledger-chart tool - check - more powerful balance assertions (Michael Walker) -- check-dupes - find accounts sharing the same leaf name (Stefano Rodighiero) +- check-leafnames - find accounts sharing the same leaf name (Stefano Rodighiero) - prices - show all market price records (Mykola Orliuk) - register-match - a helper for ledger-autosync's deduplication, finds best match for a transaction description diff --git a/hledger/Hledger/Cli/Commands.hs b/hledger/Hledger/Cli/Commands.hs index 73d25eadd..25153bf91 100644 --- a/hledger/Hledger/Cli/Commands.hs +++ b/hledger/Hledger/Cli/Commands.hs @@ -26,7 +26,7 @@ module Hledger.Cli.Commands ( ,module Hledger.Cli.Commands.Balancesheetequity ,module Hledger.Cli.Commands.Cashflow ,module Hledger.Cli.Commands.Checkdates - ,module Hledger.Cli.Commands.Checkdupes + ,module Hledger.Cli.Commands.Checkleafnames ,module Hledger.Cli.Commands.Close ,module Hledger.Cli.Commands.Codes ,module Hledger.Cli.Commands.Commodities @@ -73,7 +73,7 @@ import Hledger.Cli.Commands.Balancesheet import Hledger.Cli.Commands.Balancesheetequity import Hledger.Cli.Commands.Cashflow import Hledger.Cli.Commands.Checkdates -import Hledger.Cli.Commands.Checkdupes +import Hledger.Cli.Commands.Checkleafnames import Hledger.Cli.Commands.Close import Hledger.Cli.Commands.Codes import Hledger.Cli.Commands.Commodities @@ -110,11 +110,11 @@ builtinCommands = [ ,(balancesheetmode , balancesheet) ,(cashflowmode , cashflow) ,(checkdatesmode , checkdates) - ,(checkdupesmode , checkdupes) + ,(checkleafnamesmode , checkleafnames) ,(closemode , close) ,(codesmode , codes) ,(commoditiesmode , commodities) - ,(descriptionsmode , descriptions) + ,(descriptionsmode , descriptions) ,(diffmode , diff) ,(filesmode , files) ,(helpmode , help') @@ -168,7 +168,7 @@ commandsList progversion othercmds = [ ,"+autosync download/deduplicate/convert OFX data" ,"+check check more powerful balance assertions" ," check-dates check transactions are ordered by date" - ," check-dupes check for accounts with the same leaf name" + ," check-leafnames check for accounts with the same leaf name" ," close (equity) generate balance-resetting transactions" ," diff compare account transactions in two journal files" ,"+interest generate interest transactions" diff --git a/hledger/Hledger/Cli/Commands/Checkdupes.hs b/hledger/Hledger/Cli/Commands/Checkleafnames.hs similarity index 69% rename from hledger/Hledger/Cli/Commands/Checkdupes.hs rename to hledger/Hledger/Cli/Commands/Checkleafnames.hs index 5a9467b47..48884a868 100755 --- a/hledger/Hledger/Cli/Commands/Checkdupes.hs +++ b/hledger/Hledger/Cli/Commands/Checkleafnames.hs @@ -1,8 +1,8 @@ {-# LANGUAGE TemplateHaskell #-} -module Hledger.Cli.Commands.Checkdupes ( - checkdupesmode - ,checkdupes +module Hledger.Cli.Commands.Checkleafnames ( + checkleafnamesmode + ,checkleafnames ) where @@ -15,15 +15,15 @@ import Hledger.Cli.CliOptions import System.Console.CmdArgs.Explicit import Text.Printf -checkdupesmode :: Mode RawOpts -checkdupesmode = hledgerCommandMode - $(embedFileRelative "Hledger/Cli/Commands/Checkdupes.txt") +checkleafnamesmode :: Mode RawOpts +checkleafnamesmode = hledgerCommandMode + $(embedFileRelative "Hledger/Cli/Commands/Checkleafnames.txt") [] [generalflagsgroup1] hiddenflags ([], Nothing) -checkdupes _opts j = mapM_ render $ checkdupes' $ accountsNames j +checkleafnames _opts j = mapM_ render $ checkleafnames' $ accountsNames j accountsNames :: Journal -> [(String, AccountName)] accountsNames j = map leafAndAccountName as @@ -31,8 +31,8 @@ accountsNames j = map leafAndAccountName as ps = journalPostings j as = nubSort $ map paccount ps -checkdupes' :: (Ord k, Eq k) => [(k, v)] -> [(k, [v])] -checkdupes' l = zip dupLeafs dupAccountNames +checkleafnames' :: (Ord k, Eq k) => [(k, v)] -> [(k, [v])] +checkleafnames' l = zip dupLeafs dupAccountNames where dupLeafs = map (fst . head) d dupAccountNames = map (map snd) d d = dupes' l diff --git a/hledger/Hledger/Cli/Commands/Checkdupes.md b/hledger/Hledger/Cli/Commands/Checkleafnames.md similarity index 70% rename from hledger/Hledger/Cli/Commands/Checkdupes.md rename to hledger/Hledger/Cli/Commands/Checkleafnames.md index c785a9ccf..6b72b7465 100644 --- a/hledger/Hledger/Cli/Commands/Checkdupes.md +++ b/hledger/Hledger/Cli/Commands/Checkleafnames.md @@ -1,8 +1,8 @@ -check-dupes\ +check-leafnames\ Reports account names having the same leaf but different prefixes. In other words, two or more leaves that are categorized differently. Reads the default journal file, or another specified as an argument. _FLAGS -An example: +An example: diff --git a/hledger/Hledger/Cli/Commands/Checkdupes.txt b/hledger/Hledger/Cli/Commands/Checkleafnames.txt similarity index 100% rename from hledger/Hledger/Cli/Commands/Checkdupes.txt rename to hledger/Hledger/Cli/Commands/Checkleafnames.txt diff --git a/hledger/hledger.cabal b/hledger/hledger.cabal index 8cc38b417..c22518278 100644 --- a/hledger/hledger.cabal +++ b/hledger/hledger.cabal @@ -4,7 +4,7 @@ cabal-version: 1.12 -- -- see: https://github.com/sol/hpack -- --- hash: 4517e1a53a08aa05c53bb06d8591b5591f3ae6f688bf39f809c8f774fbd1d41c +-- hash: a72cc42826939244f2ed9ce667f947ba98a85ac38914cf605de7413ade202776 name: hledger version: 1.19.99 @@ -67,7 +67,7 @@ extra-source-files: Hledger/Cli/Commands/Balancesheetequity.txt Hledger/Cli/Commands/Cashflow.txt Hledger/Cli/Commands/Checkdates.txt - Hledger/Cli/Commands/Checkdupes.txt + Hledger/Cli/Commands/Checkleafnames.txt Hledger/Cli/Commands/Close.txt Hledger/Cli/Commands/Codes.txt Hledger/Cli/Commands/Commodities.txt @@ -123,7 +123,7 @@ library Hledger.Cli.Commands.Balancesheetequity Hledger.Cli.Commands.Cashflow Hledger.Cli.Commands.Checkdates - Hledger.Cli.Commands.Checkdupes + Hledger.Cli.Commands.Checkleafnames Hledger.Cli.Commands.Close Hledger.Cli.Commands.Codes Hledger.Cli.Commands.Commodities diff --git a/hledger/hledger.m4.md b/hledger/hledger.m4.md index bd5821f7c..457f3273c 100644 --- a/hledger/hledger.m4.md +++ b/hledger/hledger.m4.md @@ -1620,9 +1620,9 @@ _include_({{Hledger/Cli/Commands/Cashflow.md}}) _include_({{Hledger/Cli/Commands/Checkdates.md}}) -## check-dupes +## check-leafnames -_include_({{Hledger/Cli/Commands/Checkdupes.md}}) +_include_({{Hledger/Cli/Commands/Checkleafnames.md}}) ## close diff --git a/hledger/package.yaml b/hledger/package.yaml index 457b4a415..dec9be0ab 100644 --- a/hledger/package.yaml +++ b/hledger/package.yaml @@ -61,7 +61,7 @@ extra-source-files: - Hledger/Cli/Commands/Balancesheetequity.txt - Hledger/Cli/Commands/Cashflow.txt - Hledger/Cli/Commands/Checkdates.txt -- Hledger/Cli/Commands/Checkdupes.txt +- Hledger/Cli/Commands/Checkleafnames.txt - Hledger/Cli/Commands/Close.txt - Hledger/Cli/Commands/Codes.txt - Hledger/Cli/Commands/Commodities.txt @@ -169,7 +169,7 @@ library: - Hledger.Cli.Commands.Balancesheetequity - Hledger.Cli.Commands.Cashflow - Hledger.Cli.Commands.Checkdates - - Hledger.Cli.Commands.Checkdupes + - Hledger.Cli.Commands.Checkleafnames - Hledger.Cli.Commands.Close - Hledger.Cli.Commands.Codes - Hledger.Cli.Commands.Commodities