Lint Slim files and fix offenses

The fixing was partially done manually and partially automatically.
This commit is contained in:
Sebastian Serth
2024-04-13 20:06:03 +02:00
committed by Dominic Sauer
parent ddfa06ffaa
commit 9a9efd5caa
91 changed files with 378 additions and 392 deletions

View File

@@ -5,7 +5,7 @@
= f.text_field(:name, class: 'form-control', required: true)
.mb-3
= f.label(:file_type_id, class: 'form-label')
= f.collection_select(:file_type_id, FileType.all.order(:name), :id, :name, {include_blank: true}, class: 'form-control')
= f.collection_select(:file_type_id, FileType.order(:name), :id, :name, {include_blank: true}, class: 'form-control')
.mb-3
= f.label(:docker_image, class: 'form-label')
|  
@@ -53,4 +53,4 @@
= f.label(:help, class: 'form-label')
= f.hidden_field(:help)
.form-control.markdown
.actions = render('shared/submit_button', f: f, object: @execution_environment)
.actions = render('shared/submit_button', f:, object: @execution_environment)

View File

@@ -1,7 +1,7 @@
h1.d-inline-block = ExecutionEnvironment.model_name.human(count: 2)
- if Runner.management_active? && policy(ExecutionEnvironment).sync_all_to_runner_management?
= button_to( { action: :sync_all_to_runner_management }, { form_class: 'float-end mb-2', class: 'btn btn-success' })
= button_to({action: :sync_all_to_runner_management}, {form_class: 'float-end mb-2', class: 'btn btn-success'})
i.fa-solid.fa-upload
= t('execution_environments.index.synchronize_all.button')

View File

@@ -1,6 +1,6 @@
h1 = @execution_environment
#shell data-message-timeout=t('exercises.editor.timeout', permitted_execution_time: @execution_environment.permitted_execution_time) data-message-out-of-memory=t('exercises.editor.out_of_memory', memory_limit: @execution_environment.memory_limit) data-id=@execution_environment.id
#shell data-message-timeout=t('exercises.editor.timeout', permitted_execution_time: @execution_environment.permitted_execution_time) data-message-out-of-memory=t('exercises.editor.out_of_memory', memory_limit: @execution_environment.memory_limit) data-id=@execution_environment.id
label.form-label for='command' = t('execution_environments.shell.command')
.input-group.mb-3
.input-group-text.form-switch.ps-5 class=('text-body-secondary' unless @execution_environment.privileged_execution?)
@@ -9,14 +9,14 @@ h1 = @execution_environment
input#command.form-control type='text'
.card.mb-3
.card-header#download-files role="tab"
a.file-heading.collapsed.d-flex.justify-content-between.align-items-center data-bs-toggle="collapse" href="#collapse_files" aria-expanded="false"
div.clearfix role="button"
i.fa-solid aria-hidden="true"
.card-header#download-files role='tab'
a.file-heading.collapsed.d-flex.justify-content-between.align-items-center data-bs-toggle='collapse' href='#collapse_files' aria-expanded='false'
.clearfix role='button'
i.fa-solid aria-hidden='true'
span = t('execution_environments.shell.file_tree.headline')
div
= render('exercises/editor_button', classes: 'btn-default btn-sm', data: {:'data-bs-toggle' => 'tooltip', :'data-url' => list_files_in_execution_environment_path(@execution_environment)}, icon: 'fa-solid fa-arrows-rotate', id: 'reload-files', label: t('execution_environments.shell.file_tree.reload'), title: t('execution_environments.shell.file_tree.reload_tooltip'))
.card-collapse.collapse id="collapse_files" role="tabpanel"
= render('exercises/editor_button', classes: 'btn-default btn-sm', data: {'data-bs-toggle': 'tooltip', 'data-url': list_files_in_execution_environment_path(@execution_environment)}, icon: 'fa-solid fa-arrows-rotate', id: 'reload-files', label: t('execution_environments.shell.file_tree.reload'), title: t('execution_environments.shell.file_tree.reload_tooltip'))
.card-collapse.collapse#collapse_files role='tabpanel'
.card-body.pt-0.pe-0.ps-1.pb-1
#download-file-tree.justify-content-center.d-flex.my-3
span.mx-1 = t('execution_environments.shell.file_tree.empty')
@@ -26,5 +26,5 @@ h1 = @execution_environment
i.fa-solid.fa-info
span.ms-2 = t('execution_environments.shell.file_tree.root_notice')
pre#output data-message-no-output=t('exercises.implement.no_output', timestamp: l(Time.now, format: :short))
pre#output data-message-no-output=t('exercises.implement.no_output', timestamp: l(Time.zone.now, format: :short))
p = t('exercises.implement.no_output_yet')

