Apply suggestions from code review

Co-authored-by: Owen Mansel-Chan <62447351+owen-mc@users.noreply.github.com>
This commit is contained in:
Alvaro Muñoz
2023-02-03 09:45:00 +01:00
committed by GitHub
parent 2576a09af9
commit 13242df149

View File

@@ -7,6 +7,7 @@ import semmle.go.security.RequestForgery
module Twirp {
/**
* A *.pb.go file generated by Twirp.
*
* This file contains all the types representing protobuf messages and should have a companion *.twirp.go file.
*/
class ProtobufGeneratedFile extends File {
@@ -38,7 +39,7 @@ module Twirp {
/**
* A type representing a protobuf message.
*/
class ProtobufMessage extends Type {
class ProtobufMessageType extends Type {
ProtobufMessage() {
exists(TypeEntity te |
te.getType() = this and
@@ -51,7 +52,7 @@ module Twirp {
* An interface type representing a Twirp service.
*/
class ServiceInterface extends InterfaceType {
NamedType serviceInterface;
NamedType namedType;
ServiceInterface() {
exists(TypeEntity te |
@@ -62,7 +63,7 @@ module Twirp {
}
/**
* Returns the name of the interface
* Gets the name of the interface.
*/
override string getName() { result = serviceInterface.getName() }
@@ -73,7 +74,7 @@ module Twirp {
}
/**
* A Twirp client
* A Twirp client.
*/
class ServiceClient extends NamedType {
ServiceClient() {
@@ -104,8 +105,8 @@ module Twirp {
ClientConstructor() {
exists(ServiceClient c |
this.getName().toLowerCase() = "new" + c.getName().toLowerCase() and
this.getParameter(0).getType().getName() = "string" and
this.getParameter(1).getType().getName() = "HTTPClient"
this.getParameter(0).getType() instanceof StringType and
this.getParameterType(1).getName() = "HTTPClient"
)
}
}