knowbee/rwanda

View on GitHub

Showing 9 of 46 total issues

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

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

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

Function Villages has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.Villages = (province, district, sector, cell) => {
  if (
    province &&
    district &&
    sector &&
Severity: Minor
Found in index.js - About 1 hr to fix

    Function Districts has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    exports.Districts = (provinces) => {
      if (Array.isArray(provinces)) {
        const districts = [];
        for (const province of provinces) {
          if (datafile[formatInput(province)]) {
    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

    Consider simplifying this complex logical expression.
    Open

      if (
        province &&
        district &&
        sector &&
        cell &&
    Severity: Critical
    Found in index.js - About 1 hr to fix

      Function Cells has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      exports.Cells = (province, district, sector) => {
        if (
          province &&
          district &&
          sector &&
      Severity: Minor
      Found in index.js - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                  for (const cell of Object.keys(
                    datafile[datafileProvince][datafileDistrict][datafileSector]
                  )) {
                    cells.push(cell);
                  }
        Severity: Major
        Found in index.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                    for (const datafileCell of Object.keys(
                      datafile[datafileProvince][datafileDistrict][datafileSector]
                    )) {
                      for (const village of Object.keys(
                        datafile[datafileProvince][datafileDistrict][datafileSector][datafileCell]
          Severity: Major
          Found in index.js - About 45 mins to fix
            Severity
            Category
            Status
            Source
            Language