af83/chouette-core

View on GitHub

Showing 922 of 922 total issues

Method method_missing has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def method_missing name, *args, &block
    if block_given?
      @options[name] = block
    elsif args.size == 0
      out = @options[name]
Severity: Minor
Found in app/lib/af83/decorator/link.rb - 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

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

  class LineGroup < Base
    extend Enumerize

    # All search attributes
    attribute :text
Severity: Major
Found in app/lib/search/line_group.rb and 1 other location - About 1 hr to fix
app/lib/search/stop_area_group.rb on lines 4..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 50.

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
    extend Enumerize

    # All search attributes
    attribute :text
Severity: Major
Found in app/lib/search/stop_area_group.rb and 1 other location - About 1 hr to fix
app/lib/search/line_group.rb on lines 4..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 50.

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

export default function pagination(state = {}, action) {
  switch (action.type) {
    case 'RECEIVE_JOURNEY_PATTERNS':
    case 'RECEIVE_VEHICLE_JOURNEYS':
      return _.assign({}, state, {stateChanged: false})
Severity: Minor
Found in app/packs/src/vehicle_journeys/reducers/pagination.js - About 1 hr to fix

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

      constructor(props) {
        super(props)
    
        this.state = {
          hasPolicy: false
    Severity: Major
    Found in app/packs/src/shape_editor/components/SaveButton.jsx and 1 other location - About 1 hr to fix
    app/packs/src/time_tables/components/PeriodList.js on lines 5..11

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

    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

        case 'SELECT_TT_FILTER':
          newQuery = _.assign({}, state.query, {timetable : action.selectedItem})
          return _.assign({}, state, {query: newQuery})
    Severity: Major
    Found in app/packs/src/vehicle_journeys/reducers/filters.js and 3 other locations - About 1 hr to fix
    app/packs/src/vehicle_journeys/reducers/filters.js on lines 47..49
    app/packs/src/vehicle_journeys/reducers/filters.js on lines 50..52
    app/packs/src/vehicle_journeys/reducers/modal.js on lines 166..168

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

    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

        case 'SELECT_JP_FILTER':
          newQuery = _.assign({}, state.query, {journeyPattern : action.selectedItem})
          return _.assign({}, state, {query: newQuery})
    Severity: Major
    Found in app/packs/src/vehicle_journeys/reducers/filters.js and 3 other locations - About 1 hr to fix
    app/packs/src/vehicle_journeys/reducers/filters.js on lines 44..46
    app/packs/src/vehicle_journeys/reducers/filters.js on lines 50..52
    app/packs/src/vehicle_journeys/reducers/modal.js on lines 166..168

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

    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

        case 'SELECT_VJ_FILTER':
          newQuery = _.assign({}, state.query, {vehicleJourney : action.selectedItem})
          return _.assign({}, state, {query: newQuery})
    Severity: Major
    Found in app/packs/src/vehicle_journeys/reducers/filters.js and 3 other locations - About 1 hr to fix
    app/packs/src/vehicle_journeys/reducers/filters.js on lines 44..46
    app/packs/src/vehicle_journeys/reducers/filters.js on lines 47..49
    app/packs/src/vehicle_journeys/reducers/modal.js on lines 166..168

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

    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

        case 'SELECT_TT_CALENDAR_MODAL':
          newModalProps = _.assign({}, state.modalProps, {selectedTimetable : action.selectedItem})
          return _.assign({}, state, {modalProps: newModalProps})
    Severity: Major
    Found in app/packs/src/vehicle_journeys/reducers/modal.js and 3 other locations - About 1 hr to fix
    app/packs/src/vehicle_journeys/reducers/filters.js on lines 44..46
    app/packs/src/vehicle_journeys/reducers/filters.js on lines 47..49
    app/packs/src/vehicle_journeys/reducers/filters.js on lines 50..52

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

    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

                {I18n.t('will_paginate.page_entries_info.multi_page', { model: capitalize(I18n.model_name('journey_pattern', { plural: true })), from: firstItemOnPage, to: lastItemOnPage, count: pagination.totalCount})}
    Severity: Major
    Found in app/packs/src/journey_patterns/components/Navigate.js and 1 other location - About 1 hr to fix
    app/packs/src/vehicle_journeys/components/Navigate.js on lines 21..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 56.

    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

            {I18n.t('will_paginate.page_entries_info.multi_page', { model: capitalize(I18n.model_name('vehicle_journey', { plural: true })), from: minVJ, to: maxVJ, count: pagination.totalCount })}
    Severity: Major
    Found in app/packs/src/vehicle_journeys/components/Navigate.js and 1 other location - About 1 hr to fix
    app/packs/src/journey_patterns/components/Navigate.js on lines 21..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 56.

    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

      constructor(props) {
        super(props)
        this.state = {
          display: false
        }
    Severity: Major
    Found in app/packs/src/time_tables/components/PeriodList.js and 1 other location - About 1 hr to fix
    app/packs/src/shape_editor/components/SaveButton.jsx on lines 4..12

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

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

    const mapDispatchToProps = (dispatch) => {
      return {
        onModalClose: () =>{
          dispatch(actions.closeModal())
        },

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

        render() {
          const { hasError, value } = this.props
          if(value.edit)
            return (
              <div className={`select2-bootstrap-append ${hasError && 'has-error'}`}>
      Severity: Minor
      Found in app/packs/src/routes/components/BSelect2.js - About 1 hr to fix

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

        const mapDispatchToProps = (dispatch) => {
          return {
            onDeletePeriod: (index, dayTypes) =>{
              dispatch(actions.deletePeriod(index, dayTypes))
            },
        Severity: Minor
        Found in app/packs/src/time_tables/containers/Timetable.js - About 1 hr to fix

          Function initButtons has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            initButtons() {
              this.prevBt.click(e=> {
                this.overview.prevPage();
                e.preventDefault();
                return false;
          Severity: Minor
          Found in app/packs/src/referential_overview/index.js - About 1 hr to fix

            Function App has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function App() {
            
              useSubmitMover()
            
              return (
            Severity: Minor
            Found in app/packs/src/vehicle_journeys/components/App.js - About 1 hr to fix

              Method int_day_types_mapping has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def int_day_types_mapping day_types
                  day_types = make_enum day_types
              
                  val = 0
                  day_types.each do |day_type|
              Severity: Minor
              Found in app/models/import/neptune.rb - About 1 hr to fix

                Method source_params has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def source_params
                    params.require(:source).permit(
                      :name,
                      :url,
                      :checksum,
                Severity: Minor
                Found in app/controllers/sources_controller.rb - About 1 hr to fix

                  Method parse_options has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def parse_options args
                        options = {}
                        %i(weight primary secondary footer on action actions policy feature if groups group before_block).each do |k|
                          options[k] = args.delete(k) if args.has_key?(k)
                        end
                  Severity: Minor
                  Found in app/lib/af83/decorator/enhanced_decorator.rb - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language