diktat
diktat copied to clipboard
[`WRONG_OVERLOADING_FUNCTION_ARGUMENTS`] False positives matches
Describe the bug
WRONG_OVERLOADING_FUNCTION_ARGUMENTS finds a lot of errors, which are false positive:
- Spring JPA repositories:
/**
* @param executionId
* @param pageable
* @return list of test executions
*/
@Suppress("WRONG_OVERLOADING_FUNCTION_ARGUMENTS")
fun findByExecutionId(executionId: Long, pageable: Pageable): List<TestExecution>
/**
* @param executionId
* @return list of test executions
*/
@Suppress("WRONG_OVERLOADING_FUNCTION_ARGUMENTS")
fun findByExecutionId(executionId: Long): List<TestExecution>
- Spring endpoints:
/**
* @param executionId
* @return execution dto
*/
@GetMapping(path = ["/internal/executionDto"])
@Suppress("WRONG_OVERLOADING_FUNCTION_ARGUMENTS")
fun getExecutionDto(
@RequestParam executionId: Long,
): Mono<ExecutionDto> =
executionService.findExecution(executionId)
.toMonoOrNotFound()
.map { it.toDto() }
/**
* @param executionId
* @param authentication
* @return execution dto
*/
@GetMapping(path = ["/api/$v1/executionDto"])
@Suppress("WRONG_OVERLOADING_FUNCTION_ARGUMENTS")
fun getExecutionDto(@RequestParam executionId: Long, authentication: Authentication): Mono<ExecutionDto> =
executionService.findExecution(executionId)
.toMonoOrNotFound()
.filterWhen { execution -> projectPermissionEvaluator.checkPermissions(authentication, execution, Permission.READ) }
.map { it.toDto() }
Expected behavior
Do not mark described cases as error
Observed behavior
Diktat issues
Steps to Reproduce
https://github.com/saveourtool/save-cloud/pull/2003
Environment information
- diktat version: 1.2.5
- build tool (maven/gradle): gradle
- how is diktat run (CLI, plugin, etc.): plugin
- kotlin version: 1.8.10
- operating system: Windows
- link to a project (if your project is public): https://github.com/saveourtool/save-cloud/pull/2003
Thanks to @0x6675636b796f75676974687562 it was resolved by updating diktat-analysis.yml:
- name: WRONG_OVERLOADING_FUNCTION_ARGUMENTS
ignoreAnnotated:
- GetMapping
- PostMapping
- Repository
But I think it should be applied automatically (at least for @Repository)