af83/chouette-core

View on GitHub

Showing 922 of 922 total issues

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

const mapStateToProps = (state, ownProps) => {
  return {
    editMode: state.editMode,
    disabled: ownProps.disabled,
    modal: state.modal,
app/packs/src/vehicle_journeys/containers/tools/ConstraintExclusionEditVehicleJourney.js on lines 5..13
app/packs/src/vehicle_journeys/containers/tools/DuplicateVehicleJourney.js on lines 5..13
app/packs/src/vehicle_journeys/containers/tools/NotesEditVehicleJourney.js on lines 5..13
app/packs/src/vehicle_journeys/containers/tools/TimetablesEditVehicleJourney.js on lines 5..13

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

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

const mapStateToProps = (state, ownProps) => {
  return {
    editMode: state.editMode,
    disabled: ownProps.disabled,
    modal: state.modal,
app/packs/src/vehicle_journeys/containers/tools/ConstraintExclusionEditVehicleJourney.js on lines 5..13
app/packs/src/vehicle_journeys/containers/tools/DuplicateVehicleJourney.js on lines 5..13
app/packs/src/vehicle_journeys/containers/tools/EditVehicleJourney.js on lines 5..13
app/packs/src/vehicle_journeys/containers/tools/TimetablesEditVehicleJourney.js on lines 5..13

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

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

Method input has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def input(wrapper_options = {})
    selected_color = object.send(attribute_name)
    label = if selected_color
      collection.find{|i| i.is_a?(Enumerable) && i.last == selected_color}.try(:first)
    end
Severity: Minor
Found in app/inputs/color_select_input.rb - About 1 hr to fix

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

        fetch(urlJSON, {
          credentials: 'same-origin',
        }).then(response => {
          if(response.status == 500) {
            hasError = true
    Severity: Major
    Found in app/packs/src/time_tables/actions/index.js and 2 other locations - About 1 hr to fix
    app/packs/src/journey_patterns/actions/index.js on lines 196..235
    app/packs/src/vehicle_journeys/actions/index.js on lines 392..444

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

    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

    export default function StopPointList({ stopPoints, onDeleteClick, onMoveUpClick, onMoveDownClick, onChange, onSelectChange, onToggleMap, onToggleEdit, onSelectMarker, onUnselectMarker, onUpdateViaOlMap, errors }) {
      return (
        <div className='subform'>
          { errors.invalidLength && (
            <div className="alert alert-danger">
    Severity: Major
    Found in app/packs/src/routes/components/StopPointList.js and 1 other location - About 1 hr to fix
    app/packs/src/vehicle_journeys/components/Filters.js on lines 8..186

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

    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

        fetch(urlJSON, {
          credentials: 'same-origin',
        }).then(response => {
            if(response.status == 500) {
              hasError = true
    Severity: Major
    Found in app/packs/src/vehicle_journeys/actions/index.js and 2 other locations - About 1 hr to fix
    app/packs/src/journey_patterns/actions/index.js on lines 196..235
    app/packs/src/time_tables/actions/index.js on lines 249..266

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

    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

        return fetch(urlJSON, {
          credentials: 'same-origin',
        }).then(response => {
            if(response.status == 500) {
              hasError = true
    Severity: Major
    Found in app/packs/src/journey_patterns/actions/index.js and 2 other locations - About 1 hr to fix
    app/packs/src/time_tables/actions/index.js on lines 249..266
    app/packs/src/vehicle_journeys/actions/index.js on lines 392..444

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

    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

    export default function Filters({filters, pagination, onFilter, onResetFilters, onUpdateStartTimeFilter, onUpdateEndTimeFilter, onToggleWithoutSchedule, onToggleWithoutTimeTable, onSelect2Timetable, onSelect2JourneyPattern, onSelect2VehicleJourney, vehicleJourneys }) {
      const [filtersKey, setFiltersKey] = useState(5)
    
      const resetFilters = e => {
        setFiltersKey(value => value ^ 5)
    Severity: Major
    Found in app/packs/src/vehicle_journeys/components/Filters.js and 1 other location - About 1 hr to fix
    app/packs/src/routes/components/StopPointList.js on lines 6..65

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

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

    const mapStateToProps = (state, ownProps) => {
      return {
        disabled: ownProps.disabled,
        modal: state.modal,
        vehicleJourneys: state.vehicleJourneys,
    app/packs/src/vehicle_journeys/containers/tools/ConstraintExclusionEditVehicleJourney.js on lines 5..13
    app/packs/src/vehicle_journeys/containers/tools/EditVehicleJourney.js on lines 5..13
    app/packs/src/vehicle_journeys/containers/tools/NotesEditVehicleJourney.js on lines 5..13
    app/packs/src/vehicle_journeys/containers/tools/TimetablesEditVehicleJourney.js on lines 5..13

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

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

    const mapStateToProps = (state, ownProps) => {
      return {
        editMode: state.editMode,
        modal: state.modal,
        vehicleJourneys: state.vehicleJourneys,
    app/packs/src/vehicle_journeys/containers/tools/ConstraintExclusionEditVehicleJourney.js on lines 5..13
    app/packs/src/vehicle_journeys/containers/tools/DuplicateVehicleJourney.js on lines 5..13
    app/packs/src/vehicle_journeys/containers/tools/EditVehicleJourney.js on lines 5..13
    app/packs/src/vehicle_journeys/containers/tools/NotesEditVehicleJourney.js on lines 5..13

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

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

    const mapStateToProps = (state, ownProps) => {
      return {
        editMode: state.editMode,
        modal: state.modal,
        vehicleJourneys: state.vehicleJourneys,
    app/packs/src/vehicle_journeys/containers/tools/DuplicateVehicleJourney.js on lines 5..13
    app/packs/src/vehicle_journeys/containers/tools/EditVehicleJourney.js on lines 5..13
    app/packs/src/vehicle_journeys/containers/tools/NotesEditVehicleJourney.js on lines 5..13
    app/packs/src/vehicle_journeys/containers/tools/TimetablesEditVehicleJourney.js on lines 5..13

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

    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 bounding_dates
          bounding_min = self.dates.select{|d| d.in_out}.map(&:date).compact.min
          bounding_max = self.dates.select{|d| d.in_out}.map(&:date).compact.max
    
          unless self.periods.empty?
    Severity: Major
    Found in app/models/chouette/time_table.rb and 1 other location - About 1 hr to fix
    app/models/concerns/timetable_support.rb on lines 44..56

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

    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 bounding_dates
        bounding_min = self.all_dates.select{|d| d.in_out}.map(&:date).compact.min
        bounding_max = self.all_dates.select{|d| d.in_out}.map(&:date).compact.max
    
        unless self.periods.empty?
    Severity: Major
    Found in app/models/concerns/timetable_support.rb and 1 other location - About 1 hr to fix
    app/models/chouette/time_table.rb on lines 353..364

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

    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 pagination has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function pagination(state = {}, action) {
      switch (action.type) {
        case 'RECEIVE_TIME_TABLES':
          return assign({}, state, {
            currentPage: action.json.current_periode_range,
    Severity: Minor
    Found in app/packs/src/time_tables/reducers/pagination.js - About 1 hr to fix

      Function constructor has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          constructor(store, type) {
              const isActive = store.messagesFilters[type]
      
              return {
                  [':class']() {
      Severity: Minor
      Found in app/packs/entrypoints/macro_list_runs/macro_run.js - About 1 hr to fix

        Function performSearch has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          performSearch() {
            const search = this.searchInput.val();
            if (!this.url) {
              this.url = this.searchInput.data().searchurl;
            }
        Severity: Minor
        Found in app/packs/src/helpers/merge_referentials_selector.js - About 1 hr to fix

          Method build_column_header has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def build_column_header(
                  column,
                  table_is_sortable,
                  model,
                  params
          Severity: Minor
          Found in app/helpers/table_builder_helper.rb - About 1 hr to fix

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

                case 'TOGGLE_WITHOUT_SCHEDULE':
                  newQuery = _.assign({}, state.query, {withoutSchedule: !state.query.withoutSchedule})
                  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 23..25

            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

                      <BSelect2 id={props.id} value={props.value} onChange={props.onChange} index={props.index} hasError={props.hasError}/>
            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 71..77

            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

                $btRestore.on('click', e => {
                  $el.trigger('click')
                  e.preventDefault()
                  $btRestore.hide()
                  $btDelete.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 15..21

            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

            Severity
            Category
            Status
            Source
            Language