unepwcmc/SAPI

View on GitHub

Showing 253 of 368 total issues

Method add_intervals has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def add_intervals
    (@timelines + [self]).flatten.each do |timeline|
      timeline.timeline_events.each_with_index do |event, idx|
        interval =
          if idx < (timeline.timeline_events.size - 1)
Severity: Minor
Found in app/services/checklist/timeline.rb - About 1 hr to fix

    Method relation has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def relation
        types_of_match = ['SELF']
        types_of_match << 'SYNONYM' if @match_synonyms
        types_of_match << 'COMMON_NAME' if @match_common_names
        types_of_match << 'SUBSPECIES' if @match_subspecies

      Function queryResults has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function queryResults () {
          var href, values, params, $link;
          if (queryResults.ajax) {
            getResultsCount(getParamsFromInputs()).then( function (res) {
              if (res.total > res.csv_limit){
      Severity: Minor
      Found in app/assets/javascripts/cites_trade/application.js - About 1 hr to fix

        Method initialize_internal_query has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def initialize_internal_query
            if @report_type == :raw
              # includes would override the select clause
              @query = @query.preload(:reported_taxon_concept)
            end
        Severity: Minor
        Found in app/services/trade/filter.rb - About 1 hr to fix

          Method eu_decision_select_attrs has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def eu_decision_select_attrs
              string = %{
                      eu_decisions.notes,
                      eu_decisions.start_date,
                      v.original_start_date_formatted,
          Severity: Minor
          Found in app/serializers/species/show_taxon_concept_serializer_cites.rb - About 1 hr to fix

            Method summary has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def summary
                res = []
                rank_name = @output.new_rank.try(:name) || @output.taxon_concept.try(:rank).try(:name)
                full_name = @output.display_full_name
                name_status = @output.new_name_status || @output.taxon_concept.try(:name_status)
            Severity: Minor
            Found in app/services/nomenclature_change/output_taxon_concept_processor.rb - About 1 hr to fix

              Method update_species_downloads has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def self.update_species_downloads
                  puts "Updating Species+ downloads"
                  Designation.dict.each do |d|
                    elapsed_time = Benchmark.realtime do
                      Species::ListingsExportFactory.new(:designation => d).export
              Severity: Minor
              Found in lib/modules/downloads_cache.rb - About 1 hr to fix

                Method to_csv has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def self.to_csv(file_path, filters)
                    limit = 1000
                    offset = 0
                    csv_separator_char =
                      case filters[:csv_separator]
                Severity: Minor
                Found in app/models/trade_restriction.rb - About 1 hr to fix

                  Method initialize has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def initialize(params)
                      sanitized_params = {
                        # possible taxonomies are cms and cites_eu
                        taxonomy: whitelist_param(
                          sanitise_symbol(params[:taxonomy]),
                  Severity: Minor
                  Found in app/services/species/search_params.rb - About 1 hr to fix

                    Method download has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def download
                        set_csv_separator
                    
                        @filters = filter_params.merge({
                          :csv_separator => cookies['speciesplus.csv_separator'].try(:to_sym)
                    Severity: Minor
                    Found in app/controllers/species/exports_controller.rb - About 1 hr to fix

                      Method initialize_query has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def initialize_query
                          @taxon_concepts_rel = MTaxonConcept.all.
                            by_cites_eu_taxonomy
                      
                          if @cites_regions.empty? && @countries.empty? && !@cites_appendices.empty?
                      Severity: Minor
                      Found in app/services/checklist/checklist.rb - About 1 hr to fix

                        Method show has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def show
                            builder = NomenclatureChange::Split::Constructor.new(@nomenclature_change)
                            case step
                            when :inputs
                              set_events
                        Severity: Minor
                        Found in app/controllers/admin/nomenclature_changes/split_controller.rb - About 1 hr to fix

                          Method sanitized_shipments_scope has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def sanitized_shipments_scope
                              res = {}
                              sanitized_sandbox_scope.each do |scope_column, scope_def|
                                case scope_column
                                when 'taxon_name', 'rank'
                          Severity: Minor
                          Found in app/models/trade/validation_rule.rb - About 1 hr to fix

                            Method generate_mapping_table_rows has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def generate_mapping_table_rows(rule)
                                formatted_input = input_flattening(rule)
                                formatted_input.delete_if { |_, v| v.empty? }
                                output = rule['output']
                                modifier = output['quantity_modifier'] ? "'#{output['quantity_modifier']}'" : 'NULL'
                            Severity: Minor
                            Found in lib/modules/trade/formatted_codes/base.rb - About 1 hr to fix

                              Method higher_taxa_headers has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                def higher_taxa_headers(prev_item, curr_item)
                                  ranks =
                                    if prev_item.nil?
                                      @header_ranks
                                    else
                              Severity: Minor
                              Found in app/services/checklist/higher_taxa_injector.rb - About 1 hr to fix

                                Method format_values has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  def format_values(key, values)
                                    case key
                                    when 'sources', 'purposes'
                                      values.map do |value|
                                        value = JSON.parse(value['data'])
                                Severity: Minor
                                Found in lib/modules/trade/trade_plus_filters.rb - About 1 hr to fix

                                  Method initialize has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    def initialize(shipments_rel)
                                      @query = shipments_rel.except(:select).select([
                                        'trade_shipments.id', :legacy_shipment_number, :year,
                                        'trade_shipments.taxon_concept_id', 'trade_shipments.appendix',
                                        'm.appendix AS auto_appendix'
                                  Severity: Minor
                                  Found in lib/modules/trade/appendix_report.rb - About 1 hr to fix

                                    Method countries_reported has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      def countries_reported(year)
                                        sql = <<-SQL
                                          SELECT COUNT(*) AS cnt
                                          FROM(
                                            (
                                    Severity: Minor
                                    Found in lib/modules/trade/grouping/compliance.rb - About 1 hr to fix

                                      Method escape_latex has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                        def self.escape_latex(text)
                                          # :stopdoc:
                                          unless @latex_escaper
                                            if defined?(RedCloth::Formatters::LATEX)
                                              class << (@latex_escaper = RedCloth.new(''))
                                      Severity: Minor
                                      Found in lib/modules/latex_to_pdf.rb - About 1 hr to fix

                                        Method columns_with_type has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                          def columns_with_type
                                            super() + [
                                              ['SigTradePhase', 'TEXT'],
                                              ['SigTradeProcessStage', 'TEXT'],
                                              ['SigTradeDocumentNumber', 'TEXT'],
                                        Severity: Minor
                                        Found in lib/tasks/elibrary/citations_rst_importer.rb - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language