flake8
-
reviewboard/reviews/actions.py (Diff revision 1) Show all issues
JSHint
-
reviewboard/static/rb/js/pages/views/basePageView.es6.js (Diff revision 1) Expected '===' and instead saw '=='. Column: 46 Error code: W116
Review Request #12757 — Created Dec. 22, 2022 and submitted
Information | |
---|---|
david | |
Review Board | |
release-6.x | |
Reviewers | |
reviewboard | |
The new actions framework has a lot more flexibility and consistency
than the old one. This change ports over our existing review request
actions and extension hooks to use it. In addition, several things which
worked like actions (like the star and archive/mute menu) but were
implemented outside of the framework have been rewritten to be actions
instead.This also reimplements the client-side styling and logic for menus and
the mobile menu, using the new CSS component style and building on
RB.MenuView for the drop-downs. This gives us more consistent style
rules as well as support for keyboard and screen-reader accessibility.
Summary | |
---|---|
Description | From | Last Updated |
---|---|---|
Typo in the description: "conistency" -> "consistency" |
|
|
undefined name 'parent' Column: 52 Error code: F821 |
![]() |
|
Expected '===' and instead saw '=='. Column: 46 Error code: W116 |
![]() |
|
Is it possible for people to make their own attachment points? From the docs it's unclear whether this is possible … |
![]() |
|
Should there be 2 spaces here? |
![]() |
|
Should there be 2 spaces here? |
![]() |
|
This could use some updating to mention how we can have non-UI actions and actions for the unified banner, maybe … |
![]() |
|
This could all fit on one line I think. |
![]() |
|
Add -> None: |
![]() |
|
Update the description, action arg type and Raises section of this method to include how the given action can be … |
![]() |
|
Missing a space between "reviewrequest". |
![]() |
|
I wonder if it would be worthwhile to make some mixins or decorators for some of the repeated access control … |
![]() |
|
Should we wrap reviewboard.actions.actions_registry in some Sphinx directive? Would :py:obj: work? |
![]() |
|
Should we wrap reviewboard.actions.actions_registry in some Sphinx directive? Would :py:obj: work? |
![]() |
|
Could sort this alphabetically. |
![]() |
|
Maybe worth making all of these links/refs to the appropriate attributes/methods? |
|
|
Super small nit, but I feel like this may read better with the IDs grouped together |
|
|
Can we document this, with a Version Added? |
|
|
While not a problem, we shouldn't need to do this, as initialize is intentionally empty by default. |
|
|
Can we add a type/docs for this on the class body? |
|
|
Changing the IDs here (and below) might break existing extensions. |
|
|
What's the TODO? |
|
|
Alignment issue. |
|
|
This can probably use self.create_http_request(...) |
|
|
This seems unrelated. |
|
|
Everything in here but the perms and seems to return a bool result. Maybe we just want bool(...) for perms? |
|
|
Same comment about perms here. Also, can we add a blank line before return statements? |
|
|
Leftover debugging information. |
|
|
This isn't something we can reverse? |
|
|
This doesn't have to be this change, but we should track it: We could improve this through a ReviewRequest.has_diffsets() method … |
|
|
Same comment about perms. |
|
|
Super tiny nit for all these similar blocks. We have 3 lines that pull from context, and one line that … |
|
|
Same here about perms. |
|
|
Same comment about perms. |
|
|
For these, it'd be nice to group related attributes. action_id and parent_id should probably go together. attachment and apply_to feel … |
|
|
Since extensions will most likely be using some subclass of this, we should ideally use that name. Not sure what … |
|
|
Can you put this in alphabetical order? |
|
|
Can this be self.child_actions = child_actions or []? |
|
|
Can you put this in alphabetical order? |
|
|
Can we state in the docs here and below that we're removing this in 7? |
|
|
Missing a trailing period. |
|
|
Missing a trailing period. |
|
|
Missing a trailing period. |
|
|
djblets is mixed in with django. |
|
|
Older code, but I think this can be: self.assertIs( self.action.should_render(context=request_context), getattr(self, 'read_only_always_show', False)) Though, maybe less obvious? I don't know. |
|
|
Too much JS! deprecation_message :) But with my other comments about fixing warnings to be per-class, this will need to … |
|
|
These should be assertIsNone. Same with many below. |
|
|
This is hard to read. Can we go with keyword arguments here, like create_http_request does? (And same elsewhere.) I almost … |
|
|
Can we explicitly return a value if we don't return in the loop? Right now we just get an implicit … |
|
|
While here, can we alphabetize these? |
|
|
Can we add Version Added to each of these? |
|
|
Can you put parens around the comparison? Helps with readability, given the =. |
|
|
We should keep to public before private. Also, it'd be nice to have docs for the public attributes. |
|
|
Extra blank line here. |
|
|
Can we break this down into the multi-line format? Any time we have typing in params. Same with others. |
|
|
Can we document this as well? And same with other public attributes. |
|
|
I don't think we need export {} anymore. |
|
|
Can we alphabetize these? |
|
|
actions should go after accounts, alphabetically. |
|
|
Missing quotes around the {{action.get_dom_element_id}}. |
|
|
No space needed before style. |
|
|
Missing quotes around {{action.get_dom_element_id}}. |
|
reviewboard/reviews/actions.py (Diff revision 1) |
---|
reviewboard/static/rb/js/pages/views/basePageView.es6.js (Diff revision 1) |
---|
Expected '===' and instead saw '=='. Column: 46 Error code: W116
Commits: |
|
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 2 (+4540 -3148) |
Update for change in class names.
Commits: |
|
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 3 (+4540 -3148) |
docs/manual/extending/extensions/hooks/action-hooks.rst (Diff revision 3) |
---|
Is it possible for people to make their own attachment points? From the docs it's unclear whether this is possible and how to do this, maybe we could elaborate on this.
docs/manual/extending/extensions/hooks/action-hooks.rst (Diff revision 3) |
---|
Should there be 2 spaces here?
docs/manual/extending/extensions/hooks/action-hooks.rst (Diff revision 3) |
---|
Should there be 2 spaces here?
reviewboard/extensions/hooks.py (Diff revision 3) |
---|
This could use some updating to mention how we can have non-UI actions and actions for the unified banner, maybe you could link to the AttachmentPoint class too.
reviewboard/extensions/hooks.py (Diff revision 3) |
---|
Update the description,
action
arg type andRaises
section of this method to include how the given action can be aBaseReviewRequestMenuAction
.
reviewboard/reviews/actions.py (Diff revision 3) |
---|
I wonder if it would be worthwhile to make some mixins or decorators for some of the repeated access control logic we have in the
should_render
methods for these actions.
reviewboard/reviews/actions.py (Diff revision 3) |
---|
Should we wrap
reviewboard.actions.actions_registry
in some Sphinx directive? Would:py:obj:
work?
reviewboard/reviews/actions.py (Diff revision 3) |
---|
Should we wrap
reviewboard.actions.actions_registry
in some Sphinx directive? Would:py:obj:
work?
Commits: |
|
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 4 (+4560 -3136) |
Commits: |
|
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 5 (+4520 -3136) |
Commits: |
|
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 6 (+4870 -3206) |
docs/manual/extending/extensions/hooks/action-hooks.rst (Diff revision 6) |
---|
Maybe worth making all of these links/refs to the appropriate attributes/methods?
docs/manual/extending/extensions/hooks/action-hooks.rst (Diff revision 6) |
---|
Super small nit, but I feel like this may read better with the IDs grouped together
reviewboard/extensions/hooks.py (Diff revision 6) |
---|
While not a problem, we shouldn't need to do this, as
initialize
is intentionally empty by default.
reviewboard/extensions/hooks.py (Diff revision 6) |
---|
Can we add a type/docs for this on the class body?
reviewboard/extensions/hooks.py (Diff revision 6) |
---|
Changing the IDs here (and below) might break existing extensions.
reviewboard/extensions/tests/test_action_hooks.py (Diff revision 6) |
---|
This can probably use
self.create_http_request(...)
reviewboard/reviews/actions.py (Diff revision 6) |
---|
Everything in here but the
perms and
seems to return abool
result. Maybe we just wantbool(...)
forperms
?
reviewboard/reviews/actions.py (Diff revision 6) |
---|
Same comment about
perms
here.Also, can we add a blank line before
return
statements?
reviewboard/reviews/actions.py (Diff revision 6) |
---|
This doesn't have to be this change, but we should track it:
We could improve this through a
ReviewRequest.has_diffsets()
method that checks:
- Is
self._diffsets
set (viaget_diffsets()
). If so, use that.- Is
diffset_history
loaded from the database? If so, use thatdiffsets
relation.- Else, do
DiffSet.objects.filter(history=self.diffset_history_id).exists()
reviewboard/reviews/actions.py (Diff revision 6) |
---|
Super tiny nit for all these similar blocks. We have 3 lines that pull from
context
, and one line that doesn't, smack in the middle. It'd be nice to separate that one out.
reviewboard/reviews/actions.py (Diff revision 6) |
---|
For these, it'd be nice to group related attributes.
action_id
andparent_id
should probably go together.attachment
andapply_to
feel related.
reviewboard/reviews/actions.py (Diff revision 6) |
---|
Since extensions will most likely be using some subclass of this, we should ideally use that name.
Not sure what the best approach is to get that name, since
type(self).__name__
will return the subclass.But we probably should list that anyway in the error message, so there's a warning per-usage, instead of only one per-process (since warnings with the same text don't repeat).
reviewboard/reviews/actions.py (Diff revision 6) |
---|
Can this be
self.child_actions = child_actions or []
?
reviewboard/reviews/actions.py (Diff revision 6) |
---|
Can we state in the docs here and below that we're removing this in 7?
reviewboard/reviews/tests/test_actions.py (Diff revision 6) |
---|
Older code, but I think this can be:
self.assertIs( self.action.should_render(context=request_context), getattr(self, 'read_only_always_show', False))
Though, maybe less obvious? I don't know.
reviewboard/reviews/tests/test_actions.py (Diff revision 6) |
---|
Too much JS!
deprecation_message
:)But with my other comments about fixing warnings to be per-class, this will need to go away and move into the tests.
reviewboard/reviews/tests/test_actions.py (Diff revision 6) |
---|
These should be
assertIsNone
.Same with many below.
reviewboard/reviews/tests/test_actions.py (Diff revision 6) |
---|
This is hard to read. Can we go with keyword arguments here, like
create_http_request
does? (And same elsewhere.)I almost wonder if we should ditch
self.request
and just have tests provide what they want increate_http_request
, so it's all self-contained. But probably not worth it for this change.
reviewboard/static/rb/js/pages/views/basePageView.es6.js (Diff revision 6) |
---|
Can we explicitly return a value if we don't return in the loop?
Right now we just get an implicit
undefined
.
reviewboard/static/rb/js/pages/views/reviewablePageView.es6.js (Diff revision 6) |
---|
While here, can we alphabetize these?
reviewboard/static/rb/js/reviews/actions/views/reviewRequestActions.ts (Diff revision 6) |
---|
Can we add
Version Added
to each of these?
reviewboard/static/rb/js/reviews/actions/views/reviewRequestActions.ts (Diff revision 6) |
---|
Can you put parens around the comparison? Helps with readability, given the
=
.
reviewboard/static/rb/js/reviews/actions/views/reviewRequestActions.ts (Diff revision 6) |
---|
Extra blank line here.
reviewboard/static/rb/js/reviews/actions/views/reviewRequestActions.ts (Diff revision 6) |
---|
Can we break this down into the multi-line format? Any time we have typing in params.
Same with others.
reviewboard/static/rb/js/reviews/index.ts (Diff revision 6) |
---|
I don't think we need
export {}
anymore.
reviewboard/templates/reviews/archive_action.html (Diff revision 6) |
---|
Missing quotes around the
{{action.get_dom_element_id}}
.
reviewboard/templates/reviews/archive_menu_action.html (Diff revision 6) |
---|
No space needed before
style
.
reviewboard/templates/reviews/star_action.html (Diff revision 6) |
---|
Missing quotes around
{{action.get_dom_element_id}}
.
Summary: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
Commits: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
Diff: |
Revision 7 (+3896 -3042) |
The change looks great.
I have a couple comments about documentation. I want to try to get our public docs a bit more fleshed out so it's easier to later track deprecations and usage and typing as we go forward.
reviewboard/static/rb/js/reviews/actions/views/reviewRequestActions.ts (Diff revisions 6 - 7) |
---|
We should keep to public before private.
Also, it'd be nice to have docs for the public attributes.
reviewboard/static/rb/js/reviews/actions/views/reviewRequestActions.ts (Diff revisions 6 - 7) |
---|
Can we document this as well?
And same with other public attributes.
Commits: |
|
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 8 (+3912 -3042) |