BewareMyPower commented on code in PR #15928:
URL: https://github.com/apache/pulsar/pull/15928#discussion_r889708710
##########
pulsar-client-cpp/lib/auth/AuthOauth2.cc:
##########
@@ -143,6 +143,18 @@ ClientCredentialFlow::ClientCredentialFlow(ParamMap&
params)
audience_(params["audience"]),
scope_(params["scope"]) {}
+const std::string ClientCredentialFlow::getWellKnownOpenIdConfigurationUrl() {
Review Comment:
BTW, usually, we should mark all methods that don't change the internal
state as `const`. For example,
```c++
struct A {
int x;
int getX() {
x++; // a getter should not modify the internal state, but the
compilation can pass
return x;
}
};
```
In this case, you should make `getX` a `const` method like:
```c++
int getX() const {
// x++; // Compilation error! Because it changes a field of A
return 2;
}
```
The const qualifier makes your code clear (because we can know which methods
don't change the state) and prevent unexpected changes (for example, modifying
the state in a getter).
See https://google.github.io/styleguide/cppguide.html#Use_of_const
##########
pulsar-client-cpp/lib/auth/AuthOauth2.cc:
##########
@@ -143,6 +143,18 @@ ClientCredentialFlow::ClientCredentialFlow(ParamMap&
params)
audience_(params["audience"]),
scope_(params["scope"]) {}
+const std::string ClientCredentialFlow::getWellKnownOpenIdConfigurationUrl() {
Review Comment:
BTW, usually, we should mark all methods that don't change the internal
state as `const`. For example,
```c++
struct A {
int x;
int getX() {
x++; // a getter should not modify the internal state, but the
compilation can pass
return x;
}
};
```
In this case, you should make `getX` a `const` method like:
```c++
int getX() const {
// x++; // Compilation error! Because it changes a field of A
return x;
}
```
The const qualifier makes your code clear (because we can know which methods
don't change the state) and prevent unexpected changes (for example, modifying
the state in a getter).
See https://google.github.io/styleguide/cppguide.html#Use_of_const
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]