Commit Graph

275 Commits

Author SHA1 Message Date
Rommel Martinez
edcc3d9c2d Fix typo 2018-03-22 18:04:16 +08:00
Rommel Martinez
a6503e41df Fix typo 2018-03-20 06:32:29 +08:00
Gregory P. Smith
89be4df26d
Define xrange for use under Python 3
Define xrange() for Python 3. I is only used on for loops so this is safe.
2018-03-12 10:24:37 -07:00
cclauss
099f059086
cpplint_unittest.py: Define xrange for Python 3 2018-03-12 18:19:10 +01:00
cclauss
d98652e03b
Update cpplint.py 2018-03-12 18:14:26 +01:00
cclauss
7e4c8b9b6b
Define xrange() for Python 3
flake8 testing of https://github.com/google/styleguide on Python 3.6.3

$ __flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics__
```
./cpplint/cpplint.py:1526:12: F821 undefined name 'xrange'
  for i in xrange(startpos, len(line)):
           ^
./cpplint/cpplint.py:1755:15: F821 undefined name 'xrange'
  for line in xrange(1, min(len(lines), 11)):
              ^
./cpplint/cpplint.py:1957:12: F821 undefined name 'xrange'
  for i in xrange(1, len(raw_lines) - 1):
           ^
./cpplint/cpplint.py:2298:14: F821 undefined name 'xrange'
    for i in xrange(linenum - 1, self.starting_linenum, -1):
             ^
./cpplint/cpplint.py:3080:26: F821 undefined name 'xrange'
    for start_linenum in xrange(linenum, clean_lines.NumLines()):
                         ^
./cpplint/cpplint.py:3537:14: F821 undefined name 'xrange'
    for i in xrange(first_line, last_line + 1, 1):
             ^
./cpplint/cpplint.py:3601:19: F821 undefined name 'xrange'
    for offset in xrange(endlinenum + 1,
                  ^
./cpplint/cpplint.py:4155:14: F821 undefined name 'xrange'
    for i in xrange(linenum + 1, end_line):
             ^
./cpplint/cpplint.py:4283:23: F821 undefined name 'unicode'
  if isinstance(line, unicode):
                      ^
./cpplint/cpplint.py:4928:12: F821 undefined name 'xrange'
  for i in xrange(linenum, max(-1, linenum - 10), -1):
           ^
./cpplint/cpplint.py:4949:12: F821 undefined name 'xrange'
  for i in xrange(linenum, max(-1, linenum - 10), -1):
           ^
./cpplint/cpplint.py:4965:12: F821 undefined name 'xrange'
  for i in xrange(linenum, 1, -1):
           ^
./cpplint/cpplint.py:5066:20: F821 undefined name 'xrange'
          for i in xrange(startline, linenum + 1):
                   ^
./cpplint/cpplint.py:5090:14: F821 undefined name 'xrange'
    for i in xrange(linenum - 1, max(0, linenum - 10), -1):
             ^
./cpplint/cpplint.py:5121:14: F821 undefined name 'xrange'
    for i in xrange(2):
             ^
./cpplint/cpplint.py:5284:14: F821 undefined name 'xrange'
    for i in xrange(linenum - 1, max(0, linenum - 5), -1):
             ^
./cpplint/cpplint.py:5503:18: F821 undefined name 'xrange'
  for linenum in xrange(clean_lines.NumLines()):
                 ^
./cpplint/cpplint.py:5639:21: F821 undefined name 'xrange'
  for start_line in xrange(linenum, min(linenum + 3, clean_lines.NumLines())):
                    ^
./cpplint/cpplint.py:5654:12: F821 undefined name 'xrange'
  for i in xrange(end_line, min(end_line + 3, clean_lines.NumLines())):
           ^
./cpplint/cpplint.py:5911:15: F821 undefined name 'xrange'
  for line in xrange(clean_lines.NumLines()):
              ^
```
2018-03-12 18:13:00 +01:00
Titus Winters
209d38166b
Merge pull request #328 from pwnall/update_cpp_2
Minor updates to C++ style guide.
2018-02-21 05:53:16 -08:00
Victor Costan
4b9c0c0389 Minor updates to C++ style guide. 2018-02-21 05:44:55 -08:00
Titus Winters
a17678193a
Merge pull request #327 from pwnall/update_cpp
Update C++ styleguide to revision 3.277
2018-02-15 16:51:35 -05:00
Victor Costan
6dfd9d9de9 Update C++ styleguide to revision 3.277. 2018-02-07 12:42:22 -08:00
Google Python team
cfce3c3a86 Project import generated by Copybara.
PiperOrigin-RevId: 184571980
2018-02-05 15:52:03 -05:00
Ted Osborne
505ba68c74 Revert "Project import generated by Copybara."
This reverts commit 54cca78d64.
2018-01-30 12:36:50 -05:00
Google Python team
54cca78d64 Project import generated by Copybara.
PiperOrigin-RevId: 179577576
2018-01-30 12:10:03 -05:00
Tony Ruscoe
9663cabfee
Merge pull request #298 from tonyruscoe/gh-pages
Update HTML/CSS style guide
2017-11-15 11:57:39 +00:00
Tony Ruscoe
dc39c82233 Update HTML/CSS style guide
* Add an optional line-wrapping recommendation.
* Update links to the WHATWG HTML spec which were redirecting.
* Minor content and markup edits.
2017-11-15 11:50:33 +00:00
Tony Ruscoe
191c247522
Merge pull request #297 from MatthewGross/patch-1
Removing empty <pre> tags
2017-11-15 11:00:26 +00:00
Matthew Paul Gross
4b9f3fbe28
Removing empty <pre> tags 2017-11-14 13:12:02 -05:00
Mark Mentovai
664829b970
Merge pull request #294 from iam/root_test_fix
cpplint: Fix unittests when the styleguide directory is named otherwise
2017-11-10 20:16:50 -05:00
Igor Murashkin
4e8e56fb65 cpplint: Fix unittests when the styleguide directory is named otherwise
Don't hardcode the 'styleguide' directory in unit tests, instead
get it from the ../.. basename.
2017-11-10 16:52:24 -08:00
Mark Mentovai
58e2a524cd
Merge pull request #293 from iam/cpplint_quiet
cpplint: add --quiet flag to suppress all output when there's no errors
2017-11-10 17:54:14 -05:00
Igor Murashkin
e8ffd7ce60 cpplint: add --quiet flag to suppress all output when there's no errors
Example:

   cpplint.py --quiet <file-names>

