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 9EE8B6EC6F; Fri, 26 Feb 2021 12:25:10 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 9EE8B6EC6F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1614331510; bh=tgxpZo+Fu1f5RiAuE0eQyqZ+xJNWeXvHmE6Da/DIGBs=; h=To:References:Date:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=V6amRzwtjq/ZJxvmJYrau9c5sTz+IYJ+r8lAX/h9D2O7dipCQm/8lgizvqDJmUS9M xnx779dqX+Y6nSFz00S8wJamF/w7+bxtoyCJ0MUp0x8g1xwNwycLx0bxR0cnnHRstI oRX4zzfw5oZgp+G2O/dla3AuzPYjI62yt6nt5lvQ= Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (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 D30F86EC6F for ; Fri, 26 Feb 2021 12:25:08 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D30F86EC6F Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1lFZMx-0006L8-VU; Fri, 26 Feb 2021 12:25:08 +0300 To: Alexander Turenko References: <524c0ce8acc18111ab4c8b36e383ff192779c780.1613661908.git.alexander.turenko@tarantool.org> <47b923aa-6d73-451b-169f-ea0c0e48f628@tarantool.org> <20210225163552.qzsjgz6t7rjld7zl@tkn_work_nb> Message-ID: <2fb33658-f830-3eac-141c-da792d34b453@tarantool.org> Date: Fri, 26 Feb 2021 12:25:07 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210225163552.qzsjgz6t7rjld7zl@tkn_work_nb> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD975C3EC174F5669228C980786C9DBA186ED94931C77F7596E182A05F538085040FA796D35EBCC335CE90B5E42CBBDA75D4A0CAD63FD2A9CED710FA0CBEB25890A X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE771540F9ECFC94C4BEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063781BF90BB6B3E56078638F802B75D45FF5571747095F342E8C7A0BC55FA0FE5FCA029F25594E88C63E3A26F4A845A7534EA02DC6FEA8B79B9389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C078FCF50C7EAF9C588941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B6AEEA5BB16A939343CC7F00164DA146DA6F5DAA56C3B73B23C77107234E2CFBA567F23339F89546C55F5C1EE8F4F765FCEB1A37DF9DABAA8F75ECD9A6C639B01BBD4B6F7A4D31EC0BC0CAF46E325F83A522CA9DD8327EE4930A3850AC1BE2E735A91E23F1B6B78B78B5C8C57E37DE458B4C7702A67D5C3316FA3894348FB808DB48C21F01D89DB561574AF45C6390F7469DAA53EE0834AAEE X-C1DE0DAB: 0D63561A33F958A53CB051707BC077C27C6671890520FDC89AAD104785FAD9EED59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75968C9853642EB7C3410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D341C998A3771F04153AE7BE4BCC0039041ECACACF022C1175AFEC3E0B8D25BD6BA8CE82CB75B2F90EF1D7E09C32AA3244CAF66DD5B70157F2634C460BBF13D366A408A6A02710B7304FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj8mqzvzJVEn2EZ9ctgxNz4Q== X-Mailru-Sender: 689FA8AB762F73936BC43F508A063822ECA99A6C1A46FD7FA13BC511342B0875DD788429FD8613638ED9BB8B05EE7B3AFB559BB5D741EB96D19CD4E7312BAA970A04DAD6CC59E33667EA787935ED9F1B 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: Sergey Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, On 25.02.2021 19:35, Alexander Turenko wrote: >>> +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? Thanks for analysis! We can keep whitespace as is in your patch :) > > (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