Refactor: reduce detekt findings (unused params, throws, long methods, config)

This commit is contained in:
2026-09-27 21:54:00 +03:00
parent f3e8b2668f
commit b7d96d2ea4
13 changed files with 188 additions and 119 deletions

View File

@@ -24,7 +24,7 @@ class ContentAdminController(
private val api: ApiClient,
) {
@GetMapping
fun index(session: HttpSession): String = "redirect:/learn"
fun index(): String = "redirect:/learn"
@PostMapping("/import")
fun import(

View File

@@ -228,7 +228,7 @@ class ApiClient(
private fun <T> callOrNull(block: () -> T?): T? =
try {
block()
} catch (ex: RestClientResponseException) {
} catch (ignore: RestClientResponseException) {
null
}
@@ -239,7 +239,7 @@ class ApiClient(
throw ex
} catch (ex: RestClientResponseException) {
throw ApiException(ex.statusCode.value(), detail(ex))
} catch (ex: RestClientException) {
} catch (ignore: RestClientException) {
throw ApiException(502, "Сервис недоступен. Проверьте, что gateway запущен.")
}

View File

@@ -55,7 +55,7 @@ class AuthPageController(
}
@GetMapping("/setup")
fun setupPage(model: Model): String {
fun setupPage(): String {
if (api.adminExists()) {
return "redirect:/login"
}

View File

@@ -110,7 +110,7 @@ class LearnController(
val a: ContentArticleDto =
try {
api.contentArticle(token(session), chapter, section, article, all = admin)
} catch (ex: ApiException) {
} catch (ignore: ApiException) {
return "redirect:/learn"
}

View File

@@ -113,7 +113,7 @@ class StudentController(
val submittedOrDefending = defense != null && (defense.status == "waiting" || defense.assignmentMd.isNotBlank())
model.addAttribute("canSubmit", canSubmit(lab.deadlineAt) && !submittedOrDefending)
"student/lab"
} catch (ex: ApiException) {
} catch (ignore: ApiException) {
"redirect:/student/labs"
}
}