EmmaRamirez/Clickopolis

View on GitHub

Showing 30 of 115 total issues

File template.ts has 818 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Achievement, Biome, BiomeType, Building, Citizen, Civilization,
         Collection, Economy, Era, FaithBonus, FaithTier, Game, Leader, Legacy,
         log, Nation, notify, Queue, Resource, Robot, Settings, SocialPolicy,
         Soldier, Tech, generateTooltips, updateTooltip, betterUpdateTooltip,
         Trait, Wonder
Severity: Major
Found in src/components/template.ts - About 1 day to fix

    File tech.ts has 391 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { Utils } from '../utils';
    import { Tech, Collection, Resource, Building, Wonder, Civilization, Citizen } from '../classes';
    
    let u = new Utils();
    
    
    Severity: Minor
    Found in src/data/tech.ts - About 5 hrs to fix

      Function createResourcesScreen has 112 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        createResourcesScreen(playerCiv:Civilization, resources:Collection<Resource>) {
          let resourcesScreen = `
            <section class='screen resources-screen' id='resources'>
              <h2 data-tooltip='Resources are nice.'><img src='img/resources.png'> Resources</h2>
              <section class='resources-screen-inner'>
      Severity: Major
      Found in src/components/template.ts - About 4 hrs to fix

        Function createCivilizationScreen has 105 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          createCivilizationScreen(playerCiv:Civilization):string {
            let civilizationScreen = `
              <section class='screen civilization-screen' id='civilization'>
                <h2><img src='img/empire.png'> Civilization</h2>
                <section class='civilization-screen-inner'>
        Severity: Major
        Found in src/components/template.ts - About 4 hrs to fix

          Function notify has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

          export function notify(note:Note, isWindowActive:boolean = true):void {
            if (prevNoteMessage !== note.message) {
              if (isWindowActive) {
                if (typeof note.time === 'undefined') {
                  note.time = 2500;
          Severity: Minor
          Found in src/classes/notify.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 cultureCardEvents has 81 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function cultureCardEvents(socialPolicies:Collection<SocialPolicy>, playerCiv) {
              let cc = u.elt('.culture-card', true);
              iterateOverNodelist(cc, (item, index) => {
                  let cardName = item.getAttribute('data-name');
                  let card = socialPolicies.get(cardName);
          Severity: Major
          Found in src/utils/culture.ts - About 3 hrs to fix

            Function constructor has 80 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              constructor(civName:string, leaderName:string, leader:Leader, biomes:Collection<Biome>) {
                this.civName = civName;
                this.leaderName = leaderName;
                //this.location = location;
                this.biomes = biomes;
            Severity: Major
            Found in src/classes/civilization.ts - About 3 hrs to fix

              Templates has 22 functions (exceeds 20 allowed). Consider refactoring.
              Open

              export class Templates {
              
                createStartScreen(playerCiv:Civilization, game:Game) {
              
                  let startScreen = `
              Severity: Minor
              Found in src/components/template.ts - About 2 hrs to fix

                Function createDiplomacyScreen has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  createDiplomacyScreen(playerCiv:Civilization) {
                    let diplomacyScreen = `
                    <section class='screen diplomacy-screen' id='diplomacy'>
                      <h2>
                        <img src='img/deal.png'> Diplomacy
                Severity: Major
                Found in src/components/template.ts - About 2 hrs to fix

                  Function notify has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function notify(note:Note, isWindowActive:boolean = true):void {
                    if (prevNoteMessage !== note.message) {
                      if (isWindowActive) {
                        if (typeof note.time === 'undefined') {
                          note.time = 2500;
                  Severity: Minor
                  Found in src/classes/notify.ts - About 1 hr to fix

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

                    export function updatePopulation(pop:number, playerCiv:Civilization, game:Game, citizens:Collection<Citizen>, options) {
                      let popGrowthCost = u.elt('.pop-growth-cost-text');
                      let populationText = u.elt('.population-text');
                      let popMetric = u.elt('.metric-population');
                    
                    
                    Severity: Minor
                    Found in src/utils/population.ts - About 1 hr to fix

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

                        createCultureScreen(playerCiv:Civilization) {
                          let cultureScreen = `
                            <section class='screen culture-screen' id='culture'>
                              <div class='expand culture-expand' title='Expand the screen size.'>
                                <img src='img/expand.png'>
                      Severity: Minor
                      Found in src/components/template.ts - About 1 hr to fix

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

                        export function biomeSelection(biomeInput) {
                        
                          bindElement('.biome-select-dropdown', 'click', () => { toggleBiomeSelectDropdown() });
                        
                        
                        
                        Severity: Minor
                        Found in src/utils/biome.ts - About 1 hr to fix

                          Function createSettingsScreen has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            createSettingsScreen(playerCiv:Civilization, game:Game) {
                              let settingsScreen = `
                                <section class='screen settings-screen' id='settings'>
                                  <h2>
                                    <img src='img/gear.png'> Settings
                          Severity: Minor
                          Found in src/components/template.ts - About 1 hr to fix

                            Function createEconomyScreen has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              createEconomyScreen(playerCiv:Civilization) {
                                let economyScreen = `
                                  <section class='screen economy-screen' id='economy'>
                                    <h2><img src='img/money.png'> Economy</h2>
                                    <section class='economy-screen-inner'>
                            Severity: Minor
                            Found in src/components/template.ts - About 1 hr to fix

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

                              export function faithBonusClick(playerCiv:Civilization) {
                                //playerCiv.faithPM += 30;
                                //updateFaithElts();
                                let fbs = document.querySelectorAll('.faith-bonus');
                                [].forEach.call(fbs, function (item:any) {
                              Severity: Minor
                              Found in src/utils/faith.ts - About 1 hr to fix

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

                                  createScreenHeader(playerCiv:Civilization, game:Game):string {
                                    let screenHeader = `
                                      <header class='screen-header'>
                                        <div class='player-info'>
                                          <img src='img/${u.dasherize(playerCiv.leader.name)}.jpg'>
                                Severity: Minor
                                Found in src/components/template.ts - About 1 hr to fix

                                  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

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

                                        createTechnologyScreen(playerCiv:Civilization) {
                                          let technologyScreen = `
                                            <section class='screen technology-screen' id='technology'>
                                              <h2><img src='img/research.png'> Technology</h2>
                                              <section class='technology-screen-inner'>
                                      Severity: Minor
                                      Found in src/components/template.ts - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language