You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mesos.apache.org by Adam B <ad...@mesosphere.io> on 2014/04/03 01:54:10 UTC
Review Request 19967: Enabled whitespace/operators rule for cpplint.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/19967/
-----------------------------------------------------------
Review request for mesos and Dominic Hamon.
Bugs: MESOS-1181
https://issues.apache.org/jira/browse/MESOS-1181
Repository: mesos-git
Description
-------
Enabled whitespace/operators rule for cpplint, which covers the following:
'Missing spaces around ='
# You should always have whitespace around binary operators.
# Check <= and >= first to avoid false positives with < and >, then
# check non-include lines for spacing around < and >.
# We allow no-spaces around << when used like this: 10<<20, but
# not otherwise (particularly, not when used as streams)
# Also ignore using ns::operator<<;
'Missing spaces around <'
'Missing spaces around >'
# There shouldn't be space around unary operators
Diffs
-----
3rdparty/libprocess/include/process/pid.hpp fbd512f
src/common/type_utils.hpp 784a808
support/mesos-style.py edd41f926d6df30513f8fa6c928960e6495af70a
Diff: https://reviews.apache.org/r/19967/diff/
Testing
-------
Ran mesos-style.py over entire source base with whitespace/operators enabled.
Thanks,
Adam B
Re: Review Request 19967: Enabled whitespace/operators rule for cpplint.
Posted by Adam B <ad...@mesosphere.io>.
> On April 3, 2014, 10:10 a.m., Dominic Hamon wrote:
> > 3rdparty/libprocess/include/process/pid.hpp, line 44
> > <https://reviews.apache.org/r/19967/diff/1/?file=546925#file546925line44>
> >
> > i'm surprised this is necessary given the implicit bool conversion operator above.
> >
> > How does lint want this formatted?
> >
> > bool operator!() const ?
The lint check is pretty dumb. It's just verifying that '!' is never followed by a space, so "bool operator !()" would pass.
Since rebasing, this check also fails twice on "operator ++ ()" because '++' shouldn't have spaces on both sides, so that's "fixable" by removing the space on either side.
We can either (listed in order of my decreasing preference) a) NOLINT these 3 cases, b) disable the rule about "Extra space" (keeping the other operators rules for "Missing spaces"), c) fix the spacing in these (and a hundred other?) operator definitions, or d) forget about trying to enable this rule.
- Adam
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/19967/#review39427
-----------------------------------------------------------
On April 2, 2014, 4:54 p.m., Adam B wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/19967/
> -----------------------------------------------------------
>
> (Updated April 2, 2014, 4:54 p.m.)
>
>
> Review request for mesos and Dominic Hamon.
>
>
> Bugs: MESOS-1181
> https://issues.apache.org/jira/browse/MESOS-1181
>
>
> Repository: mesos-git
>
>
> Description
> -------
>
> Enabled whitespace/operators rule for cpplint, which covers the following:
> 'Missing spaces around ='
> # You should always have whitespace around binary operators.
> # Check <= and >= first to avoid false positives with < and >, then
> # check non-include lines for spacing around < and >.
> # We allow no-spaces around << when used like this: 10<<20, but
> # not otherwise (particularly, not when used as streams)
> # Also ignore using ns::operator<<;
> 'Missing spaces around <'
> 'Missing spaces around >'
> # There shouldn't be space around unary operators
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/include/process/pid.hpp fbd512f
> src/common/type_utils.hpp 784a808
> support/mesos-style.py edd41f926d6df30513f8fa6c928960e6495af70a
>
> Diff: https://reviews.apache.org/r/19967/diff/
>
>
> Testing
> -------
>
> Ran mesos-style.py over entire source base with whitespace/operators enabled.
>
>
> Thanks,
>
> Adam B
>
>
Re: Review Request 19967: Enabled whitespace/operators rule for cpplint.
Posted by Dominic Hamon <dh...@twopensource.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/19967/#review39427
-----------------------------------------------------------
3rdparty/libprocess/include/process/pid.hpp
<https://reviews.apache.org/r/19967/#comment71829>
i'm surprised this is necessary given the implicit bool conversion operator above.
How does lint want this formatted?
bool operator!() const ?
- Dominic Hamon
On April 2, 2014, 4:54 p.m., Adam B wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/19967/
> -----------------------------------------------------------
>
> (Updated April 2, 2014, 4:54 p.m.)
>
>
> Review request for mesos and Dominic Hamon.
>
>
> Bugs: MESOS-1181
> https://issues.apache.org/jira/browse/MESOS-1181
>
>
> Repository: mesos-git
>
>
> Description
> -------
>
> Enabled whitespace/operators rule for cpplint, which covers the following:
> 'Missing spaces around ='
> # You should always have whitespace around binary operators.
> # Check <= and >= first to avoid false positives with < and >, then
> # check non-include lines for spacing around < and >.
> # We allow no-spaces around << when used like this: 10<<20, but
> # not otherwise (particularly, not when used as streams)
> # Also ignore using ns::operator<<;
> 'Missing spaces around <'
> 'Missing spaces around >'
> # There shouldn't be space around unary operators
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/include/process/pid.hpp fbd512f
> src/common/type_utils.hpp 784a808
> support/mesos-style.py edd41f926d6df30513f8fa6c928960e6495af70a
>
> Diff: https://reviews.apache.org/r/19967/diff/
>
>
> Testing
> -------
>
> Ran mesos-style.py over entire source base with whitespace/operators enabled.
>
>
> Thanks,
>
> Adam B
>
>
Re: Review Request 19967: Enabled whitespace/operators rule for cpplint.
Posted by Dominic Hamon <dh...@twopensource.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/19967/#review42362
-----------------------------------------------------------
3rdparty/libprocess/include/process/pid.hpp
<https://reviews.apache.org/r/19967/#comment76142>
Thanks for the assessment - I agree.
- Dominic Hamon
On April 2, 2014, 4:54 p.m., Adam B wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/19967/
> -----------------------------------------------------------
>
> (Updated April 2, 2014, 4:54 p.m.)
>
>
> Review request for mesos and Dominic Hamon.
>
>
> Bugs: MESOS-1181
> https://issues.apache.org/jira/browse/MESOS-1181
>
>
> Repository: mesos-git
>
>
> Description
> -------
>
> Enabled whitespace/operators rule for cpplint, which covers the following:
> 'Missing spaces around ='
> # You should always have whitespace around binary operators.
> # Check <= and >= first to avoid false positives with < and >, then
> # check non-include lines for spacing around < and >.
> # We allow no-spaces around << when used like this: 10<<20, but
> # not otherwise (particularly, not when used as streams)
> # Also ignore using ns::operator<<;
> 'Missing spaces around <'
> 'Missing spaces around >'
> # There shouldn't be space around unary operators
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/include/process/pid.hpp fbd512f
> src/common/type_utils.hpp 784a808
> support/mesos-style.py edd41f926d6df30513f8fa6c928960e6495af70a
>
> Diff: https://reviews.apache.org/r/19967/diff/
>
>
> Testing
> -------
>
> Ran mesos-style.py over entire source base with whitespace/operators enabled.
>
>
> Thanks,
>
> Adam B
>
>
Re: Review Request 19967: Enabled whitespace/operators rule for cpplint.
Posted by Dominic Hamon <dh...@twopensource.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/19967/#review42363
-----------------------------------------------------------
Ship it!
Ship It!
- Dominic Hamon
On April 2, 2014, 4:54 p.m., Adam B wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/19967/
> -----------------------------------------------------------
>
> (Updated April 2, 2014, 4:54 p.m.)
>
>
> Review request for mesos and Dominic Hamon.
>
>
> Bugs: MESOS-1181
> https://issues.apache.org/jira/browse/MESOS-1181
>
>
> Repository: mesos-git
>
>
> Description
> -------
>
> Enabled whitespace/operators rule for cpplint, which covers the following:
> 'Missing spaces around ='
> # You should always have whitespace around binary operators.
> # Check <= and >= first to avoid false positives with < and >, then
> # check non-include lines for spacing around < and >.
> # We allow no-spaces around << when used like this: 10<<20, but
> # not otherwise (particularly, not when used as streams)
> # Also ignore using ns::operator<<;
> 'Missing spaces around <'
> 'Missing spaces around >'
> # There shouldn't be space around unary operators
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/include/process/pid.hpp fbd512f
> src/common/type_utils.hpp 784a808
> support/mesos-style.py edd41f926d6df30513f8fa6c928960e6495af70a
>
> Diff: https://reviews.apache.org/r/19967/diff/
>
>
> Testing
> -------
>
> Ran mesos-style.py over entire source base with whitespace/operators enabled.
>
>
> Thanks,
>
> Adam B
>
>
Re: Review Request 19967: Enabled whitespace/operators rule for cpplint.
Posted by Mesos ReviewBot <de...@mesos.apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/19967/#review39382
-----------------------------------------------------------
Patch looks great!
Reviews applied: [19775, 19967]
All tests passed.
- Mesos ReviewBot
On April 2, 2014, 11:54 p.m., Adam B wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/19967/
> -----------------------------------------------------------
>
> (Updated April 2, 2014, 11:54 p.m.)
>
>
> Review request for mesos and Dominic Hamon.
>
>
> Bugs: MESOS-1181
> https://issues.apache.org/jira/browse/MESOS-1181
>
>
> Repository: mesos-git
>
>
> Description
> -------
>
> Enabled whitespace/operators rule for cpplint, which covers the following:
> 'Missing spaces around ='
> # You should always have whitespace around binary operators.
> # Check <= and >= first to avoid false positives with < and >, then
> # check non-include lines for spacing around < and >.
> # We allow no-spaces around << when used like this: 10<<20, but
> # not otherwise (particularly, not when used as streams)
> # Also ignore using ns::operator<<;
> 'Missing spaces around <'
> 'Missing spaces around >'
> # There shouldn't be space around unary operators
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/include/process/pid.hpp fbd512f
> src/common/type_utils.hpp 784a808
> support/mesos-style.py edd41f926d6df30513f8fa6c928960e6495af70a
>
> Diff: https://reviews.apache.org/r/19967/diff/
>
>
> Testing
> -------
>
> Ran mesos-style.py over entire source base with whitespace/operators enabled.
>
>
> Thanks,
>
> Adam B
>
>
Re: Review Request 19967: Enabled whitespace/operators rule for cpplint.
Posted by Adam B <ad...@mesosphere.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/19967/#review39375
-----------------------------------------------------------
3rdparty/libprocess/include/process/pid.hpp
<https://reviews.apache.org/r/19967/#comment71764>
Alternatively, we could try to teach cpplint.py to ignore this warning if '!' follows 'operator', to handle operator overloading cases like this.
- Adam B
On April 2, 2014, 4:54 p.m., Adam B wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/19967/
> -----------------------------------------------------------
>
> (Updated April 2, 2014, 4:54 p.m.)
>
>
> Review request for mesos and Dominic Hamon.
>
>
> Bugs: MESOS-1181
> https://issues.apache.org/jira/browse/MESOS-1181
>
>
> Repository: mesos-git
>
>
> Description
> -------
>
> Enabled whitespace/operators rule for cpplint, which covers the following:
> 'Missing spaces around ='
> # You should always have whitespace around binary operators.
> # Check <= and >= first to avoid false positives with < and >, then
> # check non-include lines for spacing around < and >.
> # We allow no-spaces around << when used like this: 10<<20, but
> # not otherwise (particularly, not when used as streams)
> # Also ignore using ns::operator<<;
> 'Missing spaces around <'
> 'Missing spaces around >'
> # There shouldn't be space around unary operators
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/include/process/pid.hpp fbd512f
> src/common/type_utils.hpp 784a808
> support/mesos-style.py edd41f926d6df30513f8fa6c928960e6495af70a
>
> Diff: https://reviews.apache.org/r/19967/diff/
>
>
> Testing
> -------
>
> Ran mesos-style.py over entire source base with whitespace/operators enabled.
>
>
> Thanks,
>
> Adam B
>
>
Re: Review Request 19967: Enabled whitespace/operators rule for cpplint.
Posted by Adam B <ad...@mesosphere.io>.
> On May 6, 2014, 10:29 a.m., Dominic Hamon wrote:
> > 3rdparty/libprocess/include/process/pid.hpp, line 44
> > <https://reviews.apache.org/r/19967/diff/1/?file=546925#file546925line44>
> >
> > my preference would be c, but then i don't like the style guidance in this case ;)
> >
> > a means adding NOLINT to every overloaded operator, right?
At the moment, no. Cpplint currently only complains about the following unary operator patterns: "!\s|~\s|[\s]--[\s;]|[\s]\+\+[\s;]", which translates to 3 failures, one for "operator ! ()" and two for "operator ++ ()". However, if the cpplint rule is expanded in the future, it may cover other (binary/assignment) operator overloads.
There are over 100 operator overloads in libprocess, and since the rule is really intended to target normal operator use, not operator overload definitions, I don't think we should apply this weird style guidance to every operator overload. Since it's only 3 failures, I'm inclined to just tell cpplint to NOLINT(whitespace/operators) these lines.
- Adam
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/19967/#review42318
-----------------------------------------------------------
On April 2, 2014, 4:54 p.m., Adam B wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/19967/
> -----------------------------------------------------------
>
> (Updated April 2, 2014, 4:54 p.m.)
>
>
> Review request for mesos and Dominic Hamon.
>
>
> Bugs: MESOS-1181
> https://issues.apache.org/jira/browse/MESOS-1181
>
>
> Repository: mesos-git
>
>
> Description
> -------
>
> Enabled whitespace/operators rule for cpplint, which covers the following:
> 'Missing spaces around ='
> # You should always have whitespace around binary operators.
> # Check <= and >= first to avoid false positives with < and >, then
> # check non-include lines for spacing around < and >.
> # We allow no-spaces around << when used like this: 10<<20, but
> # not otherwise (particularly, not when used as streams)
> # Also ignore using ns::operator<<;
> 'Missing spaces around <'
> 'Missing spaces around >'
> # There shouldn't be space around unary operators
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/include/process/pid.hpp fbd512f
> src/common/type_utils.hpp 784a808
> support/mesos-style.py edd41f926d6df30513f8fa6c928960e6495af70a
>
> Diff: https://reviews.apache.org/r/19967/diff/
>
>
> Testing
> -------
>
> Ran mesos-style.py over entire source base with whitespace/operators enabled.
>
>
> Thanks,
>
> Adam B
>
>
Re: Review Request 19967: Enabled whitespace/operators rule for cpplint.
Posted by Dominic Hamon <dh...@twopensource.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/19967/#review42318
-----------------------------------------------------------
3rdparty/libprocess/include/process/pid.hpp
<https://reviews.apache.org/r/19967/#comment76084>
my preference would be c, but then i don't like the style guidance in this case ;)
a means adding NOLINT to every overloaded operator, right?
- Dominic Hamon
On April 2, 2014, 4:54 p.m., Adam B wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/19967/
> -----------------------------------------------------------
>
> (Updated April 2, 2014, 4:54 p.m.)
>
>
> Review request for mesos and Dominic Hamon.
>
>
> Bugs: MESOS-1181
> https://issues.apache.org/jira/browse/MESOS-1181
>
>
> Repository: mesos-git
>
>
> Description
> -------
>
> Enabled whitespace/operators rule for cpplint, which covers the following:
> 'Missing spaces around ='
> # You should always have whitespace around binary operators.
> # Check <= and >= first to avoid false positives with < and >, then
> # check non-include lines for spacing around < and >.
> # We allow no-spaces around << when used like this: 10<<20, but
> # not otherwise (particularly, not when used as streams)
> # Also ignore using ns::operator<<;
> 'Missing spaces around <'
> 'Missing spaces around >'
> # There shouldn't be space around unary operators
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/include/process/pid.hpp fbd512f
> src/common/type_utils.hpp 784a808
> support/mesos-style.py edd41f926d6df30513f8fa6c928960e6495af70a
>
> Diff: https://reviews.apache.org/r/19967/diff/
>
>
> Testing
> -------
>
> Ran mesos-style.py over entire source base with whitespace/operators enabled.
>
>
> Thanks,
>
> Adam B
>
>