Skip to content

Commit 13242df

Browse files
Alvaro Muñozowen-mc
andauthored
Apply suggestions from code review
Co-authored-by: Owen Mansel-Chan <[email protected]>
1 parent 2576a09 commit 13242df

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

go/ql/lib/semmle/go/frameworks/Twirp.qll

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import semmle.go.security.RequestForgery
77
module Twirp {
88
/**
99
* A *.pb.go file generated by Twirp.
10+
*
1011
* This file contains all the types representing protobuf messages and should have a companion *.twirp.go file.
1112
*/
1213
class ProtobufGeneratedFile extends File {
@@ -38,7 +39,7 @@ module Twirp {
3839
/**
3940
* A type representing a protobuf message.
4041
*/
41-
class ProtobufMessage extends Type {
42+
class ProtobufMessageType extends Type {
4243
ProtobufMessage() {
4344
exists(TypeEntity te |
4445
te.getType() = this and
@@ -51,7 +52,7 @@ module Twirp {
5152
* An interface type representing a Twirp service.
5253
*/
5354
class ServiceInterface extends InterfaceType {
54-
NamedType serviceInterface;
55+
NamedType namedType;
5556

5657
ServiceInterface() {
5758
exists(TypeEntity te |
@@ -62,7 +63,7 @@ module Twirp {
6263
}
6364

6465
/**
65-
* Returns the name of the interface
66+
* Gets the name of the interface.
6667
*/
6768
override string getName() { result = serviceInterface.getName() }
6869

@@ -73,7 +74,7 @@ module Twirp {
7374
}
7475

7576
/**
76-
* A Twirp client
77+
* A Twirp client.
7778
*/
7879
class ServiceClient extends NamedType {
7980
ServiceClient() {
@@ -104,8 +105,8 @@ module Twirp {
104105
ClientConstructor() {
105106
exists(ServiceClient c |
106107
this.getName().toLowerCase() = "new" + c.getName().toLowerCase() and
107-
this.getParameter(0).getType().getName() = "string" and
108-
this.getParameter(1).getType().getName() = "HTTPClient"
108+
this.getParameter(0).getType() instanceof StringType and
109+
this.getParameterType(1).getName() = "HTTPClient"
109110
)
110111
}
111112
}

0 commit comments

Comments
 (0)