af83/chouette-core

View on GitHub

Showing 922 of 922 total issues

Function checkErrorsInPeriods has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  checkErrorsInPeriods: (start, end, index, periods) => {
    let error = ''
    start = new Date(start)
    end = new Date(end)

Severity: Minor
Found in app/packs/src/time_tables/actions/index.js - About 25 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 render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    this.previousCity = undefined
    requestAnimationFrame(function(){
      $(document).trigger("table:updated")
    })
Severity: Minor
Found in app/packs/src/journey_patterns/components/JourneyPatterns.js - About 25 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 getDelta has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  getDelta: (vjas, allowNegative=false) => {
    let { hasAllAttributes, departure_time, arrival_time} = actions.scheduleToDates(vjas)
    let delta = 0

    if (hasAllAttributes) {
Severity: Minor
Found in app/packs/src/vehicle_journeys/actions/index.js - About 25 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 index has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def index
        return unless value.present?
        return if collection_is_a_hash?
        return if value.is_a?(::String) && !value.match?(/^[0-9]+$/)

Severity: Minor
Found in app/models/custom_field.rb - About 25 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 constructor has a Cognitive Complexity of 6 (exceeds 5 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 25 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 notify_parent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def notify_parent
    return false unless finished?
    return false unless parent.present?
    return false if notified_parent_at

Severity: Minor
Found in app/models/import/netex.rb - About 25 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_dependencies has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def create_dependencies
    self.output ||= ReferentialSuite.create

    if pending?
      create_invitation_code
Severity: Minor
Found in app/models/workbench.rb - About 25 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 method_missing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def method_missing method_name, *args
      if !@custom_fields_initialized && (method_name =~ /custom_field_*/ || method_name =~ /remove_custom_field_*/) && method_name.to_sym != :custom_field_values
        initialize_custom_fields
        send method_name, *args
      else
Severity: Minor
Found in app/models/concerns/custom_fields_support.rb - About 25 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 done! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def done!(successful)
      if successful
        flag_refentials_as_urgent if flag_urgent
        create_automatic_merge if automatic_merge
      elsif archive_on_fail
Severity: Minor
Found in app/models/import/workbench.rb - About 25 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 do_transmit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def do_transmit(publication, report)
      unless publication_api
        report.failed! message: I18n.t('destinations.errors.publication_api.empty')
        return
      end
Severity: Minor
Found in app/models/destination/publication_api.rb - About 25 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 StopPoint has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export default function StopPoint(props) {
  return (
    <div className='nested-fields'>
      <div className='wrapper'>
        <div style={{width: 90}}>
Severity: Minor
Found in app/packs/src/routes/components/StopPoint.js - About 25 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 open_color_attribute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def open_color_attribute name=:color
      validates_format_of name, with: %r{\A[\dA-F]{6}\Z}, allow_nil: true, allow_blank: true

      define_method name do
        _color = read_attribute(name.to_sym)
Severity: Minor
Found in app/models/concerns/color_support.rb - About 25 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 formatted_submodes_for_transports has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def formatted_submodes_for_transports(modes=nil)
      modes ||= full_transport_modes
      modes.map do |t,s|
        {
          t => s.map do |k|
Severity: Minor
Found in app/models/concerns/transport_mode_enumerations.rb - About 25 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_without_status has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def import_without_status
    prepare_referential

    check_calendar_files_missing_and_create_message || import_resources(:services)

Severity: Minor
Found in app/models/import/gtfs.rb - About 25 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 checksum_replace_nil_or_empty_values has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def checksum_replace_nil_or_empty_values values
    # Replace empty array by nil & nil by VALUE_FOR_NIL_ATTRIBUTE
    values
      .map { |x| x.present? && x || VALUE_FOR_NIL_ATTRIBUTE }
      .map do |item|
Severity: Minor
Found in app/models/concerns/checksum_support.rb - About 25 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 resolve has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def resolve(transport_mode: nil,
      transport_modes: [],
      company: nil,
      companies: [],
      not_transport_mode: nil,
Severity: Minor
Found in app/graphql/queries/lines.rb - About 25 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_vehicle_journeys_in_line has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def import_vehicle_journeys_in_line(line, source_vehicle_journeys)
    source_vehicle_journeys = make_enum source_vehicle_journeys

    source_vehicle_journeys.each do |source_vehicle_journey|
      if source_vehicle_journey[:journey_pattern_id]
Severity: Minor
Found in app/models/import/neptune.rb - About 25 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 checksum_attributes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def checksum_attributes(db_lookup = true)
      [].tap do |attrs|
        attrs << self.int_day_types
        dates = self.dates
        dates += TimeTableDate.where(time_table_id: self.id) if db_lookup && !new_record?
Severity: Minor
Found in app/models/chouette/time_table.rb - About 25 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 export has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def export
    Chouette::Benchmark.measure "export_#{export_type}", export: id do
      referential.switch

      CustomFieldsSupport.within_workgroup(referential.workgroup) do
Severity: Minor
Found in app/models/concerns/local_export_support.rb - About 25 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_referential has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def create_referential
    Chouette::Benchmark.measure 'create_referential' do
      self.referential ||= referential_builder.referential

      main_resource.update referential: referential if main_resource
Severity: Minor
Found in app/models/concerns/local_import_support.rb - About 25 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