af83/chouette-core

View on GitHub
app/packs/src/journey_patterns/components/JourneyPatterns.js

Summary

Maintainability
D
2 days
Test Coverage

Function render has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render() {
    this.previousCity = undefined
    requestAnimationFrame(function(){
      $(document).trigger("table:updated")
    })
Severity: Major
Found in app/packs/src/journey_patterns/components/JourneyPatterns.js - About 3 hrs to fix

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

      componentDidUpdate(prevProps, prevState) {
        if(this.props.status.isFetching == false){
          $('.table-2entries').each(function() {
            var refH = []
            var refCol = []
    Severity: Minor
    Found in app/packs/src/journey_patterns/components/JourneyPatterns.js - About 1 hr to fix

      Function render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        render() {
          this.previousCity = undefined
          requestAnimationFrame(function(){
            $(document).trigger("table:updated")
          })
      Severity: Minor
      Found in app/packs/src/journey_patterns/components/JourneyPatterns.js - About 25 mins 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 3 locations. Consider refactoring.
      Open

              $(this).find('.t2e-item').children('div').each(function() {
                var h = this.getBoundingClientRect().height;
                if(refCol.length < refH.length){
                  refCol.push(h)
                } else {
      app/packs/src/vehicle_journeys/components/VehicleJourneysList.js on lines 128..142
      app/packs/src/vehicle_journeys/components/tools/SelectSpecificStop.js on lines 49..63

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

      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

              for(var nth = 1; nth < refH.length; nth++) {
                $(this).find('.td:nth-child('+ (nth + 1) +')').css('height', refCol[nth]);
              }
      app/packs/src/vehicle_journeys/components/VehicleJourneysList.js on lines 152..154

      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

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

              $(this).find('.t2e-head').children('div').each(function() {
                var h = this.getBoundingClientRect().height;
                refH.push(h)
              });
      app/packs/src/vehicle_journeys/components/VehicleJourneysList.js on lines 122..125
      app/packs/src/vehicle_journeys/components/tools/SelectSpecificStop.js on lines 43..46

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

      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

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

              for(var n = 0; n < refH.length; n++) {
                if(refCol[n] < refH[n]) {
                  refCol[n] = refH[n]
                }
              }
      app/packs/src/vehicle_journeys/components/VehicleJourneysList.js on lines 144..148
      app/packs/src/vehicle_journeys/components/tools/SelectSpecificStop.js on lines 65..69

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

          if(this.props.status.isFetching == true) {
            return (
              <div className="isLoading" style={{marginTop: 80, marginBottom: 80}}>
                <div className="loader"></div>
              </div>
      app/packs/src/routes/components/App.js on lines 24..41
      app/packs/src/time_tables/components/Timetable.js on lines 23..101
      app/packs/src/vehicle_journeys/components/VehicleJourneysList.js on lines 173..285

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

      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

      There are no issues that match your filters.

      Category
      Status