Skip to content

Commit 0483b80

Browse files
committed
Feedback
1 parent 02a6643 commit 0483b80

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

python/ql/lib/semmle/python/frameworks/Bottle.qll

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,8 @@ module Bottle {
2626
* Provides models for Bottle applications.
2727
*/
2828
module App {
29-
/** Gets class `bottle.Bottle`) */
30-
API::Node cls() { result = API::moduleImport("bottle").getMember("Bottle") }
31-
3229
/** Gets a reference to a Bottle application (an instance of `bottle.Bottle`) */
33-
API::Node instance() { result = cls().getReturn() }
30+
API::Node instance() { result = bottle().getMember("Bottle").getReturn() }
3431

3532
/** Gets a reference to a Bottle application (an instance of `bottle.app`) */
3633
API::Node app() { result = bottle().getMember("app").getReturn() }
@@ -45,15 +42,15 @@ module Bottle {
4542
ViewCallable() { this = any(BottleRouteSetup rs).getARequestHandler() }
4643
}
4744

45+
string routeMethods() { result = ["route", "get", "post", "put", "delete", "patch"] }
46+
4847
private class BottleRouteSetup extends Http::Server::RouteSetup::Range, DataFlow::CallCfgNode {
4948
BottleRouteSetup() {
5049
this =
5150
[
52-
App::instance()
53-
.getMember(["route", "get", "post", "put", "delete", "patch"])
54-
.getACall(),
55-
App::app().getMember(["route", "get", "post", "put", "delete", "patch"]).getACall(),
56-
bottle().getMember(["route", "get", "post", "put", "delete", "patch"]).getACall()
51+
App::instance().getMember(routeMethods()).getACall(),
52+
App::app().getMember(routeMethods()).getACall(),
53+
bottle().getMember(routeMethods()).getACall()
5754
]
5855
}
5956

0 commit comments

Comments
 (0)