devedbox/Commander

View on GitHub
Sources/Commander/Commands/CommandDescriber.swift

Summary

Maintainability
A
2 hrs
Test Coverage

Function describe has 63 lines of code (exceeds 25 allowed). Consider refactoring.
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
    )
Severity: Major
Found in Sources/Commander/Commands/CommandDescriber.swift - About 2 hrs to fix

    Function describe has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    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
        )
    Severity: Minor
    Found in Sources/Commander/Commands/CommandDescriber.swift - About 2 hrs to fix

    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

      internal func describe(_ command: CommandDescribable.Type, path: String = "", usagePath: String? = nil) -> String {

    Line should be 120 characters or less: currently 125 characters
    Open

          ("[\(String(describing: command.optionsDescriber.argumentType))]", "\(path) \(command.symbol) [options] arg1 arg2 ...")

    Lines should not have trailing whitespace.
    Open

      

    Lines should not have trailing whitespace.
    Open

        

    Opening braces should be preceded by a single space and on the same line as the declaration.
    Open

        \(argumentsSymbols.map  { intents(2) + $0.0.merging(alignment) + intents(1) + $0.1 }.joined(separator: "\n"))

    Lines should not have trailing whitespace.
    Open

      

    Lines should not have trailing whitespace.
    Open

        

    Lines should not have trailing whitespace.
    Open

            

    Lines should not have trailing whitespace.
    Open

        

    Opening braces should be preceded by a single space and on the same line as the declaration.
    Open

        \(optionsSymbols.map    { intents(2) + $0.0.merging(alignment) + intents(1) + $0.1 }.joined(separator: "\n"))

    Lines should not have trailing whitespace.
    Open

      

    Lines should not have trailing whitespace.
    Open

            

    Lines should not have trailing whitespace.
    Open

        

    Lines should not have trailing whitespace.
    Open

        

    Lines should not have trailing whitespace.
    Open

        

    Lines should not have trailing whitespace.
    Open

        

    Lines should not have trailing whitespace.
    Open

        

    Lines should not have trailing whitespace.
    Open

        

    Lines should not have trailing whitespace.
    Open

      

    Lines should not have trailing whitespace.
    Open

        

    There are no issues that match your filters.

    Category
    Status