Floppy/dataslate

View on GitHub

Showing 45 of 242 total issues

Function handleDegradingProfiles has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

const handleDegradingProfiles = (profiles: Profile[]): Profile[] => {
  if (profiles.some((x) => x.name.includes('wounds'))) {
    const profile = profiles[0]
    profile.name = profile.name.split(/[[0-9]/)[0].trimEnd()
    profile.degradedProfiles = profiles.slice(1).map((p) => ({
Severity: Minor
Found in src/parsers/WH40k9e/BattlescribeParser.ts - About 4 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 Roster has 118 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function Roster (props: Props): JSX.Element {
  const headingStyle = {
    background: '#FF6F2D',
    color: 'black',
    padding: '10px',
Severity: Major
Found in src/components/WH40k9e/Roster.tsx - About 4 hrs to fix

    Function Roster has 102 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function Roster (props: Props): JSX.Element {
      // Display models sorted by category and type
      const sortedModels = _.sortBy(props.models, (x: Model) => ([x.category == null, x.category, x.type]))
      // Work out which models are actually selected
      const selectedModels = _.filter(sortedModels, (x: Model) => (x.selected > 0))
    Severity: Major
    Found in src/components/KillTeam2018/Roster.tsx - About 4 hrs to fix

      Function VeteranGuardsmen has 81 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const VeteranGuardsmen: FC<Props> = (props) => {
        const headingStyle = {
          background: '#FF6F2D',
          color: 'black',
          padding: '10px',
      Severity: Major
      Found in src/components/KillTeam2021/FactionSpecificData/VeteranGuardsmen.tsx - About 3 hrs to fix

        Function Pathfinder has 75 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const Pathfinder: FC<Props> = (props) => {
          const headingStyle = {
            background: '#FF6F2D',
            color: 'black',
            padding: '10px',
        Severity: Major
        Found in src/components/KillTeam2021/FactionSpecificData/Pathfinder.tsx - About 3 hrs to fix

          Function Homepage has 65 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function Homepage (props: Props): JSX.Element {
            const [showSettings, setShowSettings] = useState(false)
          
            return (
              <>
          Severity: Major
          Found in src/components/Homepage.tsx - About 2 hrs to fix

            Function Novitiate has 65 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const Novitiate: FC<Props> = (props) => {
              const headingStyle = {
                background: '#FF6F2D',
                color: 'black',
                padding: '10px',
            Severity: Major
            Found in src/components/KillTeam2021/FactionSpecificData/Novitiate.tsx - About 2 hrs to fix

              Function App has 62 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function App (): JSX.Element {
                const [roster, setRoster] = useState<Roster2018 | Roster2021 | RosterWH40k9e | null>(null)
              
                const [settings, setSettings] = useState(DEFAULT_SETTINGS)
              
              
              Severity: Major
              Found in src/App.tsx - About 2 hrs to fix

                Function SettingsDialog has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function SettingsDialog (props: Props): JSX.Element {
                  const handleWoundTrackChange = (event: any): void => {
                    const target = event.target
                    const showWoundTrack: boolean = target.checked
                    const newSettings = {
                Severity: Major
                Found in src/components/SettingsDialog.tsx - About 2 hrs to fix

                  Function HierotekCircle has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const HierotekCircle: FC<Props> = (props) => {
                    const headingStyle = {
                      background: '#FF6F2D',
                      color: 'black',
                      padding: '10px',
                  Severity: Major
                  Found in src/components/KillTeam2021/FactionSpecificData/HierotekCircle.tsx - About 2 hrs to fix

                    Function ElucidianStarstrider has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const ElucidianStarstrider: FC<Props> = (props) => {
                      const headingStyle = {
                        background: '#FF6F2D',
                        color: 'black',
                        padding: '10px',

                      Function ImperialNavyBreachers has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const ImperialNavyBreachers: FC<Props> = (props) => {
                        const headingStyle = {
                          background: '#FF6F2D',
                          color: 'black',
                          padding: '10px',

                        Function VoidDancerTroupe has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const VoidDancerTroupe: FC<Props> = (props) => {
                          const headingStyle = {
                            background: '#FF6F2D',
                            color: 'black',
                            padding: '10px',
                        Severity: Major
                        Found in src/components/KillTeam2021/FactionSpecificData/VoidDancerTroupe.tsx - About 2 hrs to fix

                          Function Blooded has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const Blooded: FC<Props> = (props) => {
                            const headingStyle = {
                              background: '#FF6F2D',
                              color: 'black',
                              padding: '10px',
                          Severity: Major
                          Found in src/components/KillTeam2021/FactionSpecificData/Blooded.tsx - About 2 hrs to fix

                            Function StatsTable has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function StatsTable (props: Props): JSX.Element {
                              return (
                                <Table striped bordered size='sm'>
                                  <thead>
                                    <tr>
                            Severity: Minor
                            Found in src/components/WH40k9e/StatsTable.tsx - About 2 hrs to fix

                              Function Roster has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export function Roster (props: Props): JSX.Element {
                                const headingStyle = {
                                  background: '#FF6F2D',
                                  color: 'black',
                                  padding: '10px',
                              Severity: Minor
                              Found in src/components/KillTeam2021/Roster.tsx - About 1 hr to fix

                                Function parseModel has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const parseModel = (model) => {
                                  const wargear = xpath(".//roster:profile[@typeName='Wargear']", model).map(parseWargear)
                                  const specialismSelection = xpath("roster:selections/roster:selection[roster:selections/roster:selection/roster:profiles/roster:profile/@typeName='Ability']", model)
                                  const abilities = xpath(".//roster:profile[@typeName='Ability']", model).map(parseAbility).concat(wargear)
                                  const stats = {
                                Severity: Minor
                                Found in src/parsers/KillTeam2018/BattlescribeParser.js - About 1 hr to fix

                                  Function Default has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export const Default: FC<Props> = (props) => {
                                    const headingStyle = {
                                      background: '#FF6F2D',
                                      color: 'black',
                                      padding: '10px',
                                  Severity: Minor
                                  Found in src/components/KillTeam2021/FactionSpecificData/Default.tsx - About 1 hr to fix

                                    Function Datasheet has 45 lines of code (exceeds 25 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 1 hr to fix

                                      Function App has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      export function App (): JSX.Element {
                                        const [roster, setRoster] = useState<Roster2018 | Roster2021 | RosterWH40k9e | null>(null)
                                      
                                        const [settings, setSettings] = useState(DEFAULT_SETTINGS)
                                      
                                      
                                      Severity: Minor
                                      Found in src/App.tsx - About 1 hr 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