Floppy/dataslate

View on GitHub

Showing 45 of 242 total issues

Function parseUnitSelection has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const parseUnitSelection = (unitSelectionNode: Node): Unit => {
  let profiles = _.uniqBy([
    ...nodeMap("bs:profiles/bs:profile[@typeName='Unit']", unitSelectionNode, parseUnitProfile),
    ...nodeMap("bs:selections/bs:selection/bs:profiles/bs:profile[@typeName='Unit']", unitSelectionNode, parseUnitProfile)
  ], (p) => p.hash).sort((a: Profile, b: Profile) => (a.name.localeCompare(b.name)))
Severity: Minor
Found in src/parsers/WH40k9e/BattlescribeParser.ts - About 1 hr to fix

    Function PowerList has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function PowerList (props: Props): JSX.Element {
      return (
        <Row xs={1} sm={2} md={3} className='g-4'>
          {_.sortBy(props.powers, ['name']).map((x: PsychicPower) => (
            <Col key={x.id}>
    Severity: Minor
    Found in src/components/KillTeam2021/PowerList.tsx - About 1 hr to fix

      Function FightPhaseDetails has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function FightPhaseDetails (props: Props): JSX.Element {
        return (
          <>
            <Row style={{
              pageBreakInside: 'avoid'
      Severity: Minor
      Found in src/components/WH40k9e/FightPhaseDetails.tsx - About 1 hr to fix

        Function ModelTitle has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Function parseOperative has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const parseOperative = (model: Element): Operative => {
            const allKeywords = (xpSelect(".//bs:categories/bs:category[@primary='false']/@name", model) as Node[]).map((x) => (x.textContent ?? '').replace('💀', ''))
            const faction = _.intersection(allKeywords, factionKeywords).pop() ?? allKeywords.find((k) => (k === k.toUpperCase())) ?? null
            const keywords = _.remove(allKeywords, (x) => (x !== faction))
          
          
          Severity: Minor
          Found in src/parsers/KillTeam2021/BattlescribeParser.ts - About 1 hr to fix

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

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

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

                Function TacOpsList has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function TacOpsList (props: Props): JSX.Element {
                  return (
                    <Row xs={1} sm={2} md={3} className='g-4'>
                      {props.tacOps.map((x: TacOp) => (
                        <Col key={x.id}>

                  Function WeaponList has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function WeaponList (props: Props): JSX.Element {
                    const weapons = props.phase === 'shooting'
                      ? props.weapons.filter((x) => (x.type !== 'Melee'))
                      : props.weapons.filter((x) => (x.type === 'Melee'))
                  
                  
                  Severity: Minor
                  Found in src/components/WH40k9e/WeaponList.tsx - About 1 hr to fix

                    Function ShootingPhaseDetails has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function ShootingPhaseDetails (props: Props): JSX.Element {
                      return (
                        <Row style={{
                          pageBreakInside: 'avoid'
                        }}
                    Severity: Minor
                    Found in src/components/WH40k9e/ShootingPhaseDetails.tsx - About 1 hr to fix

                      Function WeaponList has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function WeaponList (props: Props): JSX.Element {
                        const weapons = props.phase === 'shooting'
                          ? props.weapons.filter((x) => (x.type !== 'Melee'))
                          : props.weapons.filter((x) => (x.type === 'Melee'))
                      
                      
                      Severity: Minor
                      Found in src/components/KillTeam2018/WeaponList.tsx - About 1 hr to fix

                        Function registerValidSW has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function registerValidSW (swUrl, config) {
                          navigator.serviceWorker
                            .register(swUrl)
                            .then(registration => {
                              registration.onupdatefound = () => {
                        Severity: Minor
                        Found in src/serviceWorker.js - About 1 hr to fix

                          Function Phase has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function Phase (props: Props): JSX.Element {
                            return (
                              <div
                                className={`phase-${props.name}`} style={{
                                  pageBreakInside: props.name === '' ? 'auto' : 'avoid'
                          Severity: Minor
                          Found in src/components/WH40k9e/Phase.tsx - About 1 hr to fix

                            Function AbilityList has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function AbilityList (props: Props): JSX.Element {
                              let abilities = props.abilities
                              if (typeof (props.phase) === 'string') {
                                abilities = props.phase !== ''
                                  ? props.abilities.filter((x) => (x.phases?.includes(props.phase as string)))
                            Severity: Minor
                            Found in src/components/WH40k9e/AbilityList.tsx - About 1 hr to fix

                              Function PloysColumn has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export function PloysColumn (props: Props): JSX.Element {
                                return (
                                  <Col>
                                    {props.ploys.map((x: Ploy) => (
                                      <Card key={x.name} border='info' bg='light'>

                                Function StratagemList has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export function StratagemList (props: Props): JSX.Element {
                                  // Find stratagems for this phase
                                  const stratagems = props.phase !== ''
                                    ? props.stratagems.filter((x) => (x.phases?.includes(props.phase)))
                                    : props.stratagems.filter((x) => (x.phases?.length === 0))
                                Severity: Minor
                                Found in src/components/WH40k9e/StratagemList.tsx - About 1 hr to fix

                                  Function DataDevPage has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export const DataDevPage: FC = () => {
                                    const [faction, setFaction] = useState<string | null>(null)
                                  
                                    const Content: FC = () => {
                                      if (faction === null) {
                                  Severity: Minor
                                  Found in src/components/KillTeam2021/DataDevPage.tsx - About 1 hr to fix

                                    Function WeaponList has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export function WeaponList (props: Props): JSX.Element {
                                      return (
                                        <>
                                          <Table striped bordered size='sm'>
                                            <thead>
                                    Severity: Minor
                                    Found in src/components/KillTeam2021/WeaponList.tsx - About 1 hr to fix

                                      Function PsychicPowerList has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      export function PsychicPowerList (props: Props): JSX.Element {
                                        return props.powers.length === 0
                                          ? <></>
                                          : (
                                            <Table striped bordered size='sm'>
                                      Severity: Minor
                                      Found in src/components/WH40k9e/PsychicPowerList.tsx - About 1 hr to fix

                                        Function KeywordList has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                        export function KeywordList (props: Props): JSX.Element {
                                          return (
                                            <div style={{ background: 'rgba(0, 0, 0, 0.125)', padding: '5px 10px 0px 10px' }}>
                                              {props.faction !== null
                                                ? (
                                        Severity: Minor
                                        Found in src/components/KeywordList.tsx - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language