This script finds dependencies between source code modules, treating the .cpp
and .h
file as one unit (so it will detect A.cpp
depending on B.h
where B.cpp
depends on A.h
). This can be used to find out which modules cannot be used independently from each other.
It is very simplistic at this point, and assumes that a .cpp
file’s corresponding header has the exact same name, with .cpp
replaced by .h
. Furthermore, it assumes all #include
s are relative to the src/
directory.
This is not a linter, and is not enforced through Travis or otherwise.
This is the current output:
0$ ../contrib/devtools/circular-dependencies.py {*,*/*,*/*/*}.{h,cpp}
1Circular dependency: chain -> pow -> chain
2Circular dependency: chainparamsbase -> util -> chainparamsbase
3Circular dependency: checkpoints -> validation -> checkpoints
4Circular dependency: init -> index/txindex -> init
5Circular dependency: init -> validation -> init
6Circular dependency: init -> net_processing -> init
7Circular dependency: init -> rpc/server -> init
8Circular dependency: init -> txdb -> init
9Circular dependency: init -> validationinterface -> init
10Circular dependency: random -> util -> random
11Circular dependency: sync -> util -> sync
12Circular dependency: txmempool -> validation -> txmempool
13Circular dependency: txmempool -> policy/fees -> txmempool
14Circular dependency: validation -> index/txindex -> validation
15Circular dependency: validation -> policy/policy -> validation
16Circular dependency: validation -> validationinterface -> validation
17Circular dependency: qt/addresstablemodel -> qt/walletmodel -> qt/addresstablemodel
18Circular dependency: qt/bantablemodel -> qt/clientmodel -> qt/bantablemodel
19Circular dependency: qt/bitcoingui -> qt/walletview -> qt/bitcoingui
20Circular dependency: qt/bitcoingui -> qt/walletframe -> qt/bitcoingui
21Circular dependency: qt/bitcoingui -> qt/utilitydialog -> qt/bitcoingui
22Circular dependency: qt/clientmodel -> qt/peertablemodel -> qt/clientmodel
23Circular dependency: qt/paymentserver -> qt/walletmodel -> qt/paymentserver
24Circular dependency: qt/recentrequeststablemodel -> qt/walletmodel -> qt/recentrequeststablemodel
25Circular dependency: qt/sendcoinsdialog -> qt/walletmodel -> qt/sendcoinsdialog
26Circular dependency: qt/transactiontablemodel -> qt/walletmodel -> qt/transactiontablemodel
27Circular dependency: qt/walletmodel -> qt/walletmodeltransaction -> qt/walletmodel
28Circular dependency: rpc/rawtransaction -> wallet/rpcwallet -> rpc/rawtransaction
29Circular dependency: wallet/coincontrol -> wallet/wallet -> wallet/coincontrol
30Circular dependency: wallet/fees -> wallet/wallet -> wallet/fees
31Circular dependency: wallet/rpcwallet -> wallet/wallet -> wallet/rpcwallet
32Circular dependency: wallet/walletdb -> wallet/wallet -> wallet/walletdb
33Circular dependency: txmempool -> validation -> policy/rbf -> txmempool
34Circular dependency: txmempool -> validation -> validationinterface -> txmempool
35Circular dependency: qt/addressbookpage -> qt/bitcoingui -> qt/walletview -> qt/addressbookpage
36Circular dependency: qt/guiutil -> qt/walletmodel -> qt/optionsmodel -> qt/guiutil
37Circular dependency: qt/addressbookpage -> qt/bitcoingui -> qt/walletview -> qt/signverifymessagedialog -> qt/addressbookpage
38Circular dependency: qt/addressbookpage -> qt/bitcoingui -> qt/walletview -> qt/receivecoinsdialog -> qt/addressbookpage
39Circular dependency: qt/guiutil -> qt/walletmodel -> qt/optionsmodel -> qt/intro -> qt/guiutil
40Circular dependency: qt/addressbookpage -> qt/bitcoingui -> qt/walletview -> qt/sendcoinsdialog -> qt/sendcoinsentry -> qt/addressbookpage