Fix the following SonarQube code smells:

1) Use the "RegExp.exec()" method instead.
2) Remove parameter form or provide default value.
3) Extract this nested ternary operation into an independent statement.
4) Replace this character class by the character itself.
5) Unnecessary use of conditional expression for default assignment.
6) Prefer using an optional chain expression instead, as it's more concise and easier to read.
This commit is contained in:
Akshay Joshi
2024-06-11 18:07:22 +05:30
parent bdf4f39b2b
commit df2f3460f0
17 changed files with 102 additions and 69 deletions

View File

@@ -41,7 +41,7 @@ class BaseAuthentication(metaclass=AuthSourceRegistry):
pass
@abstractmethod
def authenticate(self):
def authenticate(self, form):
pass
def validate(self, form):

View File

@@ -27,7 +27,6 @@ from pgadmin.utils.constants import KERBEROS, MessageType
from pgadmin.utils import PgAdminModule
from pgadmin.utils.ajax import make_json_response, internal_server_error
from pgadmin.authenticate.internal import BaseAuthentication
from pgadmin.authenticate import get_auth_sources
from pgadmin.utils.csrf import pgCSRFProtect

View File

@@ -275,6 +275,6 @@ class OAuth2Authentication(BaseAuthentication):
authorized_claims = [authorized_claims]
if any(item in authorized_claims for item in claim):
reason = "Claim match found. Authorized access."
return (True, reason)
reason = f"No match was found."
return (False, reason)
return True, reason
reason = "No match was found."
return False, reason