View File

@@ -5,15 +5,15 @@ h1.d-inline-block = @execution_environment
ul.dropdown-menu.dropdown-menu-end role='menu'
li = link_to(t('execution_environments.index.synchronize.button'), sync_to_runner_management_execution_environment_path(@execution_environment), method: :post, class: 'dropdown-item') if policy(@execution_environment).sync_to_runner_management?
li = link_to(t('execution_environments.index.shell'), shell_execution_environment_path(@execution_environment), class: 'dropdown-item') if policy(@execution_environment).shell?
li = link_to(t('shared.statistics'), statistics_execution_environment_path(@execution_environment), 'data-turbolinks' => "false", class: 'dropdown-item') if policy(@execution_environment).statistics?
li = link_to(t('shared.statistics'), statistics_execution_environment_path(@execution_environment), 'data-turbolinks': 'false', class: 'dropdown-item') if policy(@execution_environment).statistics?
li = link_to(t('shared.destroy'), @execution_environment, data: {confirm: t('shared.confirm_destroy')}, method: :delete, class: 'dropdown-item') if policy(@execution_environment).destroy?
= row(label: 'execution_environment.name', value: @execution_environment.name)
= row(label: 'execution_environment.user', value: link_to_if(policy(@execution_environment.author).show?, @execution_environment.author, @execution_environment.author))
= row(label: 'execution_environment.file_type', value: @execution_environment.file_type.present? ? link_to(@execution_environment.file_type, @execution_environment.file_type) : nil)
- [:docker_image, :exposed_ports_list, :memory_limit, :cpu_limit, :network_enabled, :privileged_execution, :permitted_execution_time, :pool_size].each do |attribute|
- %i[docker_image exposed_ports_list memory_limit cpu_limit network_enabled privileged_execution permitted_execution_time pool_size].each do |attribute|
= row(label: "execution_environment.#{attribute}", value: @execution_environment.send(attribute))
- [:run_command, :test_command].each do |attribute|
- %i[run_command test_command].each do |attribute|
= row(label: "execution_environment.#{attribute}") do
code = @execution_environment.send(attribute)
= row(label: 'execution_environment.testing_framework', value: @testing_framework_adapter.try(:framework_name))

View File

@@ -1,7 +1,7 @@
h1 = @execution_environment
.table-responsive
table.table.table-striped class="#{@execution_environment.present? ? 'sortable' : ''}"
table.table.table-striped class=(@execution_environment.present? ? 'sortable' : '')
thead
tr
- ['.exercise', '.users_and_programming_groups', '.score', '.maximum_score', '.stddev_score', '.percentage_correct', '.runs', '.worktime', '.stddev_worktime'].each do |title|
@@ -9,17 +9,17 @@ h1 = @execution_environment
tbody
- @execution_environment.exercises.each do |exercise|
- us = contributor_statistics[exercise.id]
- if not us then us = {"contributors" => 0, "average_score" => 0.0, "maximum_score" => 0, "stddev_score" => 0.0, "percent_correct" => nil, "average_submission_count" => 0}
- us ||= {'contributors' => 0, 'average_score' => 0.0, 'maximum_score' => 0, 'stddev_score' => 0.0, 'percent_correct' => nil, 'average_submission_count' => 0}
- wts = working_time_statistics[exercise.id]
- if wts then average_time = wts["average_time"] else 0
- if wts then stddev_time = wts["stddev_time"] else 0
- if wts then average_time = wts['average_time'] else 0 # rubocop:disable Lint/ElseLayout
- if wts then stddev_time = wts['stddev_time'] else 0 # rubocop:disable Lint/ElseLayout
tr
td = link_to_if policy(exercise).statistics?, exercise.title, controller: "exercises", action: "statistics", id: exercise.id, 'data-turbolinks' => "false"
td = us["contributors"]
td = us["average_score"].to_f.round(4)
td = us["maximum_score"].to_f.round(2)
td = us["stddev_score"].to_f.round(4)
td = (us["percent_correct"].to_f or 0).round(4)
td = us["average_submission_count"].to_f.round(2)
td = link_to_if policy(exercise).statistics?, exercise.title, controller: 'exercises', action: 'statistics', id: exercise.id, 'data-turbolinks': 'false'
td = us['contributors']
td = us['average_score'].to_f.round(4)
td = us['maximum_score'].to_f.round(2)
td = us['stddev_score'].to_f.round(4)
td = (us['percent_correct'].to_f || 0).round(4)
td = us['average_submission_count'].to_f.round(2)
td = average_time
td = stddev_time