Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.qlty.sh/llms.txt

Use this file to discover all available pages before exploring further.

Code smells are indicators of potential issues in your code that may not necessarily be bugs but could lead to deeper problems down the line. They suggest areas of your codebase that might benefit from refactoring to improve readability, maintainability, and overall quality. Identifying and addressing code smells can help prevent technical debt and ensure a more robust codebase. Qlty implements eight checks for common code maintainability issues which consider code structure and duplication. By default, these checks run on any files in one of our Supported Languages.
Code smell detection is provided by Qlty CLI and Qlty Cloud.

Similar code

Duplicate code which is not identical but shares the same structure (e.g. variable names may differ)

Identical code

Duplicate code which is syntactically identical (but may be formatted differently)

Many function parameters

Methods or functions defined with a high number of arguments
Bad example
function foo(a, b, c, d, e, f, g) {
    // ...
}
Good example
function foo(a, b, c) {
    // ...
}

Complex boolean logic

Boolean logic that may be hard to understand

High file complexity

Excessive lines of code within a single file

High function complexity

Functions or methods that may be hard to understand (Cognitive Complexity)

Deeply nested control flow

Deeply nested control structures like if or case

Many return statements

Functions or methods with a high number of return statements
The maintainability checks listed below each ship with a default threshold. These thresholds can be adjusted or the check can be disabled entirely in the qlty.toml configuration file.

See Also