-
Notifications
You must be signed in to change notification settings - Fork 13.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add python 3 support to cpplint and cpplint_unittest #528
base: gh-pages
Are you sure you want to change the base?
Conversation
cpplint/cpplint_unittest.py
Outdated
@@ -37,6 +37,7 @@ | |||
import os | |||
import random | |||
import re | |||
import six |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a third party import, so it should be after unittest but before cpplint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
cpplint/cpplint_unittest.py
Outdated
@@ -3071,7 +3072,8 @@ def DoTest(self, raw_bytes, has_invalid_utf8): | |||
error_collector = ErrorCollector(self.assert_) | |||
cpplint.ProcessFileData( | |||
'foo.cc', 'cc', | |||
unicode(raw_bytes, 'utf8', 'replace').split('\n'), | |||
six.ensure_text(raw_bytes, encoding='utf8', | |||
errors='replace').split('\n'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent is off -- it should align with ( above
that said, you don't need six. just write raw_bytes.decode('utf-8', 'replace')
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
cpplint/cpplint_unittest.py
Outdated
@@ -3104,7 +3106,7 @@ def testBadCharacters(self): | |||
cpplint.ProcessFileData( | |||
'nul_utf8.cc', 'cc', | |||
['// Copyright 2014 Your Company.', | |||
unicode('\xe9x\0', 'utf8', 'replace'), ''], | |||
six.ensure_text(b'\xe9x\0', encoding='utf8', errors='replace'), ''], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent is off -- should be aligned with [ above
also as above, you don't need six
. call .decode()
on the byte directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
cpplint/cpplint_unittest.py
Outdated
@@ -5744,9 +5748,10 @@ def testQuietWithErrors(self): | |||
|
|||
def testNonQuietWithoutErrors(self): | |||
# This will succeed. We filtered out all the known errors for that file. | |||
(return_code, output) = self._runCppLint('--filter=' + | |||
(return_code, output_bytes) = self._runCppLint('--filter=' + | |||
'-legal/copyright,' + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent is off now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
cpplint/cpplint_unittest.py
Outdated
@@ -5758,10 +5763,11 @@ def testNonQuietWithoutErrors(self): | |||
|
|||
def testQuietWithoutErrors(self): | |||
# This will succeed. We filtered out all the known errors for that file. | |||
(return_code, output) = self._runCppLint('--quiet', | |||
(return_code, output_bytes) = self._runCppLint('--quiet', | |||
'--filter=' + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent is off now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
a4bde71
to
9670c3d
Compare
@vapier I was making these changes to the tests for our internal cpplint which already has support for python3. We need to substitute |
@markmentovai what's the story with cpplint in this repo ? is this the master copy ? or is it in google3 ? or is it cpplint/cpplint ? |
cpplint here was maintained by @eglaysher while he was at Google, and hasn’t seen much action since. I didn’t know anything about cpplint/cpplint until moments ago. |
I have pointed others who have come along at the https://github.com/cpplint/cpplint community maintained one as well due to lack of traction in getting any of us to maintain the version in this repo. Googlers: internally our Alternatively, if we're not going to maintain the version here I suggest deleting it and officially pointing external users at the aformentioned cpplint project. |
if we do have an internal copy to publish from, then publishing it here would be helpful. i think i've had it come up with other public repos that we wanted updated cpplint scripts. |
It’s just a question of ownership. If there are internal owners for cpplint, it’d be best for them to be involved in the process. But even if we can’t get that, if someone’s willing to do it best-effort (as Elliot had been doing) or even as a one-off, it’d be an improvement. |
See google#528 (comment). Google is no longer maintaining the public version of cpplint.
See #837 |
No description provided.