jfiander/usps-flags_burgees

View on GitHub

Showing 2 of 2 total issues

Method svg has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def svg(crossed: false)
      raise USPSFlags::Errors::UnknownBurgee unless USPSFlags::Burgees.available.include?(@squadron)

      burgee = crossed ? crossed(@squadron) : core(@squadron)
      header_opts = crossed ? { width: 1200, height: 600, scale: 7.25 } : {}
Severity: Minor
Found in lib/usps_flags/burgees.rb - About 25 mins 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

Line length
Open

An extension for [USPSFlags](https://github.com/jfiander/usps-flags) to provide squadron burgees.
Severity: Info
Found in README.md by markdownlint

MD013 - Line length

Tags: line_length

Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)

This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.

This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.

You also have the option to exclude this rule for code blocks and tables. To do this, set the code_blocks and/or tables parameters to false.

Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.

Severity
Category
Status
Source
Language