Skip to content

Commit e4111a4

Browse files
committed
Fix a sonarqube issue
1 parent 992fd00 commit e4111a4

File tree

2 files changed

+28
-29
lines changed

2 files changed

+28
-29
lines changed

conditional/blueprints/major_project_submission.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ def display_major_project(user_dict=None):
3838
log.info("Display Major Project Page")
3939

4040
# There is probably a better way to do this, but it does work
41-
proj_list = get_project_list()
41+
proj_list: list = get_project_list()
4242

43-
bucket = app.config['S3_BUCKET_ID']
43+
bucket: str = app.config['S3_BUCKET_ID']
4444

45-
major_projects = [
45+
major_projects: list[dict] = [
4646
{
4747
"id": p.id,
4848
"date": p.date,
@@ -61,12 +61,11 @@ def display_major_project(user_dict=None):
6161
for p in proj_list
6262
]
6363

64-
major_projects_len = len(major_projects)
6564
# return names in 'first last (username)' format
6665
return render_template(
6766
"major_project_submission.html",
6867
major_projects=major_projects,
69-
major_projects_len=major_projects_len,
68+
major_projects_len=len(major_projects),
7069
username=user_dict["username"])
7170

7271
@major_project_bp.route("/major_project/upload", methods=["POST"])
@@ -82,7 +81,7 @@ def upload_major_project_files(user_dict=None):
8281
# Temporarily save files to a place, to be uploaded on submit
8382
for _, file in request.files.lists():
8483
file = file[0]
85-
safe_name = secure_filename(file.filename)
84+
safe_name: str = secure_filename(file.filename)
8685
filename = f"/tmp/{user_dict['username']}/{safe_name}"
8786

8887
os.makedirs(os.path.dirname(filename), exist_ok=True)
@@ -152,7 +151,7 @@ def submit_major_project(user_dict=None):
152151
endpoint_url=app.config['S3_URI'])
153152

154153
# Collect all the locally cached files and put them in the bucket
155-
temp_dir = f"/tmp/{user_id}"
154+
temp_dir: str = f"/tmp/{user_id}"
156155
if os.path.exists(temp_dir):
157156
for file in os.listdir(temp_dir):
158157
filepath = f"{temp_dir}/{file}"

conditional/templates/major_project_submission.html

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ <h3 class="mb-4">Major Project Form</h3>
6767
<div class="row mt-3">
6868
<div class="col-lg-6">
6969

70-
<label class="d-block h5 mt-4 mb-2">
70+
<label for="skill-input" class="d-block h5 mt-4 mb-2">
7171
Skills Applied &MediumSpace;
7272
<small class="text-muted d-block">
7373
Press Enter or , to separate skills
@@ -76,12 +76,12 @@ <h3 class="mb-4">Major Project Form</h3>
7676

7777
<div class="form-control border-0 border-bottom rounded-0 p-2">
7878
<input
79-
id="skill-input"
80-
name="skill"
81-
type="text"
82-
maxlength="16"
83-
placeholder="Add a skill"
84-
class="border-0 w-100"
79+
id="skill-input"
80+
name="skill"
81+
type="text"
82+
maxlength="16"
83+
placeholder="Add a skill"
84+
class="border-0 w-100"
8585
>
8686
<small class="text-muted">
8787
List what skills you meaningfully used while working on this project (at least 2!)
@@ -95,11 +95,11 @@ <h3 class="mb-4">Major Project Form</h3>
9595
</label>
9696

9797
<textarea
98-
id="time-commitment"
99-
name="time-commitment"
100-
rows="4"
101-
class="form-control form-textarea"
102-
placeholder="We're looking for a considerable amount of time spent on your major project, we suggest ~10 hours minimum"
98+
id="time-commitment"
99+
name="time-commitment"
100+
rows="4"
101+
class="form-control form-textarea"
102+
placeholder="We're looking for a considerable amount of time spent on your major project, we suggest ~10 hours minimum"
103103
></textarea>
104104
</div>
105105
</div>
@@ -109,11 +109,11 @@ <h3 class="mb-4">Major Project Form</h3>
109109
</label>
110110

111111
<textarea
112-
id="description"
113-
name="description"
114-
rows="6"
115-
class="form-control mb-extra"
116-
placeholder="Tell us everything! More information is better than less."
112+
id="description"
113+
name="description"
114+
rows="6"
115+
class="form-control mb-extra"
116+
placeholder="Tell us everything! More information is better than less."
117117
></textarea>
118118

119119
<div class="row mt-3">
@@ -123,11 +123,11 @@ <h3 class="mb-4">Major Project Form</h3>
123123
</label>
124124

125125
<textarea
126-
id="links"
127-
name="links"
128-
rows="2"
129-
class="form-control form-textarea"
130-
placeholder="If you have links (GitHub, YouTube, etc.), put them here!"
126+
id="links"
127+
name="links"
128+
rows="2"
129+
class="form-control form-textarea"
130+
placeholder="If you have links (GitHub, YouTube, etc.), put them here!"
131131
></textarea>
132132
</div>
133133

0 commit comments

Comments
 (0)