Skip to content

Restapi refactor #2890

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

Closed
wants to merge 8 commits into from
Closed

Conversation

cmc333333
Copy link
Contributor

This includes some simple tweaks in addition to slightly more significant refactors to split up some functions. Easiest to review changeset by changeset.

This is a first step and only adds docstrings, etc. It doesn't refactor any
code.
@cmc333333 cmc333333 force-pushed the restapi-linting branch 2 times, most recently from ad0578b to de4ffb1 Compare May 23, 2017 06:30
CM Lubinski added 4 commits May 22, 2017 23:54
In several cases, we can use the provided `request` rather than access `self`
(which could make these functions easier to test in isolation). In others, the
unused args could be folded into an unnamed kwarg param.
Smaller functions should be easier to test independently. This will also
resolve a pyflakes warning.
This worked as intended, but only because the overridden section variable
would later evaluate to True. Using a different variable name makes this a bit
less error-prone.
By splitting the function up, we not only resolve pyflakes issues around local
variables, we also make this function easier to test.

I don't like the SectionIndexer approach, but there was a chunk of state
(section_index_list) which was extended in each loop iteration. To recreate
that functionality while limiting the number of lines in each loop, the state
is moved into a separate object. If the original logic was faulty, this could
be much more legible.
@agjohnson agjohnson modified the milestone: Cleanup May 23, 2017
@agjohnson
Copy link
Contributor

Okay, so i've cherry-picked the linting changes in #2938 and got that merged, so lets view this as a refactor only PR -- could you rebase, or perhaps it's easier to even just create a new branch? Whatever works.

The refactor here was slowing this PR down and I think there might need to be some more back and forth before the refactor gets merged. Some of the patterns in the refactor could be reduced or more generalized, so I'd like to find a good balance there.

@agjohnson agjohnson added PR: work in progress Pull request is not ready for full review and removed PR: ready for review labels Jun 9, 2017
@agjohnson agjohnson changed the title Restapi linting Restapi refactor Jun 9, 2017
@cmc333333
Copy link
Contributor Author

👍 I think the relevant changesets are 67e936d and c955155 ; happy to pull those into a separate PR.

@cmc333333 cmc333333 closed this Jun 9, 2017
@agjohnson agjohnson removed the PR: work in progress Pull request is not ready for full review label Jun 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants