Skip to content

Commit b51e6dc

Browse files
authored
Merge pull request #1151 from DSD-DBS/prohibit-print
ci: Prohibit use of `print` function
2 parents fa1068b + b66672e commit b51e6dc

File tree

6 files changed

+13
-8
lines changed

6 files changed

+13
-8
lines changed

backend/capellacollab/config/diff.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# SPDX-FileCopyrightText: Copyright DB Netz AG and the capella-collab-manager contributors
22
# SPDX-License-Identifier: Apache-2.0
33

4+
# pylint: disable=bad-builtin
5+
46
import pathlib
57

68
import deepdiff

backend/capellacollab/projects/routes.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,6 @@ def _delete_all_pipelines_for_project(
205205
pipelines: list[backups_models.DatabaseBackup] = []
206206
for model in project.models:
207207
pipelines.extend(backups_crud.get_pipelines_for_tool_model(db, model))
208-
print(project.models)
209-
print(pipelines)
210208
for pipeline in pipelines:
211209
backups_core.delete_pipeline(db, pipeline, username, True)
212210

backend/capellacollab/projects/toolmodels/modelsources/git/github/handler.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,6 @@ def get_last_pipeline_runs(
109109
headers = None
110110
if self.git_model.password:
111111
headers = self.__get_headers(self.git_model.password)
112-
print(
113-
f"{self.git_instance.api_url}/repos/{project_id}/actions/runs?branch={parse.quote(self.git_model.revision, safe='')}&per_page=20"
114-
)
115112
response = requests.get(
116113
f"{self.git_instance.api_url}/repos/{project_id}/actions/runs?branch={parse.quote(self.git_model.revision, safe='')}&per_page=20",
117114
headers=headers,

backend/capellacollab/sessions/operators/k8s.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,9 @@ def print_file_tree_as_json():
10401040
import pathlib
10411041
import sys
10421042

1043-
print("Using CLI arguments: " + str(sys.argv[1:]), file=sys.stderr)
1043+
print( # pylint: disable=bad-builtin
1044+
"Using CLI arguments: " + str(sys.argv[1:]), file=sys.stderr
1045+
)
10441046

10451047
def get_files(dir: pathlib.Path, show_hidden: bool):
10461048
file = {
@@ -1068,7 +1070,7 @@ def get_files(dir: pathlib.Path, show_hidden: bool):
10681070

10691071
return file
10701072

1071-
print(
1073+
print( # pylint: disable=bad-builtin
10721074
json.dumps(
10731075
get_files(
10741076
pathlib.Path(sys.argv[1]), json.loads(sys.argv[2])

backend/capellacollab/settings/modelsources/git/askpass.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@
77
import sys
88

99
if __name__ == "__main__":
10-
print(os.environ["GIT_" + sys.argv[1].split()[0].upper()])
10+
print( # pylint: disable=bad-builtin
11+
os.environ["GIT_" + sys.argv[1].split()[0].upper()]
12+
)
1113
raise SystemExit(0)

backend/pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ add-ignore = [
151151
"D213", # Multi-line docstring summary should start at the second line
152152
]
153153

154+
[tool.pylint]
155+
bad-functions = ["print"]
156+
154157
[tool.pylint.messages_control]
155158
disable = [
156159
"broad-except",
@@ -221,6 +224,7 @@ extension-pkg-whitelist = "pydantic" # https://github.com/pydantic/pydantic/issu
221224

222225
[tool.pylint.master]
223226
init-import = "yes"
227+
load-plugins = "pylint.extensions.bad_builtin"
224228

225229
[tool.pylint.similarities]
226230
min-similarity-lines = 6

0 commit comments

Comments
 (0)