Skip to content
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

Uninstall default bottle plugins #1734

Merged
merged 1 commit into from
Feb 14, 2024
Merged

Conversation

bstaletic
Copy link
Collaborator

@bstaletic bstaletic commented Feb 13, 2024

By default, bottle installs two plugins: JSONPlugin and TemplatePlugin.

TemplatePlugin is always a no-op, because none of the routes we use (like /ready) have a template parameter.

JSONPlugin could have been useful were it actually serializing all json messages. Instead it only deals with dictionaries. Ycmd has always had ycmd.handlers._JsonResponse and we will need to keep it that way. _JsonResponse makes JSONPlugin a no-op too, because, by the time we get to the JSONPlugin.apply() the response is always a str already.

Bottle.uninstall() can be passed:

  1. An instance of an installed plugins, to uninstall that one plugin.
  2. A type, to uninstall all plugins of that type.
  3. True, to uninstall all plugins.

Since we are uninstalling all default plugins, we can just do handlers.app.uninstall( True ) and then install the plugins we care about - ycmd.HmacPlugin and ycmd.WatchdogPlugin.


This change is Reviewable

Copy link
Member

@puremourning puremourning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: 1 of 2 LGTMs obtained (waiting on @bstaletic)

By default, bottle installs two plugins: `JSONPlugin` and `TemplatePlugin`.

`TemplatePlugin` is always a no-op, because none of the routes we use
(like `/ready`) have a template parameter.

`JSONPlugin` could have been useful were it actually serializing all json
messages. Instead it only deals with dictionaries. Ycmd has always had
`ycmd.handlers._JsonResponse` and we will need to keep it that way.
`_JsonResponse` makes `JSONPlugin` a no-op too, because, by the time we get
to the `JSONPlugin.apply()` the response is always a str already.

`Bottle.uninstall()` can be passed:

1. An instance of an installed plugins, to uninstall that one plugin.
2. A type, to uninstall all plugins of that type.
3. `True`, to uninstall all plugins.

Since we are uninstalling all default plugins, we can just do

`handlers.app.uninstall( True )` and then install the plugins we care
about - `ycmd.HmacPlugin` and `ycmd.WatchdogPlugin`.
Copy link

codecov bot commented Feb 14, 2024

Codecov Report

Merging #1734 (e6b3a56) into master (b8957d7) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1734   +/-   ##
=======================================
  Coverage   95.44%   95.44%           
=======================================
  Files          83       83           
  Lines        8166     8167    +1     
  Branches      163      163           
=======================================
+ Hits         7794     7795    +1     
  Misses        322      322           
  Partials       50       50           

@bstaletic bstaletic added the Ship It! Manual override to merge a PR by maintainer label Feb 14, 2024
Copy link
Contributor

mergify bot commented Feb 14, 2024

Thanks for sending a PR!

@mergify mergify bot merged commit 9d3a703 into ycm-core:master Feb 14, 2024
17 of 18 checks passed
@bstaletic bstaletic deleted the bottle-plugin branch February 14, 2024 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ship It! Manual override to merge a PR by maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants