From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id EAA6E7030F; Thu, 25 Feb 2021 19:35:49 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org EAA6E7030F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1614270950; bh=fG6pN49lXWNV6fb64CsNG7c4CjRKTg/ImaiwSfrl7yw=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=F1Jj3f1IH29NEXUvyLniRGPA3ym+s0uUWPxnivCVvhPgMEOf4cqznH3z54G8By2jB 7RuSXwwSW6nQVNHtJiiu9brCXcubfPPUmIrDU1B+nuaxjqYGMRVLS2zPeMLtM8XCs0 LOcOrfJulMJ442EhiCQubvq4jPkvGhW+qXtfHHrY= Received: from smtp37.i.mail.ru (smtp37.i.mail.ru [94.100.177.97]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id C849F7030F for ; Thu, 25 Feb 2021 19:35:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C849F7030F Received: by smtp37.i.mail.ru with esmtpa (envelope-from ) id 1lFJcB-0001eD-Uu; Thu, 25 Feb 2021 19:35:48 +0300 Date: Thu, 25 Feb 2021 19:35:52 +0300 To: Sergey Bronnikov Message-ID: <20210225163552.qzsjgz6t7rjld7zl@tkn_work_nb> References: <524c0ce8acc18111ab4c8b36e383ff192779c780.1613661908.git.alexander.turenko@tarantool.org> <47b923aa-6d73-451b-169f-ea0c0e48f628@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <47b923aa-6d73-451b-169f-ea0c0e48f628@tarantool.org> X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD975C3EC174F56692254B0AABE1FB071B2BA6557555153D6A0182A05F538085040DD0713A79183187C0ADF7E85F85642EED4ED8A1086ACBD3B22CAB3669B9B4BBC X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7922E451CE6E839B1EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063753275FB77F6A31628638F802B75D45FF5571747095F342E8C7A0BC55FA0FE5FC0A3A6CE1A90197E64055974A3830074EE6EB0C455240B03D389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C0A29E2F051442AF778941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B65FF0BFC5AEE34BE6CC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C2249B5C3F9F4236781E376E601842F6C81A12EF20D2F80756B5F7E9C4E3C761E06A776E601842F6C81A127C277FBC8AE2E8B837DF952AF2192FE3AA81AA40904B5D9DBF02ECDB25306B2B25CBF701D1BE8734AD6D5ED66289B5278DA827A17800CE7588D3C263EAE74EA67F23339F89546C5A8DF7F3B2552694A6FED454B719173D6725E5C173C3A84C3A27B50A64E76B53235872C767BF85DA2F004C906525384306FED454B719173D6462275124DF8B9C934F12F0C005D1A85E5BFE6E7EFDEDCD789D4C264860C145E X-C1DE0DAB: 0D63561A33F958A52D5E4BD1F8A20E82D364DCC8C152EB7319CC9AECCA0678ADD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7557E988E9157162368E8E86DC7131B365E7726E8460B7C23C X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3482189E76C6218D8F13D4EDCE16697D51A040C93228C9DD53B8B484E7689D5F38322B36A0BF5FD68B1D7E09C32AA3244C2039F04A7ABF2C4460AE4B6FB86A20438A6D4CC6FBFAC251FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojvz1c9SWJtj8uMsP6jwtiGw== X-Mailru-Sender: FFAA8E4AEE17E37C3731A083A1A85ADEDBFAC031910F259278C9D2A20C7F0F80B7EA9FE7735C3DBFC664A44C781FCEA7C77752E0C033A69EDF9F2CE1E9CF805D8CD356D4F938FF726C18EFA0BB12DBB0 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2] tools: fix luacheck invocation in different cases X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Alexander Turenko via Tarantool-patches Reply-To: Alexander Turenko Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" > > +if (BINARY_DIR_INSIDE_SOURCE_DIR) > > extra whitespace after "if" To be honest, it was always unclear for me, which style is right and I just tried to be consistent with the surrounding code. For CMakeLists.txt (this file, on master): | $ grep '\bif(' CMakeLists.txt | wc -l | 10 | $ grep '\bif (' CMakeLists.txt | wc -l | 22 For tarantool at whole: | $ find . -name CMakeLists.txt -not -path '*third_party*' -or -name '*.cmake' -not -path '*third_party*' -print | xargs -I {} grep '\bif(' {} | wc -l | 74 | $ find . -name CMakeLists.txt -not -path '*third_party*' -or -name '*.cmake' -not -path '*third_party*' -print | xargs -I {} grep '\bif (' {} | wc -l | 163 For CMake built-in modules: | $ find /usr/share/cmake/Modules -name '*.cmake' -print | xargs -I {} grep '\bif(' {} | wc -l | 5752 | $ find /usr/share/cmake/Modules -name '*.cmake' -print | xargs -I {} grep '\bif (' {} | wc -l | 1492 What the world think: * CMake follows `if()` style in its docs ([1]). * WebKit agreed on using `if ()` ([2]). * cmakelint ([3]) requires `if()`. * polysquare-cmake-linter ([4]) requires `if ()`. * cmake-lint from cmake_format ([5]) does not complain about any variant by default, but the default config has the `separate_ctrl_name_with_space` option (False). Bug? (JFYI: CMake autoformatter / linter issue: [6].) If we'll attempt to apply some common sense: 1. `if()` is consistent with `else()` and `endif()`. 2. `if ()` looks usual for a C developer (visual differentiation of control flow constructions from function calls). So, to be honest, I still don't know. There is no general rule neither in tarantool, nor in the world. There is no good choice, because of the language syntax. My personal preference is `if ()`, because it differentiates control flow constructions from macro / function calls (that's usual in C). [1]: https://cmake.org/cmake/help/latest/command/if.html [2]: http://trac.webkit.org/changeset/136790/webkit [3]: https://github.com/cmake-lint/cmake-lint [4]: https://github.com/polysquare/polysquare-cmake-linter [5]: https://github.com/cheshirekow/cmake_format [6]: https://gitlab.kitware.com/cmake/cmake/-/issues/17441