Will now return with an exit code of 0 and return empty output if there
were no errors. This makes it particularly useful to be driven by a build system
such as makefiles or gradle.

In particular, these messages are now suppressed:

  Ignoring <filename>, excluded by CPPLINT.cfg, ...
  Done processing <filename>
  Total errors found: 0

If there were any errors, the above messages are printed nevertheless.

There is no behavior change if --quiet is not passed in.
2017-11-10 14:23:35 -08:00
Mark Mentovai
8667623865
Merge pull request #292 from iam/root_cpplint_cfg
CPPLINT.cfg root=setting is now relative to CFG file.
2017-11-09 23:10:53 -05:00
Igor Murashkin
8a87a46cc7 CPPLINT.cfg root=setting is now relative to CFG file.
Also further improve the documentation and testing around --root.

Previously the root=setting in the CFG file was treated identically
to passing --root=setting on the command line, which seems undesirable
since it depends on were cpplint.cfg was invoked from (for relative
paths).

Judging on settings such as 'exclude_files' it seems within the spirit
to make the settings 'current working directory' contextual to the
same directory that CPPLINT.cfg is in.

This also makes execution consistent (picking up the "correct" settings)
regardless of the CWD when executing cpplint.py.

Example:

  echo 'root=..' >> /a/b/c/CPPLINT.cfg
  cd /
  cpplint.py /a/b/c/source_file.h
  # expects header guard of C_SOURCE_FILE_H_

However the old behavior would use '/../' = '/'
and incorrectly think the root was 'A_B_C_SOURCE_FILE_H_'.
2017-11-09 16:36:27 -08:00
Mark Mentovai
d9e5e4dcb6
Merge pull request #291 from iam/root_flag_outer_directory
cpplint: --root now supports non-subdirectories
2017-11-08 17:36:27 -05:00
Igor Murashkin
e7ddd2af62 cpplint --root: support non-subdirectories
Using cpplint.py --root with directories at a more outer level
will now prepend the header guard with all the directories from the
root to the file.

For example given

  ls /a/b/c # /a/b/c/.git /a/b/c/filename.h
  cpplint.py --root=/a/b /a/b/c/filename.h   # C_FILENAME_H_

  # no root behavior:
  cpplint.py /a/b/c/filename.h               # FILENAME_H_

Also supports relative paths:

  cd /a/b/c
  cpplint.py --root=.. filename.h            # C_FILENAME_H_

Note that the old usage is still supported:

  cd /a/b/c
  mkdir -p d/e/f
  touch /a/b/c/d/e/f/filename.h
  cpplint.py --root=d/e/f d/e/f/filename.h   # FILENAME_H_

which would "strip" the prefix rather than prepend an extra prefix.

(Invalid root prefixes are as before also ignored)
2017-11-08 14:33:52 -08:00
Mark Mentovai
66f0d44381
Merge pull request #290 from google/revert-289-gh-pages
Revert "cpplint: Fix --root for non-subdirectories"
2017-11-08 13:18:12 -05:00
Mark Mentovai
d420095c75
Revert "cpplint: Fix --root for non-subdirectories" 2017-11-08 13:17:45 -05:00
Mark Mentovai
81ceafcd9d
Merge pull request #289 from iam/gh-pages
cpplint: Fix --root for non-subdirectories
2017-11-08 13:17:19 -05:00
Igor Murashkin
a38fcbb5b0 cpplint: Fix --root for non-subdirectories
Using cpplint.py --root with directories at a more outer level
than the repository would not work.

