Refactor: reduce detekt findings (unused params, throws, long methods, config)
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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 запущен.")
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ class AuthPageController(
|
||||
}
|
||||
|
||||
@GetMapping("/setup")
|
||||
fun setupPage(model: Model): String {
|
||||
fun setupPage(): String {
|
||||
if (api.adminExists()) {
|
||||
return "redirect:/login"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user