shyam334 / google-styleguide Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/google-styleguide
Automatically exported from code.google.com/p/google-styleguide
In the Objective-C style guide section for Properties
(https://google-styleguide.googlecode.com/svn/trunk/objcguide.xml#Properties),
subsection "List out all implementation directives", it says that properties
are @dynamic by default (and thus one should list them out), which is not
correct.
Apple's documentation
(http://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Objective
C/Chapters/ocProperties.html#//apple_ref/doc/uid/TP30001163-CH17-SW9
Objective-C Programming Language, section "Property Implementation Directives")
clearly states that using @dynamic is *different* from not using an
implementation directive, in that the compiler will issue a warning for missing
getters and setters when no implementation directive is given, but it will not
issue a warning when @dynamic is used. It suggests that @dynamic be used in
situations where you will fulfill the property contract in another way, such as
dynamic loading of code or dynamic method resolution; such mechanisms are
highly unlikely to be used in most code.
Therefore, the style guide's instruction to add a @dynamic directive, when
there was no directive, actually makes the code WORSE, because it turns off a
very useful compiler warning about missing getters and setters, without any
benefit at all.
Original issue reported on code.google.com by [email protected]
on 23 Jun 2011 at 1:57
Enable the on/off tags (@formatter:off, @formatter:on) so that comments can be
formatted manually in exceptional cases, such as to provide an ASCII table in a
comment to describe a block of code's expected behavior to other developers,
when the formatting rules would have made the comment less readable by
collapsing whitespace and line-wrapping. This feature exists already in
Eclipse, and is enabled by this patch.
Example:
/*
* The following method returns the following results
* @formatter:off
* +-------+-------+-------------------+
* | c="a" | c="b" | anything else |
* +-------+-------+-------------------+
* | true | false | true iff f(c)>200 |
* +-------+-------+-------------------+
* @formatter:on
*/
public boolean myMethod(String c);
Original issue reported on code.google.com by ctubbsii
on 15 Aug 2014 at 10:44
Attachments:
minor fixes, more explanation inside the patch messages. In short, these
provide:
- minor fixes
- py3k compatibility
- more default extensions
- some tests more robust
Original issue reported on code.google.com by [email protected]
on 4 Jan 2015 at 1:29
Attachments:
I know that Google prefers Python over Ruby. But for organizations that like
using Ruby, and like using Google Style, being able to refer to a Google
document on Ruby style would be more useful than having to point to multiple
style guides.
What do you think?
Original issue reported on code.google.com by [email protected]
on 13 Feb 2015 at 8:38
Add missing comma in JavaScript Language Rules > Constants example.
Original issue reported on code.google.com by [email protected]
on 22 Nov 2012 at 10:03
Attachments:
What steps will reproduce the problem?
1. Run `cpplint --root=include file.h`. The file.h is inside the directory
`include\project`.
What is the expected output? What do you see instead?
Expected: cpplint performing its checks.
Instead:
Traceback (most recent call last):
File "C:\dev\cpplint\cpplint.py", line 4753, in <module>
main()
File "C:\dev\cpplint\cpplint.py", line 4746, in main
ProcessFile(filename, _cpplint_state.verbose_level)
File "C:\dev\cpplint\cpplint.py", line 4631, in ProcessFile
extra_check_functions)
File "C:\dev\cpplint\cpplint.py", line 4556, in ProcessFileData
CheckForHeaderGuard(filename, lines, error)
File "C:\dev\cpplint\cpplint.py", line 1409, in CheckForHeaderGuard
cppvar = GetHeaderGuardCPPVariable(filename)
File "C:\dev\cpplint\cpplint.py", line 1393, in GetHeaderGuardCPPVariable
file_path_from_root = re.sub('^' + _root + os.sep, '', file_path_from_root)
File "C:\dev\portable-python-2.7.5.1\App\lib\re.py", line 151, in sub
return _compile(pattern, flags).sub(repl, string, count)
File "C:\dev\portable-python-2.7.5.1\App\lib\re.py", line 242, in _compile
raise error, v # invalid expression
sre_constants.error: bogus escape (end of line)
What version of the product are you using? On what operating system?
Microsoft Windows 7 64 Bit [6.3.9600]
Python 2.7.5
cpplint.py from trunk
Please provide any additional information below.
By adding a backslash to the end of the --root value, the error doesn't occur,
but the correct include guards aren't detected by cpplint.
Example: `cpplint --root=include\ file.h`
I expect the following output:
file.h:8: #ifndef header guard has wrong style, please use: PROJECT_FILE_H_ [build/header_guard] [5]
ball.h:101: #endif line should be "#endif // PROJECT_FILE_H_" [build/header_guard] [5]
Done processing file.h
Total errors found: 2
But instead, the following is generated:
file.h:8: #ifndef header guard has wrong style, please use: INCLUDE_PROJECT_FILE_H_ [build/header_guard] [5]
ball.h:101: #endif line should be "#endif // INCLUDE_PROJECT_FILE_H_" [build/header_guard] [5]
Done processing file.h
Total errors found: 2
Original issue reported on code.google.com by [email protected]
on 12 Mar 2014 at 5:09
<!-- AllMediaAds.Com Asynchronous Ad Tag For -->
<!-- Ad Size 300X250WEB -->
<script language="JavaScript" type="text/javascript">
var prot = document.location.protocol;
document.write('<script language="JavaScript" type="text/javascript"');
document.write('src="'+prot+'//AllMediaAds.Com/ads/ama/300X250WEB.js?id=0">');
document.write('<\/scr' + 'ipt>');
</script>
<!-- AllMediaAds.Com Asynchronous Ad Tag For -->
Original issue reported on code.google.com by [email protected]
on 17 Apr 2014 at 5:35
Attachments:
removed default bool false expressions: '0', [] and {} do evaluate as false
Original issue reported on code.google.com by [email protected]
on 21 Feb 2013 at 10:11
Attachments:
Quick hack for QT on line 4413:
scope_or_label_pattern = r'\s*(\w+|private slots)\s*:\s*\\?$'
Original issue reported on code.google.com by [email protected]
on 7 Apr 2015 at 1:43
Attachments:
Hi,
First of all thank you for this great script.
Let me introduce myself, my name is Jorge Costa and im am one of the developers
that is currently updating the c++ plugin community edition. We have now a new
feature that allows the import of any static analysis tool, cpplint is one im
using has a reference case. However in order to get it into sonar i had the
need to modify the script in order to differentiate the different rules. Ive
create a script for that, see
http://docs.codehaus.org/display/SONAR/Usage+of+Non+Supported+Tools
Would this be something that you could improve on your side, so that the rules
are more easily exported into sonar?
Thanks in advance
Best Regards
Jorge Costa
Original issue reported on code.google.com by [email protected]
on 11 Feb 2013 at 1:18
1. Download
http://code.google.com/p/google-styleguide/source/browse/trunk/eclipse-java-goog
le-style.xml
2. Download latest Eclipse IDE for Java Developers (I used
eclipse-java-luna-SR1-linux-gtk.tar.gz )
3. Extract downloaded archive and launch eclipse
4. Open Window->Preferences->Java->Code Style->Formatter
5. Import downloaded package
6. Eclipse shows a warning dialog that the importing profile has newer version
than current eclipse supported version. I attach the file with the dialog
screenshot.
Is it expected? How can I use this profile with full features turn on in
eclipse?
Original issue reported on code.google.com by [email protected]
on 28 Oct 2014 at 9:13
Attachments:
What steps will reproduce the problem?
1.Made B the target.
2. Took hatin to another level by talking about some 'hard to talk about'
Scars , and to my girlfriend behind my back. And he was my friend
3. Fucked with my money, my bitch, and then snitched.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 11 Feb 2012 at 5:42
What steps will reproduce the problem?
1. Install Python 3.3 on Windows XP platform
2. Execute cpplint_unittest.py
3.
What is the expected output? What do you see instead?
Expected no failures when running unit tests.
Actual Error ...
H:\cpplinttest>D:\Python33\python.exe cpplint_unittest.py
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEcpplint_unittest.py:2416: DeprecationWarning:
Please use assertEqual instead.
self.assertEquals('""', collapse('""')) # "" (empty)
...EEEEEEEEEEcpplint_unittest.py:62: DeprecationWarning: Please use assertTrue
instead.
' which is not in _ERROR_CATEGORIES' % (message, category))
.EEEEEEE.EEEEEEEEE.E..EEEE.EEEEE.EEEEEEEEEEEEEE..EEEEEEEEEEEEEEEEEEETraceback
(most recent call last):
File "cpplint_unittest.py", line 3122, in <module>
unittest.main()
File "D:\Python33\lib\unittest\main.py", line 125, in __init__
self.runTests()
File "D:\Python33\lib\unittest\main.py", line 261, in runTests
self.result = testRunner.run(self.test)
File "D:\Python33\lib\unittest\runner.py", line 168, in run
test(result)
File "D:\Python33\lib\unittest\suite.py", line 67, in __call__
return self.run(*args, **kwds)
File "D:\Python33\lib\unittest\suite.py", line 105, in run
test(result)
File "D:\Python33\lib\unittest\suite.py", line 67, in __call__
return self.run(*args, **kwds)
File "D:\Python33\lib\unittest\suite.py", line 105, in run
test(result)
File "D:\Python33\lib\unittest\case.py", line 492, in __call__
return self.run(*args, **kwds)
File "D:\Python33\lib\unittest\case.py", line 450, in run
result.addError(self, exc_info)
File "D:\Python33\lib\unittest\runner.py", line 67, in addError
super(TextTestResult, self).addError(test, err)
File "D:\Python33\lib\unittest\result.py", line 17, in inner
return method(self, *args, **kw)
...
What version of the product are you using? On what operating system?
Windows XP
Python 3.3
Please provide any additional information below.
I have since installed Python 2.4
(http://www.python.org/download/releases/2.4.4/ ) and Python 2.7 (). This work
better, but I still get errors ...
..............................................F.................................
........................................
.....................F..
======================================================================
FAIL: testBuildHeaderGuard (__main__.CpplintTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "cpplint_unittest.py", line 2037, in testBuildHeaderGuard
self.assertNotEqual(expected_guard, '')
AssertionError: '' == ''
======================================================================
FAIL: testClassifyInclude (__main__.OrderOfIncludesTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "cpplint_unittest.py", line 2517, in testClassifyInclude
False))
AssertionError: 3 != 4
----------------------------------------------------------------------
Ran 144 tests in 0.766s
FAILED (failures=2)
Original issue reported on code.google.com by [email protected]
on 16 Nov 2012 at 11:09
Please display the Issues tab alongside Source and Project Home, to make it
easier to report bugs.
Original issue reported on code.google.com by [email protected]
on 2 Mar 2015 at 8:11
Source code:
class X : public QObject {
...
public slots:
...
}
causes incorrectly message "Weird number of spaces at line-start. Are you
using a 2-space indent? [whitespace/indent] [3]".
Attached patch removes message.
Original issue reported on code.google.com by [email protected]
on 1 Oct 2014 at 9:09
Attachments:
"as it not supported" -> "as it is not supported"
Original issue reported on code.google.com by [email protected]
on 24 Aug 2013 at 12:29
Attachments:
Currently cpplint doesn't recognize .hpp as a header file extension and do not
perform all tests to the file.
Proposal is to add "--headers=extension, extension,..." option that defines the
file extensions which are used for identifying the header files.
Attached patch adds the option and it has been tested with cmake and Visual
Studio 2013.
Original issue reported on code.google.com by [email protected]
on 1 Oct 2014 at 7:34
Attachments:
The length will be 1, not the value of the argument (i.e. x1).
Original issue reported on code.google.com by [email protected]
on 22 Dec 2014 at 3:08
Attachments:
What steps will reproduce the problem?
1. mkdir test
2. cd test
3. hg init
4. touch file.h
5. cpplint.py file.h
What is the expected output?
The #ifndef header guard should be relative to project home directory.
stomic@dell07-desktop:~/tmp/test$ python ~/bin/cpplint.py file.h
file.h:0: No copyright message found. You should have a line: "Copyright
[year] <Copyright Owner>" [legal/copyright] [5]
file.h:0: No #ifndef header guard found, suggested CPP variable is: FILE_H_
[build/header_guard] [5]
Done processing file.h
Total errors found: 2
What do you see instead?
The #ifndef header guard has an absolute path.
file.h:0: No copyright message found. You should have a line: "Copyright
[year] <Copyright Owner>" [legal/copyright] [5]
file.h:0: No #ifndef header guard found, suggested CPP variable is:
_HOME_STOMIC_TMP_TEST_FILE_H_ [build/header_guard] [5]
Done processing file.h
Total errors found: 2
What version of the product are you using? On what operating system?
trunk of cpplint.py
Please provide any additional information below.
Indenting problem of Python code.
Solved easily by un-indenting path generating code. Please check the patch.
stomic@dell07-desktop:~/tmp$ diff ../bin/cpplint.py cpplint.py
722c722
< if (os.path.exists(os.path.join(root_dir, ".git")) or
---
> if (os.path.exists(os.path.join(root_dir, ".git")) or
724,725c724,725
< prefix = os.path.commonprefix([root_dir, project_dir])
< return fullname[len(prefix) + 1:]
---
> prefix = os.path.commonprefix([root_dir, project_dir])
> return fullname[len(prefix) + 1:]
Original issue reported on code.google.com by [email protected]
on 3 Sep 2010 at 2:55
Attachments:
Currently cpplint messages can be suppressed in the source code with NOLINT()
definition. The definition affects only to the single line. In some cases it
would be useful to suppress messages in multiple lines with single definition
(e.g., NOLINTFILE() in the beginning of the file).
Original issue reported on code.google.com by [email protected]
on 1 Oct 2014 at 12:17
Allows cpplint to run in Python 3.
I'm don't know why the sys.stderr StreamReaderWriter wrapper doesn't work on
Python 3
Original issue reported on code.google.com by [email protected]
on 16 Oct 2013 at 3:51
Attachments:
Allow end-of-namespace lines that begin with whitespace. Without this change,
indented end-of-namespace lines (mostly due to nested namespaces) would still
cause an error even if the appropriate change is made to the line. Example:
namespace x {
namespace y {
// this is a nontrivial namespace according
// to cpplint
static const int nontrivial[] = {
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10
};
// end of namespace y is indented, so would
// still cause an error!
} // namespace y
} // namespace x
Original issue reported on code.google.com by [email protected]
on 28 Jul 2013 at 7:40
Attachments:
According to
http://google-styleguide.googlecode.com/svn/trunk/javaguide.html#s3.3.3-import-o
rdering-and-spacing
"Import statements are divided into the following groups, in this order, with
each group separated by a single blank line:
1. All static imports in a single group ..."
static imports should come first. But in intellij-java-google-style.xml they
are listed as last:
https://code.google.com/p/google-styleguide/source/browse/trunk/intellij-java-go
ogle-style.xml#251
Steps to reproduce
1. Open the attached Test.java in IntelliJ
2. In IntelliJ IDEA, do Reformat Code (CTRL+ALT+L on Windows)
3. Check "Organize Import" and "Rearrange Entries"
4. Click OK
What is the expected output?
package test;
import static java.lang.System.out;
import java.text.NumberFormat;
public class Test {
public void test() {
out.println(NumberFormat.getInstance().format(Math.PI));
}
}
What do you see instead?
package test;
import java.text.NumberFormat;
import static java.lang.System.out;
public class Test {
public void test() {
out.println(NumberFormat.getInstance().format(Math.PI));
}
}
What version of the product are you using?
* r134 of intellij-java-google-style.xml
* IntelliJ IDEA 13.03
* JRE 1.7.0_40-b43 x86
On what operating system?
* Windows 7 Enterprise (V 6.1 SP1)
Please provide any additional information below.
I attached the corrected intellij-java-google-style.xml to places the static
imports first as per the code style.
Original issue reported on code.google.com by [email protected]
on 8 Jul 2014 at 5:39
Attachments:
google-styleguide would receive more contributions if we could send a simple
Merge Request instead of sitting on defect reports for months.
Original issue reported on code.google.com by [email protected]
on 11 Feb 2015 at 8:44
The following warning is wrong:
https://code.google.com/p/google-styleguide/source/browse/trunk/shell.xml?r=112#
716
[[ "${my_var}" ]] is, when quoted, always exactly the same as [[ -n "${my_var}"
]] regardless of my_var contents, as far I've tested. Even with [ builtin. Can
you provide a counterexample?
Original issue reported on code.google.com by [email protected]
on 9 Nov 2013 at 3:37
g
Original issue reported on code.google.com by [email protected]
on 14 Jan 2015 at 5:35
Attachments:
removed extra comma in one of the array initializer examples
Original issue reported on code.google.com by [email protected]
on 16 May 2014 at 6:01
Attachments:
There are two ways one might create an element name for elements that belong in
a sequence, plural or singular. For example...
Singluar:
<company>
<employee name="Bob"/>
<employee name="Alice"/>
</company>
Plural:
<company>
<employees name="Bob"/>
<employees name="Alice"/>
</company>
The singular approach is more intuitive when using the XML however the plural
approach is more intuitive when using object-binding parsers (e.g. JAXB,
objectify). Is there a preferred format to use?
Original issue reported on code.google.com by [email protected]
on 13 Sep 2012 at 9:20
What steps will reproduce the problem?
1.
https://google-styleguide.googlecode.com/svn/trunk/lispguide.xml?showone=Attenti
on_Required#Attention_Required
2.
3.
What is the expected output? What do you see instead?
I would expect the "Google Common Lisp Style Guide" to specify the format dates
in comments should be in. My strong preference would be towards ISO 8601, to
spare readers the bafflement which is 1/2/3 or 03.02.01.
The only mention of date is in the example below.
While "November, 2012" is unambiguous enough, it leaves the reader with no
recommendation for representing specific dates or date-time.
Here is the excerpt:
Be specific when indicating times or software releases in a TODO comment:
;;--- TODO(brown): Remove this code after release 1.7 or before November, 2012.
What version of the product are you using? On what operating system?
Please provide any additional information below.
Using a standard date-time format would make it a lot easier for humans and for
tooling to extract useful temporal information from program comments.
Original issue reported on code.google.com by [email protected]
on 11 Oct 2012 at 11:31
Adding streambuf as a valid CPP header. You can see that this include name is
valid:
http://www.cplusplus.com/reference/streambuf/
cpplint.py was giving a false positive with the valid code:
#include <streambuf>
But was passing with the invalid code (didn't compile):
#include <streambuf.h>
Original issue reported on code.google.com by [email protected]
on 17 Jun 2013 at 3:14
Attachments:
Fixing a typo.
Original issue reported on code.google.com by phistuck
on 5 May 2011 at 5:26
Attachments:
The cpplint returns non-zero when there is at least one message. If the cpplint
is started from a make file, the non-zero return value will stop.
Proposal is to add "--return=value" option that forces the script return the
given value even when there is messages (see PC-lint -zero).
Attached batch adds the option to the cpplint and it has been tested with cmake
+ Visual Studio 2013.
Original issue reported on code.google.com by [email protected]
on 1 Oct 2014 at 7:15
Attachments:
Picking the updated to the style guide from the last 10 months.
Original issue reported on code.google.com by [email protected]
on 18 Sep 2012 at 6:44
Attachments:
What steps will reproduce the problem?
The function definition is at
http://google-styleguide.googlecode.com/svn/trunk/google-r-style.html
What is the expected output? What do you see instead?
As stated earlier in the style guide, curly braces should be used or not used
consistently when dealing with single-statement blocks. In the example
function 'CalculateSampleCovariance', curly braces are used in the
single-statement blocks following the first two if statements and not the
single-statement block following the third.
Original issue reported on code.google.com by [email protected]
on 14 Aug 2010 at 3:47
Hi,
I see some problem with the maintenance of the styleguide as a project:
- The project contains no README, LICENSE, CONTRIBUTING or CHANGELOG file (the
project homepage contains that information instead, of course, but that's not
how to do open-source, forks should have this information)
- The project homepage does not link to this issue tracker
- The homepage does not mention a maintainer, it is not clear at all who will
respond to issues, and who may decide about style changes.
- some HTML sources have xml file ending
- Eclipse/IntelliJ settings files in the repo are not linked from the homepage
or any of the guides
- The styleguides follow different conventions (xsl vs. css for styling,
different versioning schemes (last changed vs revision number))
- cpplint.py would benefit from being hosted independently on github or similar
(I forked to my personal github repo at https://github.com/tkruse/cpplint)
- Maintenance of the guides would be more convenient if the HTML/XML sources
were written in a markdown dialect or reStructured text instead of xml.
Possibly presenting via readthedocs would yield beautiful yet cheap results
- The Common LISP Guide contains General guidelines regarding any project, not
just LISP
- code examples have no syntax highlighting
- all language specific guides would do well to include further configuration
for the various existing static checker tools, such as checkstyle for Java or
pep8 for python etc. This would work better if there were more of a folder
structure.
In other words, the styleguide itself as an open-source project does not set a
great example for how google should present open-source projects, IMO.
Compare the effort that goes into this project with the effort that went into
material design guide:
http://www.google.com/design/spec/material-design/introduction.html
Making the styleguide itself a model open-source project would easily be
feasible as Summer of Code project or similar.
Original issue reported on code.google.com by [email protected]
on 6 Jan 2015 at 5:59
Add //: for QtLinguist, in order to add informations for the translator
Original issue reported on code.google.com by [email protected]
on 9 Dec 2013 at 10:52
Attachments:
Wrong function name in indirect setter
Original issue reported on code.google.com by [email protected]
on 23 Jun 2011 at 8:56
Attachments:
The bad example in "Passing Anonymous Functions" was marked as good code.
Original issue reported on code.google.com by max99x
on 24 Mar 2011 at 5:50
Attachments:
Removed "unless resultOfOperation() is NaN". By the Abstract Equality
Comparison Algorithm (ECMA-262, section 11.9.3, 1.c.i), the assertion "NaN ==
resultOfOperation()" is *always* false, even if resultOfOperation is NaN.
Quick link to the relevant section of the ECMAScript 5.1 specification:
http://es5.github.com/#x11.9.3
Original issue reported on code.google.com by [email protected]
on 27 Jul 2012 at 1:04
Attachments:
Could someone upload a .astylerc configured for Google Style? This could help a
lot of command line users ensure Google Style, who don't use Eclipse/IntelliJ.
Original issue reported on code.google.com by [email protected]
on 2 Mar 2015 at 8:13
There is a broken link linking to `Macro_Names` instead of `#Macro_Names`.
Refer to the attachment for the exact patch.
Original issue reported on code.google.com by [email protected]
on 22 Oct 2014 at 10:46
Attachments:
ㅇㅇㅇ
Original issue reported on code.google.com by [email protected]
on 4 Feb 2015 at 11:39
Attachments:
The C++ style guide gives two contradicting guidelines about using scoped_ptr.
The Ownership and Smart Pointers section explicitly says not to use scoped_ptr
except for backward compatibility, while the section on Variable-Length Arrays
and alloca() lists scoped_ptr as an acceptable alternative.
Original issue reported on code.google.com by [email protected]
on 2 May 2014 at 2:38
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.