Floppy/dataslate

View on GitHub

Showing 45 of 242 total issues

Avoid deeply nested control flow statements.
Open

            if (opsData.description.includes(keyword) === true) {
              expect(opsData.description).toContain(`**${keyword}**`)
            }
Severity: Major
Found in src/components/KillTeam2021/data.test.ts - About 45 mins to fix

    Function Datasheet has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    export function Datasheet (props: Props): JSX.Element {
      return (
        <Card className={props.datacard.operativeNames.length > 0 ? 'included' : 'excluded'}>
          <ModelTitle
            name=''
    Severity: Minor
    Found in src/components/KillTeam2021/Datasheet.tsx - About 35 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

    Function parseBattlescribeXML has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    export const parseBattlescribeXML = (doc: Document): Roster => {
      const operatives = []
      const name = xpSelect('string(/bs:roster/@name)', doc, true).toString()
      const faction = xpSelect('string(//bs:force/@catalogueName)', doc, true).toString()
      for (const model of xpSelect('//bs:selection[@type=\'model\']', doc) as Element[]) {
    Severity: Minor
    Found in src/parsers/KillTeam2021/BattlescribeParser.ts - About 35 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

    Avoid too many return statements within this function.
    Open

        return 0
    Severity: Major
    Found in src/parsers/KillTeam2018/Abilities.ts - About 30 mins to fix

      Function PsychicPhaseDetails has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      export function PsychicPhaseDetails (props: Props): JSX.Element {
        return (
          hasAbilitiesForPhase(props.unit.abilities, 'psychic') || props.unit.psychic.powers.length > 0
            ? (
              <>
      Severity: Minor
      Found in src/components/WH40k9e/PsychicPhaseDetails.tsx - 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

      Severity
      Category
      Status
      Source
      Language