flake8
-
rbtools/clients/clearcase.py (Diff revision 1) Show all issues -
Review Request #11582 — Created April 7, 2021 and submitted
Information | |
---|---|
david | |
RBTools | |
master | |
Reviewers | |
rbtools | |
We will soon be adding a new SCMTool implementation to Power Pack to connect to
HCL VersionVault and IBM ClearCase, supplanting the old community-driven
ClearCase support. This change adds RBTools-side support for this.This is based on code delivered to us in partnership with HCL, but has had
significant changes. The largest change is that instead of having a completely
separate SCMClient implementation in RBTools, this is built into the same
ClearCase client. Most of the code paths are the same between the two types of
backends, and the major difference is that the diff output for VersionVault
includes additional information in the headers (the VOB OID for each changed
element, and a JSON-encoded blob to drop into the FileDiff's extra_data in order
to do better post-processing on the diff display).There's still more to do for unit testing but functionality should be
relatively complete at this point.
Summary | |
---|---|
Description | From | Last Updated |
---|---|---|
E501 line too long (81 > 79 characters) |
![]() |
|
E722 do not use bare except' |
![]() |
|
, optional? |
|
|
F401 'rbtools.api.errors.AuthorizationError' imported but unused |
![]() |
|
Blank line after class docstring. |
|
|
These are so close. Can we build up the cmdline based on self.label and then pass in to execute()? |
|
|
Should be is_ucm. |
|
|
Can you specify explicitly which is which? |
|
|
Can you update this to point to the full class path? |
|
|
E501 line too long (81 > 79 characters) |
![]() |
|
I think we can just use os.pathsep for this, which is for things like $PATH. Same with the earlier usage … |
|
|
Is Qp part of this? |
|
|
These are pretty close. Can we build up a cmdline and then pass it to execute()? |
|
|
F821 undefined name 're' |
![]() |
|
Let's compile the regex right before and then reuse that. I don't think we need the [ and ] though. |
|
|
You can pass a tuple of choices here. |
|
|
You can use os.pathsep here too. Kinda wonder if we should predefine constants for the environment variables on the class … |
|
|
Given how simple this logic is, how about just: if label != 'LATEST' and not self._is_a_label(label, tag): labels_present = False |
|
|
Small nit, but mind alphabetizing these? We also build the string twice. Might as well do it once and then … |
|
|
We can just pass split_lines=True to execute(). |
|
|
F821 undefined name 're' |
![]() |
|
Just to check, are we splitting on \s, :, or @? Or on \s:@? The [] will give us the … |
|
|
Instead of setting twice, maybe have the second do: extra_data['new'] = extra_data['old'].copy() |
|
|
No need for , None on these. |
|
|
E722 do not use bare except' |
![]() |
|
E201 whitespace after '{' |
![]() |
|
E202 whitespace before '}' |
![]() |
|
E272 multiple spaces before keyword |
![]() |
|
E272 multiple spaces before keyword |
![]() |
|
F841 local variable 'CLEARCASE_PN' is assigned to but never used |
![]() |
|
F841 local variable 'commmand' is assigned to but never used |
![]() |
|
F821 undefined name 'command' |
![]() |
|
E501 line too long (91 > 79 characters) |
![]() |
|
E501 line too long (97 > 79 characters) |
![]() |
|
E501 line too long (97 > 79 characters) |
![]() |
|
E501 line too long (109 > 79 characters) |
![]() |
|
E501 line too long (107 > 79 characters) |
![]() |
|
E501 line too long (115 > 79 characters) |
![]() |
|
E201 whitespace after '{' |
![]() |
|
E202 whitespace before '}' |
![]() |
|
E501 line too long (91 > 79 characters) |
![]() |
|
E501 line too long (97 > 79 characters) |
![]() |
|
E501 line too long (97 > 79 characters) |
![]() |
|
E501 line too long (107 > 79 characters) |
![]() |
|
E201 whitespace after '{' |
![]() |
|
E202 whitespace before '}' |
![]() |
|
F811 redefinition of unused 'test_get_repository_info_dynamic' from line 107 |
![]() |
|
E501 line too long (84 > 79 characters) |
![]() |
|
E501 line too long (91 > 79 characters) |
![]() |
|
E501 line too long (97 > 79 characters) |
![]() |
|
E501 line too long (97 > 79 characters) |
![]() |
|
E501 line too long (107 > 79 characters) |
![]() |
|
E201 whitespace after '{' |
![]() |
|
E202 whitespace before '}' |
![]() |
|
E501 line too long (84 > 79 characters) |
![]() |
|
E501 line too long (91 > 79 characters) |
![]() |
|
E501 line too long (97 > 79 characters) |
![]() |
|
E501 line too long (97 > 79 characters) |
![]() |
|
E501 line too long (107 > 79 characters) |
![]() |
|
E131 continuation line unaligned for hanging indent |
![]() |
|
E201 whitespace after '{' |
![]() |
|
E202 whitespace before '}' |
![]() |
|
Probably should be , optional. |
|
|
The common part was split out, but these are overriding instead of appending to it. |
|
|
No blank line here. |
|
|
Typo: "becaue" -> "because" |
|
|
To ensure doc building works right, the format: should be format::. This will turn this into a code block. |
|
|
I have no idea if it's faster or not, but we can probably just have this be: if '%s/' % … |
|
|
Is "base clearcase" correct? Drawing a blank on the term. Is this just IBM ClearCase? |
|
|
Can we update these to use the formal capitalization of these names? |
|
|
Small nit: Alphabetical order? |
|
|
E303 too many blank lines (2) |
![]() |
|
E501 line too long (89 > 79 characters) |
![]() |
|
F401 'json' imported but unused |
![]() |
|
E501 line too long (80 > 79 characters) |
![]() |
|
E501 line too long (81 > 79 characters) |
![]() |
|
E501 line too long (80 > 79 characters) |
![]() |
|
E501 line too long (81 > 79 characters) |
![]() |
|
F841 local variable 'diffx_file' is assigned to but never used |
![]() |
|
F841 local variable 'file_split_re' is assigned to but never used |
![]() |
|
E501 line too long (81 > 79 characters) |
![]() |
|
E501 line too long (81 > 79 characters) |
![]() |
|
Given how old this is, let's nuke it and instead put 3.0, and mention the new support. |
|
|
Definitions generally go at the bottom of the section (the rest of our docs do this). |
|
|
The "3.0" has to be on the next line for section parsing to consider this correctly. |
|
|
Can you add "Version Added"? |
|
|
I don't know what's really correct, but historically we've put __init__ before @properties. We should probably err on the side … |
|
|
Minor thing, but should these have quotes around the examples? |
|
|
Maybe double backticks around teh <...> bits? |
|
|
"a was removed" -> "was removed" |
|
|
This isn't true anymore, right? Given the docs in the function. |
|
|
Is there supposed to be a trailing comma on -predecessor? |
|
|
Can we maek this a standard private function? I feel like this doesn't really need to be inline like this. |
|
|
These could be combined. |
|
|
"Return ..." better describes what this is doing. |
|
|
Given that we never really need i, this can probably just be a standard for f in files. |
|
|
Same as above. |
|
|
Same as above. |
|
|
This is repeated a lot. How about building the base command line outside the loop, then just do cmdline + … |
|
|
Just to check, is the extra space on the 3rd line here intentional? It shows up on the other examples … |
|
|
E265 block comment should start with '# ' |
![]() |
|
F821 undefined name '_get_content_snapshot' |
![]() |
|
F821 undefined name '_get_content_snapshot' |
![]() |
|
E303 too many blank lines (2) |
![]() |
|
F821 undefined name 'i' |
![]() |
Summary: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
Commits: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
Diff: |
Revision 2 (+1452 -452) |
rbtools/clients/clearcase.py (Diff revision 2) |
---|
F401 'rbtools.api.errors.AuthorizationError' imported but unused
rbtools/clients/clearcase.py (Diff revision 2) |
---|
These are so close. Can we build up the cmdline based on
self.label
and then pass in toexecute()
?
rbtools/clients/clearcase.py (Diff revision 2) |
---|
I think we can just use
os.pathsep
for this, which is for things like$PATH
.Same with the earlier usage as well.
rbtools/clients/clearcase.py (Diff revision 2) |
---|
These are pretty close. Can we build up a cmdline and then pass it to
execute()
?
rbtools/clients/clearcase.py (Diff revision 2) |
---|
Let's compile the regex right before and then reuse that.
I don't think we need the
[
and]
though.
rbtools/clients/clearcase.py (Diff revision 2) |
---|
You can use
os.pathsep
here too.Kinda wonder if we should predefine constants for the environment variables on the class on first use or something, cut down on the conditionals further. Super not important, but just a food-for-thought thing.
rbtools/clients/clearcase.py (Diff revision 2) |
---|
Given how simple this logic is, how about just:
if label != 'LATEST' and not self._is_a_label(label, tag): labels_present = False
rbtools/clients/clearcase.py (Diff revision 2) |
---|
Small nit, but mind alphabetizing these?
We also build the string twice. Might as well do it once and then set.
rbtools/clients/clearcase.py (Diff revision 2) |
---|
Just to check, are we splitting on
\s
,:
, or@
? Or on\s:@
? The[]
will give us the former.
rbtools/clients/clearcase.py (Diff revision 2) |
---|
Instead of setting twice, maybe have the second do:
extra_data['new'] = extra_data['old'].copy()
Continued progress
Commits: |
|
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 3 (+2204 -472) |
Warning: Showing 30 of 38 failures.
rbtools/clients/clearcase.py (Diff revision 3) |
---|
F841 local variable 'CLEARCASE_PN' is assigned to but never used
rbtools/clients/clearcase.py (Diff revision 3) |
---|
F841 local variable 'commmand' is assigned to but never used
rbtools/clients/tests/test_clearcase.py (Diff revision 3) |
---|
F811 redefinition of unused 'test_get_repository_info_dynamic' from line 107
Review Bot
Commits: |
|
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 4 (+2300 -472) |
rbtools/clients/tests/test_clearcase.py (Diff revision 4) |
---|
E131 continuation line unaligned for hanging indent
More Review Bot
Commits: |
|
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 5 (+2300 -472) |
Commits: |
|
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 6 (+2390 -554) |
Commits: |
|
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 7 (+2398 -556) |
This is looking great. A few small things.
rbtools/clients/clearcase.py (Diff revision 7) |
---|
The common part was split out, but these are overriding instead of appending to it.
rbtools/clients/clearcase.py (Diff revision 7) |
---|
To ensure doc building works right, the
format:
should beformat::
. This will turn this into a code block.
rbtools/clients/clearcase.py (Diff revision 7) |
---|
I have no idea if it's faster or not, but we can probably just have this be:
if '%s/' % tag in path: break
rbtools/clients/clearcase.py (Diff revision 7) |
---|
Purely a suggestion, and not important for this change: Might be nice to have a
_run_cleartool()
command or something that takes the vobs or other things we need and builds them in a platform-dependent way in one place, so we can consolidate this sort of logic.The environment variable constants we define elsewhere could maybe be done on a class level.
rbtools/clients/tests/test_clearcase.py (Diff revision 7) |
---|
Is "base clearcase" correct? Drawing a blank on the term. Is this just IBM ClearCase?
rbtools/clients/tests/test_clearcase.py (Diff revision 7) |
---|
Can we update these to use the formal capitalization of these names?
rmver
ed.rmver
ed.Summary: |
|
|||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: |
|
|||||||||||||||||||||||||||||||||||||||||||||
Testing Done: |
|
|||||||||||||||||||||||||||||||||||||||||||||
Commits: |
|
|||||||||||||||||||||||||||||||||||||||||||||
Diff: |
Revision 8 (+2776 -600) |
Commits: |
|
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 9 (+2776 -600) |
Description: |
|
|||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Testing Done: |
|
|||||||||||||||||||||||||||||||||||||||||||||
Commits: |
|
|||||||||||||||||||||||||||||||||||||||||||||
Diff: |
Revision 10 (+3694 -712) |
rbtools/clients/clearcase.py (Diff revision 10) |
---|
F841 local variable 'diffx_file' is assigned to but never used
rbtools/clients/clearcase.py (Diff revision 10) |
---|
F841 local variable 'file_split_re' is assigned to but never used
ReviewBot
Commits: |
|
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 11 (+3698 -712) |
docs/rbtools/rbt/commands/post.rst (Diff revision 11) |
---|
Given how old this is, let's nuke it and instead put 3.0, and mention the new support.
rbtools/clients/clearcase.py (Diff revision 11) |
---|
I don't know what's really correct, but historically we've put
__init__
before@properties
. We should probably err on the side of consistency.
rbtools/clients/clearcase.py (Diff revision 11) |
---|
Minor thing, but should these have quotes around the examples?
rbtools/clients/clearcase.py (Diff revision 11) |
---|
This isn't true anymore, right? Given the docs in the function.
rbtools/clients/clearcase.py (Diff revision 11) |
---|
Is there supposed to be a trailing comma on
-predecessor
?
rbtools/clients/clearcase.py (Diff revision 11) |
---|
Can we maek this a standard private function? I feel like this doesn't really need to be inline like this.
rbtools/clients/clearcase.py (Diff revision 11) |
---|
Given that we never really need
i
, this can probably just be a standardfor f in files
.
rbtools/clients/clearcase.py (Diff revision 11) |
---|
This is repeated a lot. How about building the base command line outside the loop, then just do
cmdline + [old_file]
(etc)?
rbtools/clients/tests/test_clearcase.py (Diff revision 11) |
---|
Just to check, is the extra space on the 3rd line here intentional? It shows up on the other examples below as well.
Commits: |
|
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 12 (+3740 -720) |
Commits: |
|
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 13 (+3736 -720) |
docs/rbtools/rbt/commands/post.rst (Diff revisions 11 - 13) |
---|
Definitions generally go at the bottom of the section (the rest of our docs do this).
rbtools/clients/clearcase.py (Diff revisions 11 - 13) |
---|
The "3.0" has to be on the next line for section parsing to consider this correctly.
rbtools/clients/clearcase.py (Diff revisions 11 - 13) |
---|
"Return ..." better describes what this is doing.
Commits: |
|
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 14 (+3738 -720) |