EmmaRamirez/Clickopolis

View on GitHub
src/utils/military.ts

Summary

Maintainability
A
2 hrs
Test Coverage

Function calculateTotalMilitaryStats has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function calculateTotalMilitaryStats(military:Collection<Soldier>, soldier:Citizen, playerCiv:Civilization) {
    console.log(soldier);

    let statsContainer = u.elt('.assignment-total');
    let totalAssigned = u.elt('.soldiers-assigned');
Severity: Minor
Found in src/utils/military.ts - About 1 hr to fix

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

    export function militaryUnitChange(military:Collection<Soldier>, soldier:Citizen, playerCiv:Civilization) {
        iterateOverNodelist(u.elt('.military-assignment-input', true), (item:HTMLInputElement, index) => {
            item.addEventListener('change', (event:Event) => {
                let unitName = item.getAttribute('data-unit');
                let unit:Soldier = military.get(unitName);
    Severity: Minor
    Found in src/utils/military.ts - About 1 hr to fix

      There are no issues that match your filters.

      Category
      Status