google-style-guide

Google C++ Style Guide include order

被刻印的时光 ゝ 提交于 2019-12-11 09:09:07
问题 Google C++ Style Guide recommends to include the header files (.h) to the implementation files (.cpp, .cc) in the following order: In dir/foo.cc or dir/foo_test.cc , whose main purpose is to implement or test the stuff in dir2/foo2.h , order your includes as follows: dir2/foo2.h. A blank line C system files. C++ system files. A blank line Other libraries' .h files. Your project's .h files. As said such order allows to see the omitted dependencies in dir2/foo2.h while compiling the foo -unit,

VSCode configure syntax highlighting to match a style guide

落爺英雄遲暮 提交于 2019-12-04 11:26:35
How do I change the syntax highlighting in VSCode so that it adheres to a particular style guide? For example, I want to adhere to the Google C++ style guide where member variables are written as some_member_variable_ . When I use this convention, VSCode does not color that name differently from standard text. But I have some code that uses the mSomeMemberVariable convention, and that does get colored differently than other text. Is there a way to configure this better? TL;DR >There is no easy way to apply Google style syntax highlighting unless you find an existing cpp Textmate grammar file

Is there a tool to lint Python based on the Google style guide?

不问归期 提交于 2019-12-03 10:54:36
问题 According to Google's standard for Python: http://google-styleguide.googlecode.com/svn/trunk/pyguide.html Perhaps a group of tools that can cover most of the standard? 回答1: pylint will do this kind of checking but you need a configuration file to make it look for things exactly as Google's style guide dictates. Google publishes this pylink file as part of various projects. https://www.chromium.org/chromium-os/python-style-guidelines#TOC-pylint The rc file itself is here: https://github.com

Why does Google Style Guide discourage forward declaration?

南笙酒味 提交于 2019-12-03 10:29:17
问题 Not to say that the Google Style Guide is the holy bible but as a newbie programmer, it seems like a good reference. The Google Style Guide lists the following disadvantages of forward declaration Forward declarations can hide a dependency, allowing user code to skip necessary recompilation when headers change. A forward declaration may be broken by subsequent changes to the library. Forward declarations of functions and templates can prevent the header owners from making otherwise-compatible

Why does Google Style Guide discourage forward declaration?

无人久伴 提交于 2019-12-03 01:15:29
Not to say that the Google Style Guide is the holy bible but as a newbie programmer, it seems like a good reference. The Google Style Guide lists the following disadvantages of forward declaration Forward declarations can hide a dependency, allowing user code to skip necessary recompilation when headers change. A forward declaration may be broken by subsequent changes to the library. Forward declarations of functions and templates can prevent the header owners from making otherwise-compatible changes to their APIs, such as widening a parameter type, adding a template parameter with a default

Google Style Guide “<chrono> is an unapproved C++11 header”

∥☆過路亽.° 提交于 2019-12-01 17:37:10
问题 Why is <chrono> an unapproved header in the Google CPP Guide? I can't find any direct mention of this in the Google CPP Style Guide. This point mentions portability issues with <ratio> and <cfenv> but nothing about <chrono> . 回答1: According to C++11 use in Chromium The reason is Duplicated Time APIs in base/ . Keep using the base/ classes. 来源: https://stackoverflow.com/questions/33653326/google-style-guide-chrono-is-an-unapproved-c11-header

Function Declarations Within Blocks according to the Google JavaScript style guide

元气小坏坏 提交于 2019-11-27 23:17:02
According to the Google JavaScript style guide, function declarations should not be declared within blocks since this is not a part of ECMAScript. However, I'm not entirely clear on what counts as a block. Specifically, I have a constructor function and I want to define a function within the scope of that constructor. Would this count as a function within a block, since it is within a set of {}? If so, does that mean every function declaration must be global? Some code for good measure: WRONG (?) function Constructor() { function Shout () { alert('THE BEST UX IS IN ALL CAPS.'); } } RIGHT (?)

Function Declarations Within Blocks according to the Google JavaScript style guide

旧街凉风 提交于 2019-11-26 23:18:44
问题 According to the Google JavaScript style guide, function declarations should not be declared within blocks since this is not a part of ECMAScript. However, I'm not entirely clear on what counts as a block. Specifically, I have a constructor function and I want to define a function within the scope of that constructor. Would this count as a function within a block, since it is within a set of {}? If so, does that mean every function declaration must be global? Some code for good measure: WRONG