af83/chouette-core

View on GitHub

Showing 922 of 922 total issues

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

  render() {
    return (
      <div
        className={this.isIn(this.props.currentDate) + (this.props.metas.day_types[this.props.day.wday] || !this.props.day.in_periods ? '' : ' out_from_daytypes')}
      >
Severity: Minor
Found in app/packs/src/time_tables/components/PeriodsInDay.js - About 1 hr to fix

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

        validate(toggleArrivals) {
            this.clipboard.error = null
            const deserializedContent = this.contentTable
            const deserializedCopyContent = this.copyContent.deserialize(toggleArrivals)
    
    
    Severity: Minor
    Found in app/packs/src/vehicle_journeys/helpers/ClipboardHelper.js - About 1 hr to fix

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

        submitTimetable: (dispatch, timetable, metas, next) => {
          dispatch(actions.fetchingApi())
          let strDayTypes = actions.arrayToStrDayTypes(metas.day_types)
          metas.day_types = strDayTypes
          let sentState = assign({}, timetable, metas)
      Severity: Minor
      Found in app/packs/src/time_tables/actions/index.js - About 1 hr to fix

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

        const initPublicationSetupButtons = container => {
          $(container).find("input[type=checkbox][name*=destroy]").each((i, el) => {
            const $el = $(el)
            const $group = $($el.parents('.form-group')[0])
            $group.hide()
        Severity: Minor
        Found in app/packs/entrypoints/publication_setups/form.js - About 1 hr to fix

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

            constructor(
              reducer,
              initialState,
              actionsCreator = {}
            ) {
          Severity: Minor
          Found in app/packs/src/helpers/Store.js - About 1 hr to fix

            Method multiple_selection_toolbox has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def multiple_selection_toolbox(actions, collection_name:)
                links = content_tag :ul do
            
                  # #5206 `if params[:controller]` mieux passer comme parametre si besoin
                  delete_path = nil
            Severity: Minor
            Found in app/helpers/multiple_selection_toolbox_helper.rb - About 1 hr to fix

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

                  render() {
                      const {
                          vjas,
                          x,
                          y,
              Severity: Minor
              Found in app/packs/src/vehicle_journeys/components/VehicleJourneyAtStop.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 Navigate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

              export default function Navigate({ dispatch, journeyPatterns, pagination, status }) {
                let firstPage = 1
                let lastPage = Math.ceil(pagination.totalCount / window.journeyPatternsPerPage)
              
                let firstItemOnPage = firstPage + (pagination.perPage * (pagination.page - firstPage))
              Severity: Minor
              Found in app/packs/src/journey_patterns/components/Navigate.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 render has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                render() {
                  this.previousCity = undefined
                  let detailed_calendars = this.hasFeature('detailed_calendars') && !this.disabled
                  let detailed_calendars_shown = $('.detailed-timetables-bt').hasClass('active')
                  let { time_tables } = this.props.value
              Severity: Minor
              Found in app/packs/src/vehicle_journeys/components/VehicleJourney.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

              Method change_status has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                def change_status(status, attributes = {})
                  attributes.delete_if { |_, v| v.nil? }
              
                  now = Time.zone.now
              
              
              Severity: Minor
              Found in app/models/operation.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

              Method values has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                def values(offset: 1, limit: 1000)
                  if sequence_type.range_sequence?
                    return [] unless range_start && range_end
              
                    value_start = range_start + offset - 1
              Severity: Minor
              Found in app/models/sequence.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

              Method process has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                    def process(source_file, target_file)
                      route_ids = self.route_ids
                      ignore_parents = self.ignore_parents?
              
                      gtfs_target_for = Proc.new do |resource, associations|
              Severity: Minor
              Found in app/models/source.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

              Method referential_identifier has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def referential_identifier
                    %w[line_referential stop_area_referential].each do |name|
                      if (r = self.class.reflections[name])
                        id  = send(r.foreign_key)
                        return id  ? [r.klass, { id: id }] : nil
              Severity: Minor
              Found in app/models/concerns/objectid_support.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

              Method unique_codes has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                    def unique_codes(model)
                      unique_codes = {}
              
                      if model.respond_to?(:codes)
                        code_spaces = model.codes.map(&:code_space).uniq
              Severity: Minor
              Found in app/models/export/ara.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

              Method process_trip has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                def process_trip(resource, trip, stop_times)
                  begin
                    raise InvalidTripSingleStopTime unless stop_times.many?
                    raise InvalidTripTimesError unless consistent_stop_times(stop_times)
              
              
              Severity: Minor
              Found in app/models/import/gtfs.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

              Method all_costs_values_must_be_positive has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  validate def all_costs_values_must_be_positive
                    unless costs.empty?
                      invalid_distances = false
                      invalid_times = false
                      costs.values.each do |val|
              Severity: Minor
              Found in app/models/chouette/journey_pattern.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

              Method definition_list has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                def definition_list title, test, options={}
                  return unless test.present?
              
                  togglable = options[:togglable]
                  togglable = 0 if togglable.present? && !togglable.is_a?(Fixnum)
              Severity: Minor
              Found in app/helpers/newapplication_helper.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

              Method full_schedule? has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def full_schedule?
                    full = true
                    stop_points.sort_by(&:position).inject(nil) do |start, finish|
                      next finish unless start.present?
                      costs = costs_between(start, finish)
              Severity: Minor
              Found in app/models/chouette/journey_pattern.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 4 locations. Consider refactoring.
              Open

                      shapeWaypoint: new Style({
                          image: new Circle({
                              radius: 8,
                              stroke: new Stroke({ color: 'white', width: 2 }),
                              fill: new Fill({ color: 'red' })
              Severity: Major
              Found in app/packs/src/helpers/open_layers/styles.js and 3 other locations - About 1 hr to fix
              app/packs/src/helpers/open_layers/styles.js on lines 83..89
              app/packs/src/helpers/open_layers/styles.js on lines 91..97
              app/packs/src/helpers/open_layers/styles.js on lines 98..104

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

              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

                      shapeConstraint: new Style({
                          image: new Circle({
                              radius: 8,
                              stroke: new Stroke({ color: 'red', width: 2 }),
                              fill: new Fill({ color: 'white' })
              Severity: Major
              Found in app/packs/src/helpers/open_layers/styles.js and 3 other locations - About 1 hr to fix
              app/packs/src/helpers/open_layers/styles.js on lines 76..82
              app/packs/src/helpers/open_layers/styles.js on lines 91..97
              app/packs/src/helpers/open_layers/styles.js on lines 98..104

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

              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