Skip to content

Commit

Permalink
Merge pull request #1151 from DSD-DBS/prohibit-print
Browse files Browse the repository at this point in the history
ci: Prohibit use of `print` function
  • Loading branch information
MoritzWeber0 authored Nov 1, 2023
2 parents fa1068b + b66672e commit b51e6dc
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
2 changes: 2 additions & 0 deletions backend/capellacollab/config/diff.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# SPDX-FileCopyrightText: Copyright DB Netz AG and the capella-collab-manager contributors
# SPDX-License-Identifier: Apache-2.0

# pylint: disable=bad-builtin

import pathlib

import deepdiff
Expand Down
2 changes: 0 additions & 2 deletions backend/capellacollab/projects/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,6 @@ def _delete_all_pipelines_for_project(
pipelines: list[backups_models.DatabaseBackup] = []
for model in project.models:
pipelines.extend(backups_crud.get_pipelines_for_tool_model(db, model))
print(project.models)
print(pipelines)
for pipeline in pipelines:
backups_core.delete_pipeline(db, pipeline, username, True)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,6 @@ def get_last_pipeline_runs(
headers = None
if self.git_model.password:
headers = self.__get_headers(self.git_model.password)
print(
f"{self.git_instance.api_url}/repos/{project_id}/actions/runs?branch={parse.quote(self.git_model.revision, safe='')}&per_page=20"
)
response = requests.get(
f"{self.git_instance.api_url}/repos/{project_id}/actions/runs?branch={parse.quote(self.git_model.revision, safe='')}&per_page=20",
headers=headers,
Expand Down
6 changes: 4 additions & 2 deletions backend/capellacollab/sessions/operators/k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,9 @@ def print_file_tree_as_json():
import pathlib
import sys

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

def get_files(dir: pathlib.Path, show_hidden: bool):
file = {
Expand Down Expand Up @@ -1068,7 +1070,7 @@ def get_files(dir: pathlib.Path, show_hidden: bool):

return file

print(
print( # pylint: disable=bad-builtin
json.dumps(
get_files(
pathlib.Path(sys.argv[1]), json.loads(sys.argv[2])
Expand Down
4 changes: 3 additions & 1 deletion backend/capellacollab/settings/modelsources/git/askpass.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
import sys

if __name__ == "__main__":
print(os.environ["GIT_" + sys.argv[1].split()[0].upper()])
print( # pylint: disable=bad-builtin
os.environ["GIT_" + sys.argv[1].split()[0].upper()]
)
raise SystemExit(0)
4 changes: 4 additions & 0 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ add-ignore = [
"D213", # Multi-line docstring summary should start at the second line
]

[tool.pylint]
bad-functions = ["print"]

[tool.pylint.messages_control]
disable = [
"broad-except",
Expand Down Expand Up @@ -221,6 +224,7 @@ extension-pkg-whitelist = "pydantic" # https://github.com/pydantic/pydantic/issu

[tool.pylint.master]
init-import = "yes"
load-plugins = "pylint.extensions.bad_builtin"

[tool.pylint.similarities]
min-similarity-lines = 6
Expand Down

0 comments on commit b51e6dc

Please sign in to comment.