knowbee/rwanda

View on GitHub

Showing 46 of 46 total issues

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

module.exports = {
  Bungwe: bungwe,
  Butaro: butaro,
  Cyanika: cyanika,
  Cyeru: cyeru,
Severity: Major
Found in data/provinces/north/districts/burera/index.js and 2 other locations - About 3 hrs to fix
data/provinces/north/districts/rulindo/index.js on lines 25..43
data/provinces/south/districts/nyamagabe/index.js on lines 25..43

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 97.

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

module.exports = {
  Buruhukiro: buruhukiro,
  Cyanika: cyanika,
  Gasaka: gasaka,
  Gatare: gatare,
Severity: Major
Found in data/provinces/south/districts/nyamagabe/index.js and 2 other locations - About 3 hrs to fix
data/provinces/north/districts/burera/index.js on lines 25..43
data/provinces/north/districts/rulindo/index.js on lines 25..43

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 97.

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

module.exports = {
  Base: base,
  Burega: burega,
  Bushoki: bushoki,
  Buyoga: buyoga,
Severity: Major
Found in data/provinces/north/districts/rulindo/index.js and 2 other locations - About 3 hrs to fix
data/provinces/north/districts/burera/index.js on lines 25..43
data/provinces/south/districts/nyamagabe/index.js on lines 25..43

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 97.

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 Villages has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

exports.Villages = (province, district, sector, cell) => {
  if (
    province &&
    district &&
    sector &&
Severity: Minor
Found in index.js - About 3 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

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

module.exports = {
  Gashora: gashora,
  Juru: juru,
  Kamabuye: kamabuye,
  Mareba: mareba,
Severity: Major
Found in data/provinces/east/districts/bugesera/index.js and 3 other locations - About 2 hrs to fix
data/provinces/kigali/districts/gasabo/index.js on lines 23..39
data/provinces/north/districts/musanze/index.js on lines 23..39
data/provinces/west/districts/nyamasheke/index.js on lines 23..39

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 87.

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 4 locations. Consider refactoring.
Open

module.exports = {
  Busogo: busogo,
  Cyuve: cyuve,
  Gacaca: gacaca,
  Gashaki: gashaki,
Severity: Major
Found in data/provinces/north/districts/musanze/index.js and 3 other locations - About 2 hrs to fix
data/provinces/east/districts/bugesera/index.js on lines 23..39
data/provinces/kigali/districts/gasabo/index.js on lines 23..39
data/provinces/west/districts/nyamasheke/index.js on lines 23..39

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 87.

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 4 locations. Consider refactoring.
Open

module.exports = {
  Bumbogo: bumbogo,
  Gatsata: gatsata,
  Gikomero: gikomero,
  Gisozi: gisozi,
Severity: Major
Found in data/provinces/kigali/districts/gasabo/index.js and 3 other locations - About 2 hrs to fix
data/provinces/east/districts/bugesera/index.js on lines 23..39
data/provinces/north/districts/musanze/index.js on lines 23..39
data/provinces/west/districts/nyamasheke/index.js on lines 23..39

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 87.

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 4 locations. Consider refactoring.
Open

module.exports = {
  Bushekeri: bushekeri,
  Bushenge: bushenge,
  Cyato: cyato,
  Gihombo: gihombo,
Severity: Major
Found in data/provinces/west/districts/nyamasheke/index.js and 3 other locations - About 2 hrs to fix
data/provinces/east/districts/bugesera/index.js on lines 23..39
data/provinces/kigali/districts/gasabo/index.js on lines 23..39
data/provinces/north/districts/musanze/index.js on lines 23..39

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 87.

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 Cells has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

exports.Cells = (province, district, sector) => {
  if (
    province &&
    district &&
    sector &&
Severity: Minor
Found in index.js - About 2 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

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

module.exports = {
  Gatunda: gatunda,
  Karama: karama,
  Karangazi: karangazi,
  Katabagemu: katabagemu,
Severity: Major
Found in data/provinces/east/districts/nyagatare/index.js and 5 other locations - About 2 hrs to fix
data/provinces/east/districts/gatsibo/index.js on lines 22..37
data/provinces/east/districts/ngoma/index.js on lines 22..37
data/provinces/east/districts/rwamagana/index.js on lines 22..37
data/provinces/south/districts/huye/index.js on lines 22..37
data/provinces/south/districts/nyaruguru/index.js on lines 22..37

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 82.

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 6 locations. Consider refactoring.
Open

module.exports = {
  Gashanda: gashanda,
  Jarama: jarama,
  Karembo: karembo,
  Kazo: kazo,
Severity: Major
Found in data/provinces/east/districts/ngoma/index.js and 5 other locations - About 2 hrs to fix
data/provinces/east/districts/gatsibo/index.js on lines 22..37
data/provinces/east/districts/nyagatare/index.js on lines 22..37
data/provinces/east/districts/rwamagana/index.js on lines 22..37
data/provinces/south/districts/huye/index.js on lines 22..37
data/provinces/south/districts/nyaruguru/index.js on lines 22..37

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 82.

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 6 locations. Consider refactoring.
Open

module.exports = {
  Gishamvu: gishamvu,
  Huye: huye,
  Karama: karama,
  Kigoma: kigoma,
Severity: Major
Found in data/provinces/south/districts/huye/index.js and 5 other locations - About 2 hrs to fix
data/provinces/east/districts/gatsibo/index.js on lines 22..37
data/provinces/east/districts/ngoma/index.js on lines 22..37
data/provinces/east/districts/nyagatare/index.js on lines 22..37
data/provinces/east/districts/rwamagana/index.js on lines 22..37
data/provinces/south/districts/nyaruguru/index.js on lines 22..37

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 82.

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 6 locations. Consider refactoring.
Open

module.exports = {
  Gasange: gasange,
  Gatsibo: gatsibo,
  Gitoki: gitoki,
  Kabarore: kabarore,
Severity: Major
Found in data/provinces/east/districts/gatsibo/index.js and 5 other locations - About 2 hrs to fix
data/provinces/east/districts/ngoma/index.js on lines 22..37
data/provinces/east/districts/nyagatare/index.js on lines 22..37
data/provinces/east/districts/rwamagana/index.js on lines 22..37
data/provinces/south/districts/huye/index.js on lines 22..37
data/provinces/south/districts/nyaruguru/index.js on lines 22..37

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 82.

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 6 locations. Consider refactoring.
Open

module.exports = {
  Fumbwe: fumbwe,
  Gahengeri: gahengeri,
  Gishali: gishali,
  Karenge: karenge,
Severity: Major
Found in data/provinces/east/districts/rwamagana/index.js and 5 other locations - About 2 hrs to fix
data/provinces/east/districts/gatsibo/index.js on lines 22..37
data/provinces/east/districts/ngoma/index.js on lines 22..37
data/provinces/east/districts/nyagatare/index.js on lines 22..37
data/provinces/south/districts/huye/index.js on lines 22..37
data/provinces/south/districts/nyaruguru/index.js on lines 22..37

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 82.

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 6 locations. Consider refactoring.
Open

module.exports = {
  Busanze: busanze,
  Cyahinda: cyahinda,
  Kibeho: kibeho,
  Kivu: kivu,
Severity: Major
Found in data/provinces/south/districts/nyaruguru/index.js and 5 other locations - About 2 hrs to fix
data/provinces/east/districts/gatsibo/index.js on lines 22..37
data/provinces/east/districts/ngoma/index.js on lines 22..37
data/provinces/east/districts/nyagatare/index.js on lines 22..37
data/provinces/east/districts/rwamagana/index.js on lines 22..37
data/provinces/south/districts/huye/index.js on lines 22..37

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 82.

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 4 locations. Consider refactoring.
Open

module.exports = {
  Boneza: boneza,
  Gihango: gihango,
  Kigeyo: kigeyo,
  Kivumu: kivumu,
Severity: Major
Found in data/provinces/west/districts/rutsiro/index.js and 3 other locations - About 2 hrs to fix
data/provinces/south/districts/gisagara/index.js on lines 21..35
data/provinces/west/districts/karongi/index.js on lines 21..35
data/provinces/west/districts/ngororero/index.js on lines 21..35

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 77.

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 4 locations. Consider refactoring.
Open

module.exports = {
  Bwishyura: bwishyura,
  Gashari: gashari,
  Gishyita: gishyita,
  Gitesi: gitesi,
Severity: Major
Found in data/provinces/west/districts/karongi/index.js and 3 other locations - About 2 hrs to fix
data/provinces/south/districts/gisagara/index.js on lines 21..35
data/provinces/west/districts/ngororero/index.js on lines 21..35
data/provinces/west/districts/rutsiro/index.js on lines 21..35

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 77.

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 4 locations. Consider refactoring.
Open

module.exports = {
  Gikonko: gikonko,
  Gishubi: gishubi,
  Kansi: kansi,
  Kibirizi: kibirizi,
Severity: Major
Found in data/provinces/south/districts/gisagara/index.js and 3 other locations - About 2 hrs to fix
data/provinces/west/districts/karongi/index.js on lines 21..35
data/provinces/west/districts/ngororero/index.js on lines 21..35
data/provinces/west/districts/rutsiro/index.js on lines 21..35

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 77.

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 4 locations. Consider refactoring.
Open

module.exports = {
  Bwira: bwira,
  Gatumba: gatumba,
  Hindiro: hindiro,
  Kabaya: kabaya,
Severity: Major
Found in data/provinces/west/districts/ngororero/index.js and 3 other locations - About 2 hrs to fix
data/provinces/south/districts/gisagara/index.js on lines 21..35
data/provinces/west/districts/karongi/index.js on lines 21..35
data/provinces/west/districts/rutsiro/index.js on lines 21..35

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 77.

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 Sectors has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

exports.Sectors = (province, district) => {
  if (province && district && datafile[formatInput(province)]) {
    const sectors = datafile[formatInput(province)][formatInput(district)];
    if (!sectors) {
      throw Error("Given data was invalid");
Severity: Minor
Found in index.js - About 1 hr 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

Severity
Category
Status
Source
Language