Reduce duplicated code

[#56447064]
Merge 56447064-code-climate to master

[#56447064]