Showing 45 of 242 total issues
Function parseUnitSelection
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
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)))
Function PowerList
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
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}>
Function FightPhaseDetails
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function FightPhaseDetails (props: Props): JSX.Element {
return (
<>
<Row style={{
pageBreakInside: 'avoid'
Function ModelTitle
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function ModelTitle (props: Props): JSX.Element {
const headingStyle = {
background: 'black',
color: 'white',
padding: '5px',
Function parseOperative
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
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))
Function StatsTable
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function StatsTable (props: Props): JSX.Element {
return (
<Table striped bordered size='sm'>
<thead>
<tr>
Function parseBattlescribeXML
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
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[]) {
Function TacOpsList
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
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'))
Function ShootingPhaseDetails
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function ShootingPhaseDetails (props: Props): JSX.Element {
return (
<Row style={{
pageBreakInside: 'avoid'
}}
Function WeaponList
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
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'))
Function registerValidSW
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function registerValidSW (swUrl, config) {
navigator.serviceWorker
.register(swUrl)
.then(registration => {
registration.onupdatefound = () => {
Function Phase
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Phase (props: Props): JSX.Element {
return (
<div
className={`phase-${props.name}`} style={{
pageBreakInside: props.name === '' ? 'auto' : 'avoid'
Function AbilityList
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
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)))
Function PloysColumn
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
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))
Function DataDevPage
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const DataDevPage: FC = () => {
const [faction, setFaction] = useState<string | null>(null)
const Content: FC = () => {
if (faction === null) {
Function WeaponList
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function WeaponList (props: Props): JSX.Element {
return (
<>
<Table striped bordered size='sm'>
<thead>
Function PsychicPowerList
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function PsychicPowerList (props: Props): JSX.Element {
return props.powers.length === 0
? <></>
: (
<Table striped bordered size='sm'>
Function KeywordList
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
? (