Questions tagged [google-style-guide]

The Google Style Guide project holds the style guidelines googlers use for Google code.

Every major open-source project has its own style guide: a set of conventions (sometimes arbitrary) about how to write code for that project. It is much easier to understand a large codebase when all the code in it is in a consistent style.

“Style” covers a lot of ground, from “use camelCase for variable names” to “never use global variables” to “never use exceptions.” The Google Style Guide project holds the style guidelines we use for Google code. If you are modifying a project that originated at Google, you may be pointed to its page to see the style guides that apply to that project.

67 questions
82
votes
7 answers

Is using an unsigned rather than signed int more likely to cause bugs? Why?

In the Google C++ Style Guide, on the topic of "Unsigned Integers", it is suggested that Because of historical accident, the C++ standard also uses unsigned integers to represent the size of containers - many members of the standards body believe…
user7586189
  • 1,177
  • 6
  • 15
19
votes
2 answers

Why does Google Style Guide discourage forward declaration?

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,…
Rufus
  • 3,425
  • 3
  • 19
  • 34
14
votes
4 answers

Google's style guide about input/output parameters as pointers

The Google C++ Style Guide draws a clear distinction (strictly followed by cpplint.py) between input parameters(→ const ref, value) and input-output or output parameters (→ non const pointers) : Parameters to C/C++ functions are either input to the…
suizokukan
  • 1,141
  • 3
  • 14
  • 29
12
votes
2 answers

Sample Code with Examples for the C++ Google Style Guide?

Are there any good places to get examples for the C++ Google Style Guide?
leeand00
  • 23,306
  • 34
  • 125
  • 265
11
votes
3 answers

How to resolve At-clause should have a non-empty description? - Checkstyle - Java

I am using the google java style in the checkstyle plugin for eclipse luna. Seeing this error all over my java doc but cannot seem to find how to resolve it. It's minor but its bugging me. my javadoc: /** * This is a description of something …
wondergoat77
  • 1,605
  • 7
  • 29
  • 55
11
votes
1 answer

Is there an official order for JSDoc tags in documentation?

i am documenting a JavaScript API. I am following the google style guide but I found nothing about the order of the tags. I usually document a variable like this: /** * @description Radius of the circle * @private * @memberOf Circle * @type…
joaorodr84
  • 1,114
  • 2
  • 12
  • 30
10
votes
1 answer

Simple way to convert Python docstrings from reStructured Text to Google style?

Does anyone now a simple way do convert all docstrings in an existing project from reStructured Text to the Google format? It looks like Napoleon can do something like that, but it looks very complicated, so I figured I'd ask if someone has done…
9
votes
2 answers

Python and sphinx: bullet point list in multiline google style docstring

I am currently documenting my Python project using Sphinx. I have come across an issue when including a bullet point list in the multi-line part of a docstring. I would like to include a bulleted list, but one of the items is quite long. I would…
Pierre Massé
  • 315
  • 2
  • 17
8
votes
1 answer

Google Style Guide " is an unapproved C++11 header"

Why is 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 and but nothing about .
paul-g
  • 3,510
  • 1
  • 17
  • 32
7
votes
2 answers

Sphinx Napoleon Extension: document multiple return arguments with Google Style docstrings

This question is related to this other one. The proposed and accepted solution is: Returns: (tuple): tuple containing: arg1: First Argument arg2: Second Argument This solution…
rdbisme
  • 761
  • 1
  • 9
  • 34
6
votes
2 answers

Google style docstring Example section is not rendering as a code snippet

I recently started adding documentation to my project and I'm trying to follow the Google style guide. I am using Sphinx to generate the documents and the Sphinx extension napoleon to bridge the gap between the Google styleguide and reST. I have no…
Crystal
  • 4,260
  • 2
  • 18
  • 24
6
votes
3 answers

Running CPPlint on whole project

I want to run cpplint.py on my whole project not for single file to get a report for all C/C++ files in the project. How to do this on macOS and Windows?
T M
  • 2,905
  • 1
  • 24
  • 48
6
votes
1 answer

Sublime text support for Google style guide

I am using sublime text 3 for writing C++ code. We follow Google style guide for CPP. I am looking for any plugins which provide auto-reindent and linter support using the style guide as reference.
Kalyanaraman Santhanam
  • 1,173
  • 1
  • 16
  • 29
6
votes
1 answer

Function Declarations Within Blocks according to the Google JavaScript style guide

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…
Matthew James Davis
  • 11,744
  • 6
  • 56
  • 86
6
votes
4 answers

Why does Google name accessors and mutators after member variables?

http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Function_Names#Function_Names Regular functions have mixed case; accessors and mutators match the name of the variable: MyExcitingFunction(), MyExcitingMethod(), …
szx
  • 5,012
  • 5
  • 36
  • 59
1
2 3 4 5