diff --git a/.arclint b/.arclint --- a/.arclint +++ b/.arclint @@ -239,14 +239,6 @@ "(^src/bench/nanobench.h$)" ] }, - "lint-cppcheck": { - "type": "lint-cppcheck", - "include": "(^src/.*\\.(h|c|cpp)$)", - "exclude": [ - "(^src/(crypto/ctaes|secp256k1|univalue|leveldb)/)", - "(^src/bench/nanobench.h$)" - ] - }, "yamllint": { "type": "yamllint", "include": "(\\.(yml|yaml)$)", diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -135,7 +135,7 @@ On Ubuntu 20.04: ``` -sudo apt-get install clang-format clang-tidy clang-tools cppcheck python3-isort python3-autopep8 flake8 php-codesniffer yamllint +sudo apt-get install clang-format clang-tidy clang-tools python3-isort python3-autopep8 flake8 php-codesniffer yamllint ``` If not available in the distribution, `clang-format-10` and `clang-tidy` can be diff --git a/arcanist/.phutil_module_cache b/arcanist/.phutil_module_cache --- a/arcanist/.phutil_module_cache +++ b/arcanist/.phutil_module_cache @@ -1 +1 @@ -{"__symbol_cache_version__":11,"ae5b7d3d6b8cf9598ce4abaf0cd56b21":{"have":{"class":{"ExtendedConfigurationDrivenLintEngine":19}},"need":{"function":{"newv":159,"pht":933},"class":{"ArcanistLintEngine":65,"ArcanistConfigurationDrivenLintEngine":171,"PhutilConsole":866},"class\/interface":{"ILintOnce":634}},"xmap":{"ExtendedConfigurationDrivenLintEngine":["ArcanistLintEngine"]}},"9780c82e3cf1cde0c46662563f00444f":{"have":{"class":{"ArcanistBitcoinABCConfiguration":13}},"need":{"function":{"pht":242},"class":{"ArcanistConfiguration":53,"ArcanistLintWorkflow":1652},"class\/interface":{"ArcanistWorkflow":385,"ArcanistNoEffectException":1371}},"xmap":{"ArcanistBitcoinABCConfiguration":["ArcanistConfiguration"]}},"90a8b110dc475955f15bb81d37268cb5":{"have":{"class":{"AutoPEP8FormatLinter":75}},"need":{"function":{"pht":297,"execx":769,"id":1903},"class":{"ArcanistExternalLinter":104,"ArcanistLintMessage":1910,"Filesystem":1754,"ArcanistLinter":2017,"ArcanistLintSeverity":2095}},"xmap":{"AutoPEP8FormatLinter":["ArcanistExternalLinter"]}},"729e2f379c278258d8040e156ba9da29":{"have":{"class":{"ShellLocaleLinter":107}},"need":{"function":{"pht":382},"class":{"ArcanistLinter":133,"ArcanistLintSeverity":734,"Filesystem":1044}},"xmap":{"ShellLocaleLinter":["ArcanistLinter"]}},"fbb3938ab9b412d7505335d9f7ed183d":{"have":{"class":{"ShellCheckLinter":95}},"need":{"function":{"pht":921,"execx":1443,"id":2414},"class":{"ArcanistExternalLinter":120,"ArcanistLintMessage":2421,"ArcanistLintSeverity":646,"ArcanistLinter":2469}},"xmap":{"ShellCheckLinter":["ArcanistExternalLinter"]}},"d792b114a2a4d16e2137dd237483ce42":{"have":{"class":{"PythonMutableDefaultLinter":155}},"need":{"function":{"pht":377},"class":{"ArcanistLinter":190,"ArcanistLintSeverity":740,"Filesystem":1030}},"xmap":{"PythonMutableDefaultLinter":["ArcanistLinter"]}},"cfe5966affc66e3444c34bf55a119446":{"have":{"function":{"startsWith":16},"class":{"MarkdownLinter":171}},"need":{"function":{"pht":361},"class":{"ArcanistLinter":194,"ArcanistLintSeverity":652,"Filesystem":1571}},"xmap":{"MarkdownLinter":["ArcanistLinter"]}},"f151089cf79fdb8257b2272ed4782d88":{"have":{"class":{"IncludeSourceLinter":99}},"need":{"function":{"pht":391},"class":{"ArcanistLinter":127,"ArcanistLintSeverity":699,"Filesystem":938}},"xmap":{"IncludeSourceLinter":["ArcanistLinter"]}},"b4005bc083930dd85220bffb4c5f8bdd":{"have":{"class":{"PythonFileEncodingLinter":111}},"need":{"function":{"pht":321},"class":{"ArcanistLinter":144,"ArcanistLintSeverity":685,"Filesystem":990}},"xmap":{"PythonFileEncodingLinter":["ArcanistLinter"]}},"146347e1ef63e514a6634ada8de5b5c9":{"have":{"class":{"Qt5Linter":70}},"need":{"function":{"pht":258},"class":{"ArcanistLinter":88,"ArcanistLintSeverity":609,"Filesystem":836}},"xmap":{"Qt5Linter":["ArcanistLinter"]}},"ab6085aa9abe6394d7f8ceffe6554c50":{"have":{"class":{"WhitespaceLinter":59}},"need":{"function":{"pht":258},"class":{"ArcanistLinter":84,"ArcanistLintSeverity":545,"Filesystem":948}},"xmap":{"WhitespaceLinter":["ArcanistLinter"]}},"5ea58c19df0397ed8ee0f463d90d6c72":{"have":{"class":{"BoostDependenciesLinter":145}},"need":{"function":{"pht":330,"id":1440},"class":{"GlobalExternalLinter":177,"ArcanistLintMessage":1447,"Filesystem":609,"ArcanistLinter":1524,"ArcanistLintSeverity":1624}},"xmap":{"BoostDependenciesLinter":["GlobalExternalLinter"]}},"2809b09d2021203b43c57da33d1fe8bf":{"have":{"class":{"AssertWithSideEffectsLinter":210}},"need":{"function":{"pht":439},"class":{"ArcanistLinter":246,"ArcanistLintSeverity":926,"Filesystem":1170}},"xmap":{"AssertWithSideEffectsLinter":["ArcanistLinter"]}},"38f0c676bff5192a344464142caaa253":{"have":{"class":{"CHeaderLinter":99}},"need":{"function":{"pht":611},"class":{"ArcanistLinter":121,"ArcanistLintSeverity":1060,"Filesystem":1307}},"xmap":{"CHeaderLinter":["ArcanistLinter"]}},"e6c7c36001803d09d667e83285bd04e7":{"have":{"class":{"YamllintLinter":77}},"need":{"function":{"pht":399,"execx":907,"id":1711},"class":{"ArcanistExternalLinter":100,"ArcanistLintMessage":1718,"ArcanistLintSeverity":184,"ArcanistLinter":1766}},"xmap":{"YamllintLinter":["ArcanistExternalLinter"]}},"6f2f22dd0f259fb2eaa284b4fab3bc29":{"have":{"class":{"PythonFormatLinter":123}},"need":{"function":{"pht":353,"id":1838},"class":{"ArcanistExternalLinter":150,"ArcanistLintMessage":1845,"Filesystem":776,"ArcanistLinter":1970,"ArcanistLintSeverity":2053}},"xmap":{"PythonFormatLinter":["ArcanistExternalLinter"]}},"9285ad9415f8ebe564f7119e5a72c559":{"have":{"class":{"FormatStringLinter":146}},"need":{"function":{"pht":377,"csprintf":1492,"id":1872},"class":{"ArcanistExternalLinter":173,"ArcanistLintMessage":1879,"Filesystem":827,"ArcanistLinter":1956,"ArcanistLintSeverity":2044}},"xmap":{"FormatStringLinter":["ArcanistExternalLinter"]}},"9bb48ec0fe2e9ced8e27d42540d0571c":{"have":{"class":{"CheckDocLinter":106}},"need":{"function":{"pht":321,"id":1845},"class":{"GlobalExternalLinter":129,"ArcanistLintMessage":1852,"Filesystem":729,"ArcanistLinter":1900,"ArcanistLintSeverity":1986}},"xmap":{"CheckDocLinter":["GlobalExternalLinter"]}},"09b7af4806790af70a69ee97158e6112":{"have":{"class":{"CheckNonFatalOverAssertInRpc":268}},"need":{"function":{"pht":582},"class":{"ArcanistLinter":305,"ArcanistLintSeverity":863,"Filesystem":1144}},"xmap":{"CheckNonFatalOverAssertInRpc":["ArcanistLinter"]}},"2cbb6e7228d81557f777ad648704f343":{"have":{"class":{"IncludeQuotesLinter":100}},"need":{"function":{"pht":306},"class":{"ArcanistLinter":128,"ArcanistLintSeverity":663,"Filesystem":964}},"xmap":{"IncludeQuotesLinter":["ArcanistLinter"]}},"04d01863b9bf57f467af4808b397e584":{"have":{"class":{"MyPyLinter":88}},"need":{"function":{"pht":243,"execx":758,"id":1303},"class":{"ArcanistExternalLinter":107,"ArcanistLintMessage":1310,"ArcanistLinter":1358,"ArcanistLintSeverity":1464}},"xmap":{"MyPyLinter":["ArcanistExternalLinter"]}},"2f99c841a569f2029d13ea030dee007c":{"have":{"class":{"TestsLinter":103}},"need":{"function":{"pht":318,"id":2638},"class":{"ArcanistExternalLinter":123,"ArcanistLintMessage":2645,"Filesystem":776,"ArcanistLinter":2693,"ArcanistLintSeverity":2801}},"xmap":{"TestsLinter":["ArcanistExternalLinter"]}},"5b9143afa84a8b098359597987dcddfe":{"have":{"class":{"CppCheckLinter":92}},"need":{"function":{"pht":7401,"execx":7761},"class":{"ArcanistExternalLinter":115,"ArcanistLintMessage":10229,"Filesystem":9351,"ArcanistLintSeverity":10538}},"xmap":{"CppCheckLinter":["ArcanistExternalLinter"]}},"85936cbfc0decd1aae05001717b359da":{"have":{"class":{"LogLinter":116}},"need":{"function":{"pht":297},"class":{"ArcanistLinter":134,"ArcanistLintSeverity":580,"Filesystem":875}},"xmap":{"LogLinter":["ArcanistLinter"]}},"3e6f662aafff47b2f59242e1823e3b14":{"have":{"class":{"LocaleDependenceLinter":1741}},"need":{"function":{"pht":7202},"class":{"ArcanistLinter":1772,"ArcanistLintSeverity":7705,"Filesystem":7951}},"xmap":{"LocaleDependenceLinter":["ArcanistLinter"]}},"2e11dd9ad67e594f863bc46ac59ea37e":{"have":{"class":{"GlobalExternalLinter":199}},"need":{"class":{"ArcanistExternalLinter":228},"interface":{"ILintOnce":262}},"xmap":{"GlobalExternalLinter":["ArcanistExternalLinter","ILintOnce"]}},"1dacb6d661b7ea83e6b1980c3c4f602d":{"have":{"class":{"StdintLinter":90}},"need":{"function":{"pht":567},"class":{"ArcanistLinter":111,"ArcanistLintSeverity":876,"Filesystem":1401}},"xmap":{"StdintLinter":["ArcanistLinter"]}},"3a184a47bce0d3fbf7dad76c6f755df5":{"have":{"class":{"PrettierLinter":76}},"need":{"function":{"pht":311,"execx":758,"id":1196},"class":{"ArcanistExternalLinter":99,"ArcanistLintMessage":1203,"Filesystem":1118,"ArcanistLinter":1276,"ArcanistLintSeverity":1362}},"xmap":{"PrettierLinter":["ArcanistExternalLinter"]}},"4584b1b007576d47eeff9504b80c4a77":{"have":{"class":{"ClangFormatLinter":79}},"need":{"function":{"pht":302,"execx":781,"id":2251},"class":{"ArcanistExternalLinter":105,"ArcanistLintMessage":2258,"Filesystem":2102,"ArcanistLinter":2365,"ArcanistLintSeverity":2443}},"xmap":{"ClangFormatLinter":["ArcanistExternalLinter"]}},"4c4adcac26dddfa5e350b85a40097755":{"have":{"class":{"BashShebangLinter":82}},"need":{"function":{"pht":281},"class":{"ArcanistLinter":108,"ArcanistLintSeverity":597,"Filesystem":837}},"xmap":{"BashShebangLinter":["ArcanistLinter"]}},"39694cf756ce58681ea84a028f3e007f":{"have":{"class":{"IncludeGuardLinter":98}},"need":{"function":{"pht":443},"class":{"ArcanistLinter":125,"ArcanistLintSeverity":796,"Filesystem":1162}},"xmap":{"IncludeGuardLinter":["ArcanistLinter"]}},"df78f1ac61b2f0f7cd5bd3cf434ce6e3":{"have":{"class":{"CppVoidParameterLinter":119}},"need":{"function":{"pht":392},"class":{"ArcanistLinter":150,"ArcanistLintSeverity":707,"Filesystem":1164}},"xmap":{"CppVoidParameterLinter":["ArcanistLinter"]}},"c073131f5baad372e3037328d2e71c0e":{"have":{"class":{"ISortFormatLinter":72}},"need":{"function":{"pht":318,"id":1597},"class":{"ArcanistExternalLinter":98,"ArcanistLintMessage":1604,"Filesystem":1448,"ArcanistLinter":1711,"ArcanistLintSeverity":1790}},"xmap":{"ISortFormatLinter":["ArcanistExternalLinter"]}},"3cd6909c95569e2564deabbd1ec38bbb":{"have":{"class":{"FileNameLinter":103}},"need":{"function":{"pht":382},"class":{"ArcanistLinter":126,"ArcanistLintSeverity":737,"Filesystem":1160}},"xmap":{"FileNameLinter":["ArcanistLinter"]}},"b2403124ec3e8be6cb4d10bf0f6c4134":{"have":{"interface":{"ILintOnce":69}},"need":[],"xmap":[]},"454160ed72e88797129d84ee589de304":{"have":{"class":{"PythonShebangLinter":87}},"need":{"function":{"pht":290},"class":{"ArcanistLinter":115,"ArcanistLintSeverity":614,"Filesystem":854}},"xmap":{"PythonShebangLinter":["ArcanistLinter"]}},"e4678dca551a849892aff414d3c4e24e":{"have":{"class":{"DoxygenLinter":91}},"need":{"function":{"pht":382},"class":{"ArcanistLinter":113,"ArcanistLintSeverity":695,"Filesystem":943}},"xmap":{"DoxygenLinter":["ArcanistLinter"]}},"e6886ead74de6310f1cbc0d589d8f5b0":{"have":{"class":{"ArcanistLandBotWorkflow":91}},"need":{"function":{"phutil_console_format":265,"pht":1577,"execx":2181},"class":{"ArcanistWorkflow":123,"ArcanistUsageException":2251}},"xmap":{"ArcanistLandBotWorkflow":["ArcanistWorkflow"]}}} \ No newline at end of file +{"__symbol_cache_version__":11,"e6886ead74de6310f1cbc0d589d8f5b0":{"have":{"class":{"ArcanistLandBotWorkflow":91}},"need":{"function":{"phutil_console_format":265,"pht":1577,"execx":2181},"class":{"ArcanistWorkflow":123,"ArcanistUsageException":2251}},"xmap":{"ArcanistLandBotWorkflow":["ArcanistWorkflow"]}},"ae5b7d3d6b8cf9598ce4abaf0cd56b21":{"have":{"class":{"ExtendedConfigurationDrivenLintEngine":19}},"need":{"function":{"newv":159,"pht":933},"class":{"ArcanistLintEngine":65,"ArcanistConfigurationDrivenLintEngine":171,"PhutilConsole":866},"class\/interface":{"ILintOnce":634}},"xmap":{"ExtendedConfigurationDrivenLintEngine":["ArcanistLintEngine"]}},"90a8b110dc475955f15bb81d37268cb5":{"have":{"class":{"AutoPEP8FormatLinter":75}},"need":{"function":{"pht":297,"execx":769,"id":1903},"class":{"ArcanistExternalLinter":104,"ArcanistLintMessage":1910,"Filesystem":1754,"ArcanistLinter":2017,"ArcanistLintSeverity":2095}},"xmap":{"AutoPEP8FormatLinter":["ArcanistExternalLinter"]}},"5ea58c19df0397ed8ee0f463d90d6c72":{"have":{"class":{"BoostDependenciesLinter":145}},"need":{"function":{"pht":330,"id":1440},"class":{"GlobalExternalLinter":177,"ArcanistLintMessage":1447,"Filesystem":609,"ArcanistLinter":1524,"ArcanistLintSeverity":1624}},"xmap":{"BoostDependenciesLinter":["GlobalExternalLinter"]}},"ab6085aa9abe6394d7f8ceffe6554c50":{"have":{"class":{"WhitespaceLinter":59}},"need":{"function":{"pht":258},"class":{"ArcanistLinter":84,"ArcanistLintSeverity":545,"Filesystem":948}},"xmap":{"WhitespaceLinter":["ArcanistLinter"]}},"6f2f22dd0f259fb2eaa284b4fab3bc29":{"have":{"class":{"PythonFormatLinter":123}},"need":{"function":{"pht":353,"id":1838},"class":{"ArcanistExternalLinter":150,"ArcanistLintMessage":1845,"Filesystem":776,"ArcanistLinter":1970,"ArcanistLintSeverity":2053}},"xmap":{"PythonFormatLinter":["ArcanistExternalLinter"]}},"e4678dca551a849892aff414d3c4e24e":{"have":{"class":{"DoxygenLinter":91}},"need":{"function":{"pht":382},"class":{"ArcanistLinter":113,"ArcanistLintSeverity":695,"Filesystem":943}},"xmap":{"DoxygenLinter":["ArcanistLinter"]}},"4c4adcac26dddfa5e350b85a40097755":{"have":{"class":{"BashShebangLinter":82}},"need":{"function":{"pht":281},"class":{"ArcanistLinter":108,"ArcanistLintSeverity":597,"Filesystem":837}},"xmap":{"BashShebangLinter":["ArcanistLinter"]}},"f151089cf79fdb8257b2272ed4782d88":{"have":{"class":{"IncludeSourceLinter":99}},"need":{"function":{"pht":391},"class":{"ArcanistLinter":127,"ArcanistLintSeverity":699,"Filesystem":938}},"xmap":{"IncludeSourceLinter":["ArcanistLinter"]}},"b2403124ec3e8be6cb4d10bf0f6c4134":{"have":{"interface":{"ILintOnce":69}},"need":[],"xmap":[]},"9285ad9415f8ebe564f7119e5a72c559":{"have":{"class":{"FormatStringLinter":146}},"need":{"function":{"pht":377,"csprintf":1492,"id":1872},"class":{"ArcanistExternalLinter":173,"ArcanistLintMessage":1879,"Filesystem":827,"ArcanistLinter":1956,"ArcanistLintSeverity":2044}},"xmap":{"FormatStringLinter":["ArcanistExternalLinter"]}},"04d01863b9bf57f467af4808b397e584":{"have":{"class":{"MyPyLinter":88}},"need":{"function":{"pht":243,"execx":758,"id":1303},"class":{"ArcanistExternalLinter":107,"ArcanistLintMessage":1310,"ArcanistLinter":1358,"ArcanistLintSeverity":1464}},"xmap":{"MyPyLinter":["ArcanistExternalLinter"]}},"09b7af4806790af70a69ee97158e6112":{"have":{"class":{"CheckNonFatalOverAssertInRpc":268}},"need":{"function":{"pht":582},"class":{"ArcanistLinter":305,"ArcanistLintSeverity":863,"Filesystem":1144}},"xmap":{"CheckNonFatalOverAssertInRpc":["ArcanistLinter"]}},"85936cbfc0decd1aae05001717b359da":{"have":{"class":{"LogLinter":116}},"need":{"function":{"pht":297},"class":{"ArcanistLinter":134,"ArcanistLintSeverity":580,"Filesystem":875}},"xmap":{"LogLinter":["ArcanistLinter"]}},"729e2f379c278258d8040e156ba9da29":{"have":{"class":{"ShellLocaleLinter":107}},"need":{"function":{"pht":382},"class":{"ArcanistLinter":133,"ArcanistLintSeverity":734,"Filesystem":1044}},"xmap":{"ShellLocaleLinter":["ArcanistLinter"]}},"1dacb6d661b7ea83e6b1980c3c4f602d":{"have":{"class":{"StdintLinter":90}},"need":{"function":{"pht":567},"class":{"ArcanistLinter":111,"ArcanistLintSeverity":876,"Filesystem":1401}},"xmap":{"StdintLinter":["ArcanistLinter"]}},"2cbb6e7228d81557f777ad648704f343":{"have":{"class":{"IncludeQuotesLinter":100}},"need":{"function":{"pht":306},"class":{"ArcanistLinter":128,"ArcanistLintSeverity":663,"Filesystem":964}},"xmap":{"IncludeQuotesLinter":["ArcanistLinter"]}},"38f0c676bff5192a344464142caaa253":{"have":{"class":{"CHeaderLinter":99}},"need":{"function":{"pht":611},"class":{"ArcanistLinter":121,"ArcanistLintSeverity":1060,"Filesystem":1307}},"xmap":{"CHeaderLinter":["ArcanistLinter"]}},"d792b114a2a4d16e2137dd237483ce42":{"have":{"class":{"PythonMutableDefaultLinter":155}},"need":{"function":{"pht":377},"class":{"ArcanistLinter":190,"ArcanistLintSeverity":740,"Filesystem":1030}},"xmap":{"PythonMutableDefaultLinter":["ArcanistLinter"]}},"3cd6909c95569e2564deabbd1ec38bbb":{"have":{"class":{"FileNameLinter":103}},"need":{"function":{"pht":382},"class":{"ArcanistLinter":126,"ArcanistLintSeverity":737,"Filesystem":1160}},"xmap":{"FileNameLinter":["ArcanistLinter"]}},"2e11dd9ad67e594f863bc46ac59ea37e":{"have":{"class":{"GlobalExternalLinter":199}},"need":{"class":{"ArcanistExternalLinter":228},"interface":{"ILintOnce":262}},"xmap":{"GlobalExternalLinter":["ArcanistExternalLinter","ILintOnce"]}},"146347e1ef63e514a6634ada8de5b5c9":{"have":{"class":{"Qt5Linter":70}},"need":{"function":{"pht":258},"class":{"ArcanistLinter":88,"ArcanistLintSeverity":609,"Filesystem":836}},"xmap":{"Qt5Linter":["ArcanistLinter"]}},"2f99c841a569f2029d13ea030dee007c":{"have":{"class":{"TestsLinter":103}},"need":{"function":{"pht":318,"id":2638},"class":{"ArcanistExternalLinter":123,"ArcanistLintMessage":2645,"Filesystem":776,"ArcanistLinter":2693,"ArcanistLintSeverity":2801}},"xmap":{"TestsLinter":["ArcanistExternalLinter"]}},"4584b1b007576d47eeff9504b80c4a77":{"have":{"class":{"ClangFormatLinter":79}},"need":{"function":{"pht":302,"execx":781,"id":2251},"class":{"ArcanistExternalLinter":105,"ArcanistLintMessage":2258,"Filesystem":2102,"ArcanistLinter":2365,"ArcanistLintSeverity":2443}},"xmap":{"ClangFormatLinter":["ArcanistExternalLinter"]}},"fbb3938ab9b412d7505335d9f7ed183d":{"have":{"class":{"ShellCheckLinter":95}},"need":{"function":{"pht":921,"execx":1443,"id":2414},"class":{"ArcanistExternalLinter":120,"ArcanistLintMessage":2421,"ArcanistLintSeverity":646,"ArcanistLinter":2469}},"xmap":{"ShellCheckLinter":["ArcanistExternalLinter"]}},"e6c7c36001803d09d667e83285bd04e7":{"have":{"class":{"YamllintLinter":77}},"need":{"function":{"pht":399,"execx":907,"id":1711},"class":{"ArcanistExternalLinter":100,"ArcanistLintMessage":1718,"ArcanistLintSeverity":184,"ArcanistLinter":1766}},"xmap":{"YamllintLinter":["ArcanistExternalLinter"]}},"39694cf756ce58681ea84a028f3e007f":{"have":{"class":{"IncludeGuardLinter":98}},"need":{"function":{"pht":443},"class":{"ArcanistLinter":125,"ArcanistLintSeverity":796,"Filesystem":1162}},"xmap":{"IncludeGuardLinter":["ArcanistLinter"]}},"cfe5966affc66e3444c34bf55a119446":{"have":{"function":{"startsWith":16},"class":{"MarkdownLinter":171}},"need":{"function":{"pht":361},"class":{"ArcanistLinter":194,"ArcanistLintSeverity":652,"Filesystem":1571}},"xmap":{"MarkdownLinter":["ArcanistLinter"]}},"df78f1ac61b2f0f7cd5bd3cf434ce6e3":{"have":{"class":{"CppVoidParameterLinter":119}},"need":{"function":{"pht":392},"class":{"ArcanistLinter":150,"ArcanistLintSeverity":707,"Filesystem":1164}},"xmap":{"CppVoidParameterLinter":["ArcanistLinter"]}},"454160ed72e88797129d84ee589de304":{"have":{"class":{"PythonShebangLinter":87}},"need":{"function":{"pht":290},"class":{"ArcanistLinter":115,"ArcanistLintSeverity":614,"Filesystem":854}},"xmap":{"PythonShebangLinter":["ArcanistLinter"]}},"3a184a47bce0d3fbf7dad76c6f755df5":{"have":{"class":{"PrettierLinter":76}},"need":{"function":{"pht":311,"execx":758,"id":1196},"class":{"ArcanistExternalLinter":99,"ArcanistLintMessage":1203,"Filesystem":1118,"ArcanistLinter":1276,"ArcanistLintSeverity":1362}},"xmap":{"PrettierLinter":["ArcanistExternalLinter"]}},"9bb48ec0fe2e9ced8e27d42540d0571c":{"have":{"class":{"CheckDocLinter":106}},"need":{"function":{"pht":321,"id":1845},"class":{"GlobalExternalLinter":129,"ArcanistLintMessage":1852,"Filesystem":729,"ArcanistLinter":1900,"ArcanistLintSeverity":1986}},"xmap":{"CheckDocLinter":["GlobalExternalLinter"]}},"c073131f5baad372e3037328d2e71c0e":{"have":{"class":{"ISortFormatLinter":72}},"need":{"function":{"pht":318,"id":1597},"class":{"ArcanistExternalLinter":98,"ArcanistLintMessage":1604,"Filesystem":1448,"ArcanistLinter":1711,"ArcanistLintSeverity":1790}},"xmap":{"ISortFormatLinter":["ArcanistExternalLinter"]}},"b4005bc083930dd85220bffb4c5f8bdd":{"have":{"class":{"PythonFileEncodingLinter":111}},"need":{"function":{"pht":321},"class":{"ArcanistLinter":144,"ArcanistLintSeverity":685,"Filesystem":990}},"xmap":{"PythonFileEncodingLinter":["ArcanistLinter"]}},"3e6f662aafff47b2f59242e1823e3b14":{"have":{"class":{"LocaleDependenceLinter":1741}},"need":{"function":{"pht":7202},"class":{"ArcanistLinter":1772,"ArcanistLintSeverity":7705,"Filesystem":7951}},"xmap":{"LocaleDependenceLinter":["ArcanistLinter"]}},"2809b09d2021203b43c57da33d1fe8bf":{"have":{"class":{"AssertWithSideEffectsLinter":210}},"need":{"function":{"pht":439},"class":{"ArcanistLinter":246,"ArcanistLintSeverity":926,"Filesystem":1170}},"xmap":{"AssertWithSideEffectsLinter":["ArcanistLinter"]}},"9780c82e3cf1cde0c46662563f00444f":{"have":{"class":{"ArcanistBitcoinABCConfiguration":13}},"need":{"function":{"pht":242},"class":{"ArcanistConfiguration":53,"ArcanistLintWorkflow":1652},"class\/interface":{"ArcanistWorkflow":385,"ArcanistNoEffectException":1371}},"xmap":{"ArcanistBitcoinABCConfiguration":["ArcanistConfiguration"]}}} \ No newline at end of file diff --git a/arcanist/__phutil_library_map__.php b/arcanist/__phutil_library_map__.php --- a/arcanist/__phutil_library_map__.php +++ b/arcanist/__phutil_library_map__.php @@ -19,7 +19,6 @@ 'CheckDocLinter' => 'linter/CheckDocLinter.php', 'CheckNonFatalOverAssertInRpc' => 'linter/CheckNonFatalOverAssertInRpc.php', 'ClangFormatLinter' => 'linter/ClangFormatLinter.php', - 'CppCheckLinter' => 'linter/CppCheckLinter.php', 'CppVoidParameterLinter' => 'linter/CppVoidParameterLinter.php', 'DoxygenLinter' => 'linter/DoxygenLinter.php', 'ExtendedConfigurationDrivenLintEngine' => 'engine/ExtendedConfigurationDrivenLintEngine.php', @@ -62,7 +61,6 @@ 'CheckDocLinter' => 'GlobalExternalLinter', 'CheckNonFatalOverAssertInRpc' => 'ArcanistLinter', 'ClangFormatLinter' => 'ArcanistExternalLinter', - 'CppCheckLinter' => 'ArcanistExternalLinter', 'CppVoidParameterLinter' => 'ArcanistLinter', 'DoxygenLinter' => 'ArcanistLinter', 'ExtendedConfigurationDrivenLintEngine' => 'ArcanistLintEngine', diff --git a/arcanist/linter/CppCheckLinter.php b/arcanist/linter/CppCheckLinter.php deleted file mode 100644 --- a/arcanist/linter/CppCheckLinter.php +++ /dev/null @@ -1,291 +0,0 @@ -<?php - -/** - * Uses the cppcheck tool to run static analysis on c++ sources. - */ -final class CppCheckLinter extends ArcanistExternalLinter { - const CPPCHECK_ENABLED_CHECKS = array( - // None so far. - ); - - const CPPCHECK_DISABLED_CHECKS = array( - "unknownMacro", - "preprocessorErrorDirective", - // These would be worth enabling going forward. - "danglingTemporaryLifetime", - "invalidContainer", - ); - - // phpcs:disable Generic.Files.LineLength.TooLong - // phpcs:disable Generic.Files.LineLength.MaxExceeded - /* Associative array of <file => [messages]> to whitelist. */ - const CPPCHECK_IGNORED_WARNINGS = array( - "src/arith_uint256.h" => array( - "Class 'arith_uint256' has a constructor with 1 argument that is not explicit.", - "Class 'base_uint < 256 >' has a constructor with 1 argument that is not explicit.", - "Class 'base_uint' has a constructor with 1 argument that is not explicit.", - ), - "src/avalanche/test/processor_tests.cpp" => array( - // This is a false positive, there is an assertion that the array has - // the expected size using a BOOST_CHECK expression. - "Out of bounds access in expression 'updates[0]' because 'updates' is empty.", - ), - "src/bench/mempool_stress.cpp" => array( - // Remove this once this false positive is fixed in cppcheck - // https://trac.cppcheck.net/ticket/9537 - "Syntax Error: AST broken, 'for' doesn't have two operands.", - ), - "src/bench/prevector.cpp" => array( - // Remove this once this false positive is fixed in cppcheck - "syntax error", - ), - "src/coins.h" => array( - "Class 'CCoinsViewBacked' has a constructor with 1 argument that is not explicit.", - "Class 'CCoinsViewCache' has a constructor with 1 argument that is not explicit.", - "Class 'CCoinsViewCursor' has a constructor with 1 argument that is not explicit.", - ), - "src/compat/glibcxx_sanity.cpp" => array( - // This is a deliberate sanity check and not a real issue - "Out of bounds access in expression 'test.at(1)' because 'test' is empty and 'at' may be non-zero.", - ), - "src/cuckoocache.h" => array( - "Struct 'KeyOnly' has a constructor with 1 argument that is not explicit.", - ), - "src/init.cpp" => array( - // This is a cppcheck issue, occurring on Debian Buster's version 1.86. - // This no longer occurs with version 2.3, and maybe other earlier - // versions (untested). FIXME: remove when the bug is fixed. - "Syntax Error: AST broken, binary operator '=' doesn't have two operands.", - ), - "src/net.h" => array( - "Class 'CNetMessage' has a constructor with 1 argument that is not explicit.", - ), - "src/net_processing.cpp" => array( - "Same iterator is used with different containers 'mapOrphanTransactions' and 'itPrev.second'.", - "Analysis failed. If the code is valid then please report this failure.", - ), - "src/policy/feerate.h" => array( - "Class 'CFeeRate' has a constructor with 1 argument that is not explicit.", - ), - "src/prevector.h" => array( - "Class 'const_iterator' has a constructor with 1 argument that is not explicit.", - "Class 'const_reverse_iterator' has a constructor with 1 argument that is not explicit.", - "Class 'iterator' has a constructor with 1 argument that is not explicit.", - "Class 'reverse_iterator' has a constructor with 1 argument that is not explicit.", - ), - "src/primitives/block.h" => array( - "Class 'CBlock' has a constructor with 1 argument that is not explicit.", - ), - "src/primitives/transaction.h" => array( - "Class 'CTransaction' has a constructor with 1 argument that is not explicit.", - ), - "src/protocol.h" => array( - "Class 'CMessageHeader' has a constructor with 1 argument that is not explicit.", - ), - "src/qt/guiutil.h" => array( - "Class 'ItemDelegate' has a constructor with 1 argument that is not explicit.", - ), - "src/rpc/util.h" => array( - "Struct 'RPCResults' has a constructor with 1 argument that is not explicit.", - "Struct 'UniValueType' has a constructor with 1 argument that is not explicit.", - ), - "src/script/descriptor.cpp" => array( - "Class 'AddressDescriptor' has a constructor with 1 argument that is not explicit.", - "Class 'ComboDescriptor' has a constructor with 1 argument that is not explicit.", - "Class 'ConstPubkeyProvider' has a constructor with 1 argument that is not explicit.", - "Class 'PKDescriptor' has a constructor with 1 argument that is not explicit.", - "Class 'PKHDescriptor' has a constructor with 1 argument that is not explicit.", - "Class 'RawDescriptor' has a constructor with 1 argument that is not explicit.", - "Class 'SHDescriptor' has a constructor with 1 argument that is not explicit.", - "Class 'WPKHDescriptor' has a constructor with 1 argument that is not explicit.", - "Class 'WSHDescriptor' has a constructor with 1 argument that is not explicit.", - ), - "src/script/script.h" => array( - "Class 'CScript' has a constructor with 1 argument that is not explicit.", - ), - "src/script/standard.h" => array( - "Class 'CScriptID' has a constructor with 1 argument that is not explicit.", - ), - "src/support/allocators/secure.h" => array( - "Struct 'secure_allocator < char >' has a constructor with 1 argument that is not explicit.", - "Struct 'secure_allocator < RNGState >' has a constructor with 1 argument that is not explicit.", - "Struct 'secure_allocator < unsigned char >' has a constructor with 1 argument that is not explicit.", - ), - "src/support/allocators/zeroafterfree.h" => array( - "Struct 'zero_after_free_allocator < char >' has a constructor with 1 argument that is not explicit.", - ), - "src/test/blockindex_tests.cpp" => array( - // This is a false positive, the array is list initialized - "Out of bounds access in 'times[i]', if 'times' size is 1 and 'i' is 11", - "Out of bounds access in 'times2[i]', if 'times2' size is 1 and 'i' is 11", - ), - "src/test/checkqueue_tests.cpp" => array( - "Struct 'FailingCheck' has a constructor with 1 argument that is not explicit.", - "Struct 'MemoryCheck' has a constructor with 1 argument that is not explicit.", - "Struct 'UniqueCheck' has a constructor with 1 argument that is not explicit.", - ), - "src/test/cuckoocache_tests.cpp" => array( - "Struct 'KeyType' has a constructor with 1 argument that is not explicit.", - "Struct 'TestMapElement' has a constructor with 1 argument that is not explicit." - ), - "src/test/prevector_tests.cpp" => array( - // Remove this once this false positive is fixed in cppcheck - "syntax error", - ), - "src/wallet/db.h" => array( - "Class 'BerkeleyEnvironment' has a constructor with 1 argument that is not explicit.", - ), - ); - // phpcs:enable - - const CPPCHECK_OPTIONS = array( - '-j2', - '--enable=all', - '--language=c++', - ); - - const CPPCHECK_DEFINITIONS = array( - '-D__cplusplus', - '-DCLIENT_VERSION_BUILD', - '-DCLIENT_VERSION_IS_RELEASE', - '-DCLIENT_VERSION_MAJOR', - '-DCLIENT_VERSION_MINOR', - '-DCLIENT_VERSION_REVISION', - '-DCOPYRIGHT_YEAR', - '-DDEBUG', - ); - - public function getInfoName() { - return 'cppcheck'; - } - - public function getInfoURI() { - return 'http://cppcheck.sourceforge.net'; - } - - public function getInfoDescription() { - return pht( - 'Use `%s` to perform static analysis on C/C++ code.', - 'cppcheck'); - } - - public function getLinterName() { - return 'lint-cppcheck'; - } - - public function getLinterConfigurationName() { - return 'lint-cppcheck'; - } - - public function getDefaultBinary() { - return 'cppcheck'; - } - - public function getVersion() { - list($stdout) = execx('%C --version', $this->getExecutableCommand()); - - $matches = array(); - $regex = '/^Cppcheck (?P<version>\d+\.\d+)$/'; - if (preg_match($regex, $stdout, $matches)) { - return $matches['version']; - } - - return false; - } - - public function getInstallInstructions() { - return pht( - 'Install Cppcheck using `%s` or similar.', - 'apt-get install cppcheck'); - } - - protected function getDefaultFlags() { - return array_merge( - self::CPPCHECK_OPTIONS, - self::CPPCHECK_DEFINITIONS - ); - } - - protected function getMandatoryFlags() { - return array( - '--quiet', - '--inline-suppr', - '--xml', - '--xml-version=2', - ); - } - - public function shouldExpectCommandErrors() { - return false; - } - - private function isWhitelisted($path, $errorId, $errorDescription) { - return array_key_exists($path, self::CPPCHECK_IGNORED_WARNINGS) && - in_array($errorDescription, self::CPPCHECK_IGNORED_WARNINGS[$path]); - } - - private function isCheckEnabled($errorId) { - return in_array($errorId, self::CPPCHECK_ENABLED_CHECKS); - } - - private function isCheckDisabled($errorId) { - return in_array($errorId, self::CPPCHECK_DISABLED_CHECKS); - } - - protected function parseLinterOutput($path, $err, $stdout, $stderr) { - $dom = new DOMDocument(); - $ok = @$dom->loadXML($stderr); - - if (!$ok) { - return false; - } - - $errors = $dom->getElementsByTagName('error'); - $messages = array(); - foreach ($errors as $error) { - foreach ($error->getElementsByTagName('location') as $location) { - $errorPath = Filesystem::readablePath( - $location->getAttribute('file'), $this->getProjectRoot()); - $errorId = $error->getAttribute('id'); - $errorDescription = $error->getAttribute('msg'); - - /* - * Only raise errors related to the actual source file. - * This prevents from printing tons of duplicates. - */ - if ($errorPath !== $path || $this->isWhitelisted( - $errorPath, $errorId, $errorDescription)) { - continue; - } - - // For errors, we work on a blacklist basis. - // For advices and warnings, we work on a whitelist basis. - $is_error = $error->getAttribute('severity') == 'error'; - if ($is_error && $this->isCheckDisabled($errorId)) { - continue; - } else if (!$is_error && !$this->isCheckEnabled($errorId)) { - continue; - } - - $message = new ArcanistLintMessage(); - $message->setPath($errorPath); - $message->setLine($location->getAttribute('line')); - $message->setCode('CPPCHECK'); - $message->setName($errorId); - $message->setDescription($errorDescription); - - if ($is_error) { - $message->setSeverity(ArcanistLintSeverity::SEVERITY_ERROR); - } elseif ($error->getAttribute('inconclusive')) { - $message->setSeverity(ArcanistLintSeverity::SEVERITY_ADVICE); - } else { - $message->setSeverity(ArcanistLintSeverity::SEVERITY_WARNING); - } - - $messages[] = $message; - } - } - - return $messages; - } -} diff --git a/contrib/utils/install-dependencies.sh b/contrib/utils/install-dependencies.sh --- a/contrib/utils/install-dependencies.sh +++ b/contrib/utils/install-dependencies.sh @@ -14,7 +14,6 @@ bsdmainutils build-essential ccache - cppcheck curl default-jdk devscripts diff --git a/src/avalanche/peermanager.cpp b/src/avalanche/peermanager.cpp --- a/src/avalanche/peermanager.cpp +++ b/src/avalanche/peermanager.cpp @@ -200,12 +200,9 @@ // Check the proof's validity. ProofValidationState validationState; - // Using WITH_LOCK directly inside the if statement will trigger a cppcheck - // false positive syntax error - const bool valid = WITH_LOCK( - cs_main, - return proof->verify(validationState, ::ChainstateActive().CoinsTip())); - if (!valid) { + if (!WITH_LOCK(cs_main, + return proof->verify(validationState, + ::ChainstateActive().CoinsTip()))) { if (isOrphanState(validationState)) { orphanProofPool.addProofIfPreferred(proof); return invalidate(ProofRegistrationResult::ORPHAN, "orphan-proof");