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

View Cleanup - Initial steps #3202

merged 5 commits into from Jun 16, 2018


None yet
2 participants
Copy link

madt1m commented Jun 13, 2018

So, here we start with the refactoring of the View addon. Since the addon is quite complex, and its usage spread to many points in the codebase, this will be an incremental process - as suggested in #3198 .

The API Structure

The current API is composed of the following sections:

  • Focus -> movements of focus in the view.

  • Order -> order key manipulation, and querying, of flows in the view.

  • Filter -> filter manipulation, and querying, of flows showed in the view.

  • Flows -> operation on flows (create, remove, duplicates)

  • Settings -> querying and setting of values in the Settings object of the View.

  • Updates and Properties -> this is kinda misc. I feel this could go somewhere else for further modularity, but for now I will leave those 'outliers' where they are.

Content of the PR

Mainly, I have ordered the code, to make it more readable, together with creating some new primitives to clean some points in the codebase. Mind that this is only an initial cleaning process, just to gather some feedback and make the process gradual.

Moreover, I have added tests to make sure that the primitives behave as expected. Every command has been tested in the console, and there are some commands that fail there (like view.flows.resolve), due to some bug in the converter that does not correctly show return type. This will go into an issue in a while.

You could notice that set_order and set_filter are somewhat redundant wrt options settings. Actually, I believe that with the new Command Language in sight, those options should just be replaced by associated commands. Let me know what you think about that.

What's next

  • Extension of the type manager, to support, eventually, typing.Optional return statements. Other solution, like using typing.Sequence, are a Request For Comments here.
  • Make every command symmetric between usage in the code and usage in console, as discussed in #3198 .
  • Work on the Session addon that implements the same interface of the View addon, storing on disk, and test for interoperability in the code.
  • Improving the View addon in the meantime.

[EDIT] I'm checking where the full coverage is not reached. Fixing it asap. My bad!

@cortesi cortesi merged commit 9ff4f55 into mitmproxy:master Jun 16, 2018

4 checks passed

codecov/patch 92.63% of diff hit (target 88.62%)
codecov/project 88.64% (+0.01%) compared to d36b5aa
continuous-integration/appveyor/pr AppVeyor build succeeded
continuous-integration/travis-ci/pr The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment