af83/chouette-core

View on GitHub

Showing 922 of 922 total issues

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

    $btDelete.on('click', e => {
      $el.trigger('click')
      e.preventDefault()
      $btDelete.hide()
      $btRestore.show()
Severity: Major
Found in app/packs/entrypoints/publication_setups/form.js and 1 other location - About 1 hr to fix
app/packs/entrypoints/publication_setups/form.js on lines 27..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 62.

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

    case 'TOGGLE_WITHOUT_TIMETABLE':
      newQuery = _.assign({}, state.query, {withoutTimeTable: !state.query.withoutTimeTable})
      return _.assign({}, state, {query: newQuery})
Severity: Major
Found in app/packs/src/vehicle_journeys/reducers/filters.js and 1 other location - About 1 hr to fix
app/packs/src/vehicle_journeys/reducers/filters.js on lines 20..22

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

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

      <OlMap
        value = {props.value}
        index = {props.index}
        onSelectMarker = {props.onSelectMarker}
        onUnselectMarker = {props.onUnselectMarker}
Severity: Major
Found in app/packs/src/routes/components/StopPoint.js and 1 other location - About 1 hr to fix
app/packs/src/routes/components/StopPoint.js on lines 18..18

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

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

Consider simplifying this complex logical expression.
Open

    if(this.props.status.isFetching == true) {
      return (
        <div className="isLoading" style={{marginTop: 80, marginBottom: 80}}>
          <div className="loader"></div>
        </div>
Severity: Critical
Found in app/packs/src/vehicle_journeys/components/VehicleJourneysList.js - About 1 hr to fix

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

      render() {
        {/* display add or remove link, only if true in daytypes */}
          {/* display add or remove link, according to context (presence in period, or not) */}
          if(this.props.value.current_month[this.props.index].in_periods == true && this.props.blueDaytype == true) {
            return (
    Severity: Minor
    Found in app/packs/src/time_tables/components/ExceptionsInDay.js - About 1 hr to fix

      Function fetchRouteCosts has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        fetchRouteCosts: (dispatch, key, index) => {
          if(actions.fetchingRouteCosts){
              // A request is already sent, wait for it
              if(!actions.waitingForRouteCosts){
                actions.waitingForRouteCosts = []
      Severity: Minor
      Found in app/packs/src/journey_patterns/actions/index.js - About 1 hr to fix

        Function mapDispatchToProps has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const mapDispatchToProps = (dispatch) => {
          return {
            onLoadFirstPage() {
              this.fetchingApi()
              this.fetchJourneyPatterns()
        Severity: Minor
        Found in app/packs/src/journey_patterns/containers/JourneyPatternList.js - About 1 hr to fix

          Function submitVehicleJourneys has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            submitVehicleJourneys : (dispatch, state, next) => {
              dispatch(actions.fetchingApi())
              let urlJSON = window.location.pathname + ".json"
              let hasError = false
              fetch(urlJSON, {
          Severity: Minor
          Found in app/packs/src/vehicle_journeys/actions/index.js - About 1 hr to fix

            Method nullable_attributes has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def self.nullable_attributes # rubocop:disable Metrics/MethodLength
                  %i[
                    address_line_1
                    address_line_2
                    code
            Severity: Minor
            Found in app/models/chouette/company.rb - About 1 hr to fix

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

                  def copy_metadatas
                    source.metadatas.find_each do |metadata|
                      candidate = target.metadatas.with_lines(metadata.line_ids).find { |m| m.periodes == metadata.periodes }
                      candidate ||= target.metadatas.build(line_ids: metadata.line_ids, periodes: metadata.periodes,
                                                           referential_source: source, created_at: metadata.created_at, updated_at: metadata.created_at)
              Severity: Major
              Found in app/models/referential/copy.rb and 1 other location - About 1 hr to fix
              app/services/referential_copy.rb on lines 133..139

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

              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

                class StopAreaGroup < Base
                  def text(value)
                    change_scope(if: value.present?) do |scope|
                      name = scope.arel_table[:name]
                      scope.where(name.matches("%#{value}%"))
              Severity: Major
              Found in app/lib/query/stop_area_group.rb and 1 other location - About 1 hr to fix
              app/lib/query/line_group.rb on lines 4..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 57.

              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

                def copy_metadatas
                  source.metadatas.find_each do |metadata|
                    candidate = target.metadatas.with_lines(metadata.line_ids).find { |m| m.periodes == metadata.periodes }
                    candidate ||= target.metadatas.build(line_ids: metadata.line_ids, periodes: metadata.periodes, referential_source: source, created_at: metadata.created_at, updated_at: metadata.created_at)
                    candidate.priority = source_priority if source_priority
              Severity: Major
              Found in app/services/referential_copy.rb and 1 other location - About 1 hr to fix
              app/models/referential/copy.rb on lines 255..262

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

              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

                class LineGroup < Base
                  def text(value)
                    change_scope(if: value.present?) do |scope|
                      name = scope.arel_table[:name]
                      scope.where(name.matches("%#{value}%"))
              Severity: Major
              Found in app/lib/query/line_group.rb and 1 other location - About 1 hr to fix
              app/lib/query/stop_area_group.rb on lines 4..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 57.

              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

                              new Style({
                                  image: new Circle({
                                      radius: 4,
                                      stroke: new Stroke({
                                          color: '#007fbb',
              Severity: Major
              Found in app/packs/src/helpers/open_layers/styles.js and 2 other locations - About 1 hr to fix
              app/packs/src/helpers/open_layers/styles.js on lines 141..153
              app/packs/src/helpers/open_layers/styles.js on lines 154..166

              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

              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/journey_patterns/components/JourneyPatterns.js on lines 49..53
              app/packs/src/vehicle_journeys/components/VehicleJourneysList.js on lines 144..148

              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

              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/journey_patterns/components/JourneyPatterns.js on lines 49..53
              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 3 locations. Consider refactoring.
              Open

                      new Style({
                          image: new Circle({
                              radius: 5,
                              stroke: new Stroke({
                                  color: '#007fbb',
              Severity: Major
              Found in app/packs/src/helpers/open_layers/styles.js and 2 other locations - About 1 hr to fix
              app/packs/src/helpers/open_layers/styles.js on lines 141..153
              app/packs/src/helpers/open_layers/styles.js on lines 177..189

              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

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

                      new Style({
                          image: new Circle({
                              radius: 5,
                              stroke: new Stroke({
                                  color: '#007fbb',
              Severity: Major
              Found in app/packs/src/helpers/open_layers/styles.js and 2 other locations - About 1 hr to fix
              app/packs/src/helpers/open_layers/styles.js on lines 154..166
              app/packs/src/helpers/open_layers/styles.js on lines 177..189

              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

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

              export default function metas(state = {}, action) {
                switch (action.type) {
                  case 'RECEIVE_TIME_TABLES':
                    const { comment, day_types, color, calendar, shared } = action.json
              
              
              Severity: Minor
              Found in app/packs/src/time_tables/reducers/metas.js - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language