SpeciesFileGroup/taxonworks

View on GitHub

Showing 927 of 12,579 total issues

Method has too many lines. [40/25]
Open

  def to_hash(geometry_collection)
    data = {
      points:   [],
      lines:    [],
      polygons: []

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [40/25]
Open

    def permitted_params(hsh)
      h = self.class::PARAMS.deep_dup
      h.unshift(:per)
      h.unshift(:page)
      h.unshift(:paginate)
Severity: Minor
Found in lib/queries/query/filter.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Consider simplifying this complex logical expression.
Open

        if (name =~ /^[a-zA-Z]*$/) || # !! should reference NOT_LATIN
            (nomenclatural_code == :iczn && name =~ /^[a-zA-Z]-[a-zA-Z]*$/) ||
            (nomenclatural_code == :icnp && name =~ /^[a-zA-Z]-[a-zA-Z]*$/) ||
            (nomenclatural_code == :icn && name =~  /^[a-zA-Z]*-[a-zA-Z]*$/) ||
            (nomenclatural_code == :icn && name =~  /^[a-zA-Z]*\s×\s[a-zA-Z]*$/) ||
Severity: Critical
Found in app/models/protonym/soft_validation_extensions.rb - About 3 hrs to fix

    Method has too many lines. [39/25]
    Open

      def self.used_recently(user_id, project_id, used_on = nil)
        return Sequence.none if used_on.nil?
        t = case used_on
            when 'GeneAttribute'
              GeneAttribute.arel_table
    Severity: Minor
    Found in app/models/sequence.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method has too many lines. [39/25]
    Open

      def create_objects
        return true unless !collection_object_params.nil?
        begin
          metadata.each do |i|
            next unless i['metadata'].blank?
    Severity: Minor
    Found in app/models/sled_image.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method has too many lines. [39/25]
    Open

          def autocomplete
    
            # [ query, order by use if true- don't if nil ]
            queries = [
              [ autocomplete_exact_id, false],
    Severity: Minor
    Found in lib/queries/source/autocomplete.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method gpx_to_csv has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.gpx_to_csv(gpx_file, csv_options = {col_sep: "\t", headers: true, encoding: 'UTF-8', write_headers: true})
        gpx_headers = %w(name geojson start_date end_date minimum_elevation maximum_elevation)
    
        csv_string = CSV.generate(**csv_options) do |csv|
          csv << gpx_headers
    Severity: Minor
    Found in lib/vendor/gpx_to_csv.rb - About 3 hrs 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 hunt_lat_long has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.hunt_lat_long(label, how = ' ')
          if how.nil?
            pieces = [label]
          else
            pieces = label.split(how)
    Severity: Minor
    Found in lib/utilities/geo.rb - About 3 hrs 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 extract_dates has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.extract_dates(trial, match_data)
        end_date_year, end_date_month, end_date_day = 0, 0, 0
        case trial[:method].downcase.to_sym
          when :month_dd_yyyy_2
            start_date_year = 3
    Severity: Minor
    Found in lib/utilities/dates.rb - About 3 hrs 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

    File image_matrix.rb has 302 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class Tools::ImageMatrix
    
      ##### FILTER PARAMETERS #####
    
      # @!observation_matrix_id
    Severity: Minor
    Found in lib/tools/image_matrix.rb - About 3 hrs to fix

      Method has too many lines. [38/25]
      Open

        def using_iccn_class
          unless identifier.nil?
            lccn = identifier
      
            # '200112345', '2010549727', '2003064850', '|a  2003064850', '88156495', '68-004897', '2001-459440'

      This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

      Method has too many lines. [38/25]
      Open

        def set_cached_names_for_taxon_names
          # !! only fire if subject_taxon_name changed
          return true unless subject_taxon_name_id_previously_changed? || destroyed?
      
          TaxonName.transaction do

      This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

      Method has too many lines. [38/25]
      Open

        def sv_fix_objective_synonym_relationship
          fixed = false
          s = self.subject_taxon_name
          o = self.object_taxon_name
          if s.get_primary_type.empty?

      This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

      Method has too many lines. [38/25]
      Open

        def dwc_occurrences_metadata(dwc_occurrences = nil, project_id: nil)
          records = dwc_occurrences
          project_id ||= sessions_current_project_id
      
          # Anticipate multiple sources of records in future (e.g. AssertedDistribution)

      This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

      Method has too many lines. [38/25]
      Open

        def include_multistate_matrix(options = {})
          opt = {target: '', descriptors: []}.merge!(options)
          xml = Builder::XmlMarkup.new(target: opt[:target])
      
          m = opt[:observation_matrix]

      This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

      Method has too many lines. [38/25]
      Open

        def self.generate(otus, project_members, reference_csv = nil)
          ::CSV.generate(col_sep: "\t") do |csv|
      
            csv << %w{taxonID nameID status remarks referenceID modified modifiedBy}
      
      
      Severity: Minor
      Found in lib/export/coldp/files/synonym.rb by rubocop

      This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

      Method has too many lines. [38/25]
      Open

        def add_scopes_to_routes
          scopes = ['scope :tasks']
          scope_index = 0
      
          @paths.each do |path|

      This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

      Method create_quick_verbatim has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.create_quick_verbatim(options  = {})
          # We could refactor this to use nested attributes, but it's not that much cleaner
          opts = {
            'collection_objects' => {},
            'note' => nil,
      Severity: Minor
      Found in lib/material.rb - About 3 hrs 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 initializeGoogleMap has 77 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          initializeGoogleMap: function (map_canvas, fcdata, map_center) {
      
            // does this need to be set?  would it alter fcdata if not set?
            var mapData = fcdata;
            //
      Severity: Major
      Found in app/assets/javascripts/vendor/lib/google/maps/draw.js - About 3 hrs to fix

        Function initializeDrawingManager has 77 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            initializeDrawingManager: function (map, mapDrawingModes) {
              var drawingMode = undefined;      // "active: circle, polygon, circle" results in hand, polygon, circle(selected)
              var drawingModes = [];            // "polygon, circle" results in hand(active), polygon, circle in draw mode menu
              var i;                  // loop counter
              var j = 0;              // offset for start of i-loop when ACTIVE:mode has explicit position
        Severity: Major
        Found in app/assets/javascripts/vendor/lib/google/maps/draw.js - About 3 hrs to fix
          Severity
          Category
          Status
          Source
          Language