From dev-return-4223-archive-asf-public=cust-asf.ponee.io@singa.apache.org Wed Feb 19 03:34:24 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id C79DD18060E for ; Wed, 19 Feb 2020 04:34:23 +0100 (CET) Received: (qmail 36913 invoked by uid 500); 19 Feb 2020 03:34:23 -0000 Mailing-List: contact dev-help@singa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@singa.apache.org Delivered-To: mailing list dev@singa.apache.org Received: (qmail 36903 invoked by uid 99); 19 Feb 2020 03:34:22 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Feb 2020 03:34:22 +0000 From: GitBox To: dev@singa.apache.org Subject: [GitHub] [singa-doc] chrishkchris commented on a change in pull request #4: Add google-style in clang-formatter Message-ID: <158208326287.3343.11752531757169941296.gitbox@gitbox.apache.org> References: In-Reply-To: Date: Wed, 19 Feb 2020 03:34:22 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit chrishkchris commented on a change in pull request #4: Add google-style in clang-formatter URL: https://github.com/apache/singa-doc/pull/4#discussion_r381059513 ########## File path: docs-site/docs/contribute-code.md ########## @@ -19,16 +19,26 @@ A simple way to enforce the Google coding styles is to use the linting and forma Once the extensions are installed, edit the `settings.json` file. ```json -"[cpp]": { - "editor.defaultFormatter": "xaver.clang-format" -}, -"cpplint.cpplintPath": "path/to/cpplint", - -"editor.formatOnSave": true, -"python.formatting.provider": "yapf", -"python.linting.enabled": true, -"python.linting.lintOnSave": true, +{ + "[cpp]": { + "editor.defaultFormatter": "xaver.clang-format" + }, + "cpplint.cpplintPath": "path/to/cpplint", + + "editor.formatOnSave": true, + "python.formatting.provider": "yapf", + "python.linting.enabled": true, + "python.linting.lintOnSave": true, + "clang-format.language.cpp.style": "google", + "python.formatting.yapfArgs" : ["--style" , "{based_on_style: google}" ] +} ``` + +Depending on your platform, the user settings file is located here: +1. Windows %APPDATA%\Code\User\settings.json +2. macOS $HOME/Library/Application Support/Code/User/settings.json +3. Linux $HOME/.config/Code/User/settings.json + Configurations are specified in corresponding config files. And these tools would look up for configuration files in the root of the project automatically, e.g. `.pylintrc`. Review comment: Yes, this is the intention of this PR. It will solve the problem when the project root .clang-format is not detected in some environment (e.g. sftp of WINSCP) the key is the line 32 and 33 that set the format to google ``` "clang-format.language.cpp.style": "google", "python.formatting.yapfArgs" : ["--style" , "{based_on_style: google}" ] ``` I have checked the .clang-format just have two line that turns the style to google https://github.com/apache/singa/blob/dev/.clang-format However, I cannot guarantee in all case the formatting is the same by the two approaches. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services