Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"""
Create a session token
"""
endpoint = self.baseUrl + "/sessions"
endpoint = self.baseUrl + f"/sessions"

Check warning on line 20 in Adyen/services/sessionAuthentication/session_authentication_api.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Add replacement fields or use a normal string instead of an f-string.

See more on https://sonarcloud.io/project/issues?id=Adyen_adyen-python-api-library&issues=AZ0K0vanWfhKdAtO6XbW&open=AZ0K0vanWfhKdAtO6XbW&pullRequest=447
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The use of an f-string for a static string f"/sessions" is unnecessary and doesn't add any value. For improved clarity and idiomatic Python, if you intend to use an f-string for concatenation, you should include all parts of the string within it.

Suggested change
endpoint = self.baseUrl + f"/sessions"
endpoint = f"{self.baseUrl}/sessions"

method = "POST"
return self.client.call_adyen_api(
request, self.service, method, endpoint, idempotency_key, **kwargs
)
return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This line is very long and exceeds common line length limits (like PEP 8's 79 characters), which hurts readability. It's better to wrap long lines. The previous multi-line formatting was preferable.

Suggested change
return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)
return self.client.call_adyen_api(
request, self.service, method, endpoint, idempotency_key, **kwargs
)
References
  1. PEP 8, the style guide for Python code, recommends limiting lines of code to 79 characters to improve readability. (link)


Loading