Showing 45 of 242 total issues
Function handleDegradingProfiles
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
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) => ({
- Read upRead up
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
Open
export function Roster (props: Props): JSX.Element {
const headingStyle = {
background: '#FF6F2D',
color: 'black',
padding: '10px',
Function Roster
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
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))
Function VeteranGuardsmen
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const VeteranGuardsmen: FC<Props> = (props) => {
const headingStyle = {
background: '#FF6F2D',
color: 'black',
padding: '10px',
Function Pathfinder
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Pathfinder: FC<Props> = (props) => {
const headingStyle = {
background: '#FF6F2D',
color: 'black',
padding: '10px',
Function Homepage
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Homepage (props: Props): JSX.Element {
const [showSettings, setShowSettings] = useState(false)
return (
<>
Function Novitiate
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Novitiate: FC<Props> = (props) => {
const headingStyle = {
background: '#FF6F2D',
color: 'black',
padding: '10px',
Function App
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function App (): JSX.Element {
const [roster, setRoster] = useState<Roster2018 | Roster2021 | RosterWH40k9e | null>(null)
const [settings, setSettings] = useState(DEFAULT_SETTINGS)
Function SettingsDialog
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function SettingsDialog (props: Props): JSX.Element {
const handleWoundTrackChange = (event: any): void => {
const target = event.target
const showWoundTrack: boolean = target.checked
const newSettings = {
Function HierotekCircle
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const HierotekCircle: FC<Props> = (props) => {
const headingStyle = {
background: '#FF6F2D',
color: 'black',
padding: '10px',
Function ElucidianStarstrider
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
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
Open
export const VoidDancerTroupe: FC<Props> = (props) => {
const headingStyle = {
background: '#FF6F2D',
color: 'black',
padding: '10px',
Function Blooded
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Blooded: FC<Props> = (props) => {
const headingStyle = {
background: '#FF6F2D',
color: 'black',
padding: '10px',
Function StatsTable
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function StatsTable (props: Props): JSX.Element {
return (
<Table striped bordered size='sm'>
<thead>
<tr>
Function Roster
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function Roster (props: Props): JSX.Element {
const headingStyle = {
background: '#FF6F2D',
color: 'black',
padding: '10px',
Function parseModel
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
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 = {
Function Default
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Default: FC<Props> = (props) => {
const headingStyle = {
background: '#FF6F2D',
color: 'black',
padding: '10px',
Function Datasheet
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function Datasheet (props: Props): JSX.Element {
return (
<Card className={props.datacard.operativeNames.length > 0 ? 'included' : 'excluded'}>
<ModelTitle
name=''
Function App
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
export function App (): JSX.Element {
const [roster, setRoster] = useState<Roster2018 | Roster2021 | RosterWH40k9e | null>(null)
const [settings, setSettings] = useState(DEFAULT_SETTINGS)
- Read upRead up
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"