Sources/Commander/Commands/CommandDescriber.swift
Function describe
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Wontfix
Wontfix
internal func describe(_ command: CommandDescribable.Type, path: String = "", usagePath: String? = nil) -> String {
let optionsFormat: (symbol: String, short: String) = (
OptionsDecoder.optionsFormat.symbol,
OptionsDecoder.optionsFormat.shortSymbol
)
Function describe
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
internal func describe(_ command: CommandDescribable.Type, path: String = "", usagePath: String? = nil) -> String {
let optionsFormat: (symbol: String, short: String) = (
OptionsDecoder.optionsFormat.symbol,
OptionsDecoder.optionsFormat.shortSymbol
)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function body should span 40 lines or less excluding comments and whitespace: currently spans 58 lines Open
Open
internal func describe(_ command: CommandDescribable.Type, path: String = "", usagePath: String? = nil) -> String {
- Exclude checks
Line should be 120 characters or less: currently 125 characters Open
Open
("[\(String(describing: command.optionsDescriber.argumentType))]", "\(path) \(command.symbol) [options] arg1 arg2 ...")
- Exclude checks
Lines should not have trailing whitespace. Open
Open
- Exclude checks
Lines should not have trailing whitespace. Open
Open
- Exclude checks
Opening braces should be preceded by a single space and on the same line as the declaration. Open
Open
\(argumentsSymbols.map { intents(2) + $0.0.merging(alignment) + intents(1) + $0.1 }.joined(separator: "\n"))
- Exclude checks
Lines should not have trailing whitespace. Open
Open
- Exclude checks
Lines should not have trailing whitespace. Open
Open
- Exclude checks
Lines should not have trailing whitespace. Open
Open
- Exclude checks
Lines should not have trailing whitespace. Open
Open
- Exclude checks
Opening braces should be preceded by a single space and on the same line as the declaration. Open
Open
\(optionsSymbols.map { intents(2) + $0.0.merging(alignment) + intents(1) + $0.1 }.joined(separator: "\n"))
- Exclude checks
Lines should not have trailing whitespace. Open
Open
- Exclude checks
Lines should not have trailing whitespace. Open
Open
- Exclude checks
Lines should not have trailing whitespace. Open
Open
- Exclude checks
Lines should not have trailing whitespace. Open
Open
- Exclude checks
Lines should not have trailing whitespace. Open
Open
- Exclude checks
Lines should not have trailing whitespace. Open
Open
- Exclude checks
Lines should not have trailing whitespace. Open
Open
- Exclude checks
Lines should not have trailing whitespace. Open
Open
- Exclude checks
Lines should not have trailing whitespace. Open
Open
- Exclude checks
Lines should not have trailing whitespace. Open
Open
- Exclude checks