EmmaRamirez/Clickopolis

View on GitHub

Showing 115 of 115 total issues

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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        if (playerCiv.goldenAgeProgress > 0) {
          let goldenAgePercent:string = ((playerCiv.goldenAgeProgress / playerCiv.goldenAgeGoal) * 100) + '%';
          let bgString:string = u.progressBar(goldenAgePercent, '#BDBD6C', '#222');
          goldenAgeMeter.style.background = bgString;
        } else {
      Severity: Major
      Found in src/utils/goldenage.ts and 1 other location - About 1 hr to fix
      src/utils/goldenage.ts on lines 16..20

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 70.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

        constructor(tradingNation: Nation, gave: Resource, gaveAmount: number, forResource: Resource, forAmount: number, year: number) {
          this.tradingNation = tradingNation;
          this.gaveResource = gave;
          this.gaveAmount = gaveAmount;
          this.forResource = forResource;
      Severity: Major
      Found in src/classes/trade/trade-deal.ts and 2 other locations - About 1 hr to fix
      src/classes/faith-bonus.ts on lines 11..18
      src/classes/legacy.ts on lines 9..16

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 70.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        } else {
          let goldenAgePercent:string = ((playerCiv.goldenAgeProgress / playerCiv.goldenAgeGoal) * 100) + '%';
          let bgString:string = u.progressBar(goldenAgePercent, '#DB3535', '#DB3535');
          goldenAgeMeter.style.background = bgString;
        }
      Severity: Major
      Found in src/utils/goldenage.ts and 1 other location - About 1 hr to fix
      src/utils/goldenage.ts on lines 12..16

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 70.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

        constructor(name: string, tier: FaithTier, enabled: boolean, purchased: boolean, effect: string, func: Function ) {
          this.name = name;
          this.tier = tier;
          this.enabled = enabled;
          this.purchased = purchased;
      Severity: Major
      Found in src/classes/faith-bonus.ts and 2 other locations - About 1 hr to fix
      src/classes/legacy.ts on lines 9..16
      src/classes/trade/trade-deal.ts on lines 12..19

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 70.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

        constructor(name: string, type: string, level: number, maxLevel: number, cost:number, description: string) {
          this.name = name;
          this.type = type;
          this.level = level;
          this.maxLevel = maxLevel;
      Severity: Major
      Found in src/classes/legacy.ts and 2 other locations - About 1 hr to fix
      src/classes/faith-bonus.ts on lines 11..18
      src/classes/trade/trade-deal.ts on lines 12..19

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 70.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      let gow:FaithBonus = new FaithBonus('God of War', FaithTier.Pantheon, true, false, `+15% <img src='img/strength.png' />`, function (resources:Collection<Resource>, playerCiv:Civilization) {
        playerCiv.strength *= 1.15;
      });
      Severity: Major
      Found in src/data/faith-bonus.ts and 1 other location - About 1 hr to fix
      src/data/faith-bonus.ts on lines 31..33

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 67.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      let ps:FaithBonus = new FaithBonus('Protective Spirits', FaithTier.Pantheon, true, false, `+30% <img src='img/defense.png' />`, function (resources:Collection<Resource>, playerCiv:Civilization) {
        playerCiv.defense *= 1.3;
      });
      Severity: Major
      Found in src/data/faith-bonus.ts and 1 other location - About 1 hr to fix
      src/data/faith-bonus.ts on lines 15..17

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 67.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        const stone:IResource = {
          name: 'stone',
          plural: 'stones',
          perClick: 0,
          perSecond: 0,
        Severity: Major
        Found in src/data/resource.ts and 1 other location - About 1 hr to fix
        src/data/resource.ts on lines 70..81

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 66.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        describe('Main buttons in the game', () => {
          it('should have a class of main-button-wrapper', () => {
            const wrapper = shallow(<MainButtons />);
            expect(wrapper.is('.main-button-wrapper')).toBe(true);
          });
        Severity: Major
        Found in src/components/Resources/__tests__/MainButtons.spec.tsx and 1 other location - About 1 hr to fix
        src/components/Start/__tests__/Start.spec.tsx on lines 7..12

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 66.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        describe('Start', () => {
          it('should have a class of start', () => {
            const wrapper = shallow(<Start />);
            expect(wrapper.is('.start')).toBe(true);
          });
        Severity: Major
        Found in src/components/Start/__tests__/Start.spec.tsx and 1 other location - About 1 hr to fix
        src/components/Resources/__tests__/MainButtons.spec.tsx on lines 7..12

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 66.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        const wood:IResource = {
          name: 'wood',
          plural: 'wood',
          perClick: 0,
          perSecond: 0,
        Severity: Major
        Found in src/data/resource.ts and 1 other location - About 1 hr to fix
        src/data/resource.ts on lines 57..68

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 66.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              let miner:Citizen = new Citizen('miner', 'miner', '#CCBE93', 0, 'Miners provide +.2 <img src="img/prod.png"> PC and +.2 PS.', { name: 'prod', mod: 'PC', amount: .5 }, { name: 'prod', mod: 'PS', amount: .5 }, {}, {}, true, true);
              Severity: Major
              Found in src/data/citizen.ts and 2 other locations - About 1 hr to fix
              src/data/citizen.ts on lines 8..8
              src/data/citizen.ts on lines 10..10

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 61.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              let farmer:Citizen = new Citizen('farmer', 'farmer', '#94C484', 0, 'Farmers provide +.2 <img src="img/food.png"> PC and +1.2 PS.', {name: 'food', mod: 'PC', amount: .2 }, { name: 'food', mod: 'PS', amount: 1.2 }, {}, {}, true, true);
              Severity: Major
              Found in src/data/citizen.ts and 2 other locations - About 1 hr to fix
              src/data/citizen.ts on lines 9..9
              src/data/citizen.ts on lines 10..10

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 61.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              let woodcutter:Citizen = new Citizen('woodcutter', 'woodcutter', '#8C775B', 0, 'Woodcutters provide +.2 <img src="img/prod.png"> PC and +.2 PS', { name: 'prod', mod: 'PC', amount: .4 }, { name: 'prod', mod: 'PS', amount: .4 }, {}, {}, true, false);
              Severity: Major
              Found in src/data/citizen.ts and 2 other locations - About 1 hr to fix
              src/data/citizen.ts on lines 8..8
              src/data/citizen.ts on lines 9..9

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 61.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Severity
              Category
              Status
              Source
              Language