For example given

  /a/b/c/.git/filename.cpp

Trying to use --root=/a/b would get ignored, and it would
ask for a headerguard of FILENAME_H_ instead of C_FILENAME_H_
as expected.

Now --root will always use the "full name" and then strip off --root
prefix, giving us the desired effect.
2017-11-06 15:00:05 -08:00
Kevin Lindkvist
ec88ff999b Merge pull request #285 from google/update-objc
[objc] Update the Objective-C style guide 📜
2017-10-18 18:03:12 -07:00
Stephane Moore
4264801ce6 [objc] Update the Objective-C style guide 📜
Revision Date: 10/16/2017
2017-10-16 18:11:48 -07:00
Liam Miller-Cushon
911d9f4a7e Update Java style guide 2017-09-29 17:19:34 -07:00
Stephen Hicks
520cd9f88c Update intellij-java-google-style.xml
Fixes #252
Fixes #253
2017-09-07 11:59:01 -07:00
Donatas Kučinskas
f6a1ee14e1 Update eclipse-java-google-style (#271)
Remove blank lines between import groups to use [code style] (https://google.github.io/styleguide/javaguide.html#s3.3.3-import-ordering-and-spacing).

Fixes #270
2017-09-05 15:27:04 -07:00
Rommel M. Martinez
15afe031f1 Fix a typo 2017-09-05 15:22:44 -07:00
Stephane Moore
ef4219f259 Merge pull request #268 from google/objc-xml-linking
[objc] Make objcguide.xml link to objcguide.md 🔄
2017-08-25 14:26:14 -07:00
Stephane Moore
fc2b5ac747 [objc] Fix the link to the new Objective-C style guide ⛓
The link can't be relative because the new style guide is served as markdown and the endpoint serving the XML file serves raw content.
2017-08-24 17:48:51 -07:00
Stephane Moore
0c88671aa8 Merge pull request #269 from google/update-objc
[objc] Update the Objective-C style guide 📜
2017-08-23 18:37:49 -07:00
Stephane Moore
82d0af2190 [objc] Update the Objective-C style guide 📜
Revision Date: 8/23/2017
2017-08-23 14:59:52 -07:00
Stephane Moore
d6bc013ece [objc] Make objcguide.xml link to objcguide.md 🔄
There are links out in the wild to the old XML style guide. An XML file that links to the new style guide location ensures that those links are not completely broken.
2017-08-23 14:57:27 -07:00
Mark Mentovai
de57acaedf Update link to Objective-C style guide 2017-08-22 18:16:59 -04:00
Mark Mentovai
0d23d722dc Merge pull request #267 from stephanemoore/update-objc
[objc] Update the Objective-C style guide 📜
2017-08-22 18:14:33 -04:00
Kevin Lindkvist
c5197bfc48 [objc] Update the Objective-C style guide 📜
Revision Date: 8/16/2017
2017-08-17 14:47:20 -07:00
Elliot Glaysher
62385582b8 Merge pull request #162 from ctubbsii/eclipse-formatter-on-off-tags
Enabling formatter on/off tags
2017-08-15 10:14:04 -07:00
Eric Anderson
77f7f28d31 Merge pull request #153 from alanyee/gh-pages
Update broken link
2017-08-07 14:14:44 -07:00
Elliot Glaysher
6c8669edb2 Fix test regression from 9883c51578. 2017-07-28 14:54:33 -07:00
Elliot Glaysher
0c1c7f193f Merge pull request #265 from hammacher/remove-disallow-presubmit-check
Remove presubmit check for DISALLOW_* macros
2017-07-26 10:59:27 -07:00
Clemens Hammacher
9883c51578 Remove presubmit check for DISALLOW_* macros
Before C++11, we were using a hack to disable copy constructors or copy
assignment by declaring the methods private and not implementing them.
This hack required the respective macros to be placed in the private:
declarations of a class.
The macros have switched to use the C++11 "= delete" syntax some time
ago in both v8 and chromium:
https://codereview.chromium.org/1123723003/
https://codereview.chromium.org/2017213002

Also the comments are now updated, since the macros do not need to be
in the private: declarations any more:
https://chromium-review.googlesource.com/c/577687
https://chromium-review.googlesource.com/c/578027

This change also removes the presubmit check that checked that the
macros are only used in the private declarations.
2017-07-24 12:57:05 +02:00
Elliot Glaysher
d75bd35c8f Merge pull request #261 from jrobinson2/gh-pages
Fixed a typo.
2017-06-29 23:25:26 -07:00
James Robinson II
6161e33d8a Fixed a typo. 2017-06-29 22:16:49 -04:00