af83/chouette-core

View on GitHub

Showing 922 of 922 total issues

Function filters has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export default function  filters(state = {}, action) {
  switch (action.type) {
    case 'RESET_FILTERS':
      let interval = {
        start:{
Severity: Minor
Found in app/packs/src/vehicle_journeys/reducers/filters.js - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function selection has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export default function selection(state = initialState, action) {
    const { selection, filters: { toggleArrivals } } = state
    const { copyModal } = selection

    switch(action.type) {
Severity: Minor
Found in app/packs/src/vehicle_journeys/reducers/selection.js - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method validate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def validate
        return unless value.present?
        @valid = true

        if collection_is_a_hash?
Severity: Minor
Found in app/models/custom_field.rb - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function handleRedirect has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const handleRedirect = callback => response => {
  for (const [name, value] of response.headers.entries()) {
    if (name === 'location') {
      const status = response.ok ? 'notice' : 'error'
      callback(status)
Severity: Minor
Found in app/packs/src/helpers/redirect.js - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method current_checksum_source has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def current_checksum_source(db_lookup: true)
    source = checksum_replace_nil_or_empty_values(self.checksum_attributes(db_lookup))
    source += self.custom_fields_checksum if self.respond_to?(:custom_fields_checksum)
    source.map{ |item|
      if item.kind_of?(Array)
Severity: Minor
Found in app/models/concerns/checksum_support.rb - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method import! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def import!
        netex_source.passenger_stop_assignments.each do |stop_assignment|
          scheduled_stop_point_id = stop_assignment.scheduled_stop_point_ref&.ref
          stop_area_code = (stop_assignment.quay_ref || stop_assignment.stop_place_ref)&.ref

Severity: Minor
Found in app/models/import/netex_generic.rb - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method improve_shape has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def improve_shape(journey_pattern)
      return unless journey_pattern.shape_id
      return unless improved_shape_ids.add?(journey_pattern.shape_id)

      shape = journey_pattern.shape
Severity: Minor
Found in app/models/import/gtfs.rb - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method prepare_new has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def prepare_new
    if Rails.env.test? && new.present?
      Rails.logger.debug 'Use existing new for test'
      return
    end
Severity: Minor
Found in app/models/merge.rb - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method compute_new_status has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def compute_new_status
      return children_status unless control_list_runs.present? || macro_list_runs.present?

      if children_status == 'running' || processed_status == 'running'
        'running'
Severity: Minor
Found in app/models/import/workbench.rb - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method import! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def import!
      if specific_default_company
          self.default_company = specific_default_company

          if specific_default_company&.time_zone
Severity: Minor
Found in app/models/import/gtfs.rb - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method action_link has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def action_link args={}
      raise "You are using `action_link` inside a with_instance_decorator block, but not on the instance decorator itself.\n Use `instance_decorator.action_link` or move outside of the block, as this may lead to an unforeseen behaviour." if @_with_instance_decorator
      args[:if] = @_condition if args[:if].nil?

      options, link_options = parse_options args
Severity: Minor
Found in app/lib/af83/decorator/enhanced_decorator.rb - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method build has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def build
      merge.processings.each do |processing|
        processed = processing.processed
        next unless processed

Severity: Minor
Found in app/controllers/merges_controller.rb - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method generate_registration_number has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def generate_registration_number
    return "" unless registration_number_format.present?
    last = self.stop_areas.order("registration_number DESC NULLS LAST").limit(1).first&.registration_number
    if self.stop_areas.count == 26**self.registration_number_format.size
      raise "NO MORE AVAILABLE VALUES FOR registration_number in referential #{self.name}"
Severity: Minor
Found in app/models/stop_area_referential.rb - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method filter_item_class has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def filter_item_class q, key
    ActiveSupport::Deprecation.warn "#filter_item_class should be replaced by smart Search inputs"

    active = false
    if q.present? && q[key].present?
Severity: Minor
Found in app/helpers/search_helper.rb - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method update_vjas_from_state has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def update_vjas_from_state state
      state.each do |vjas|
        next if vjas["dummy"]
        stop_point = Chouette::StopPoint.find_by(objectid: vjas['stop_point_objectid'])
        stop_area = stop_point&.stop_area
Severity: Minor
Found in app/models/chouette/vehicle_journey.rb - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method flattened_circulation_periods has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def flattened_circulation_periods
      periods = time_tables.map(&:periods).flatten
      out = []
      dates = periods.map {|p| [p.period_start, p.period_end + 1.day]}

Severity: Minor
Found in app/models/chouette/vehicle_journey.rb - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method apply_pattern has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def apply_pattern(model, value) # rubocop:disable Metrics/MethodLength
        return value unless has_pattern?

        result = pattern.gsub(VALUE_REGEXP) do
          if ::Regexp.last_match(1) && ::Regexp.last_match(2)
Severity: Minor
Found in app/models/macro/create_code.rb - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method line_status has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def line_status(line)
    case line.status
    when :deactivated
      render_icon('fa fa-exclamation-circle fa-lg text-danger', Chouette::Line.tmf('deactivated')) + Chouette::Line.tmf('deactivated')
    else
Severity: Minor
Found in app/helpers/referentials_helper.rb - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method validate_each has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def validate_each(record, attribute, value)
    export = record.is_a?(Export::Base) ? record : record.export

    extra_attributes = options.fetch(:extra_attributes, [])
    options_keys = export.class.options.keys
Severity: Minor
Found in app/validators/export_options_validator.rb - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def create(path)
        log "Prepare context for '#{path.map(&:name).join('>')}' into #{model.name}"

        next_model = path.shift
        user_context = path.empty?
Severity: Minor
Found in app/lib/chouette/factory/context.rb - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Severity
Category
Status
Source
Language