slovensko-digital/harvester.ecosystem

View on GitHub

Showing 12 of 12 total issues

Method perform has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def perform(itms_href, downloader: ItmsJob::Downloader)
    json = downloader.get_json_from_href(itms_href)

    ActiveRecord::Base.transaction do
      p = Itms::Project.find_or_create_by!(itms_id: json['id'])
Severity: Major
Found in app/jobs/itms/sync_project_job.rb - About 2 hrs to fix

    Method perform has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def perform(itms_href, downloader: ItmsJob::Downloader)
        json = downloader.get_json_from_href(itms_href)
    
        ActiveRecord::Base.transaction do
          d = Itms::Discrepancy.find_or_create_by!(itms_id: json['id'])
    Severity: Minor
    Found in app/jobs/itms/sync_discrepancy_job.rb - About 2 hrs to fix

      Method perform has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def perform(itms_href, downloader: ItmsJob::Downloader)
          json = downloader.get_json_from_href(itms_href)
      
          ActiveRecord::Base.transaction do
            p = Itms::Procurement.find_or_create_by!(itms_id: json['id'])
      Severity: Minor
      Found in app/jobs/itms/sync_procurement_job.rb - About 1 hr to fix

        Method find_or_create_intensity_source has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

          def find_or_create_intensity_source(json, current_source, downloader)
            if json.blank?
              current_source.destroy! if current_source.present?
              return
            end
        Severity: Minor
        Found in app/jobs/itms/sync_intensity_job.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 perform has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def perform(itms_href, downloader: ItmsJob::Downloader)
            json = downloader.get_json_from_href(itms_href)
        
            ActiveRecord::Base.transaction do
              ard = Itms::AccountsReceivableDocument.find_or_create_by!(itms_id: json['id'])
        Severity: Minor
        Found in app/jobs/itms/sync_accounts_receivable_document_job.rb - About 1 hr to fix

          Method sync_common_attributes has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def sync_common_attributes(nrfc_application, json, downloader)
              na = nrfc_application
          
              na.itms_href = json['href']
              na.itms_created_at = json['createdAt']
          Severity: Minor
          Found in app/jobs/itms/sync_nrfc_application_job.rb - About 1 hr to fix

            Method parse_project has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def parse_project(p, json)
                p.nazov = get_projects_attribute(json, 'Gen_Profil_nazov')
                p.popis = get_projects_attribute(json, 'Gen_Profil_popis')
                p.datum_zacatia = get_projects_attribute(json, 'EA_Profil_Projekt_datum_zacatia')
                p.termin_ukoncenia = get_projects_attribute(json, 'EA_Profil_Projekt_termin_ukoncenia')
            Severity: Minor
            Found in app/jobs/metais/sync_project_job.rb - About 1 hr to fix

              Method perform has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def perform(itms_href, downloader: ItmsJob::Downloader)
                  json = downloader.get_json_from_href(itms_href)
              
                  ActiveRecord::Base.transaction do
                    apc = Itms::AnnouncedProposalCall.find_or_create_by!(itms_id: json['id'])
              Severity: Minor
              Found in app/jobs/itms/sync_announced_proposal_call_job.rb - About 1 hr to fix

                Method find_or_create_declared_expenses_by_json has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def find_or_create_declared_expenses_by_json(json_list, scope, downloader)
                    return [] if json_list.blank?
                
                    json_list.map do |json|
                      de = scope.find_or_create_by!(itms_id: json['id'])
                Severity: Minor
                Found in app/jobs/itms/sync_payment_claim_job.rb - About 1 hr to fix

                  Method find_or_create_planned_proposal_calls_by_json has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def find_or_create_planned_proposal_calls_by_json(json_list, downloader)
                      return [] if json_list.blank?
                  
                      proposal_calls = json_list.map do |json|
                        next if json['id'] == 0 # workaround for https://itms3.axonpro.sk/browse/ITMSC-11444
                  Severity: Minor
                  Found in app/jobs/itms/sync_announced_proposal_call_job.rb - About 35 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 find_or_create_measurable_indicators_by_json has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def find_or_create_measurable_indicators_by_json(json_list, scope, downloader)
                      return [] if json_list.blank?
                  
                      json_list.map do |json|
                        project_indicator = find_or_create_project_indicator_by_json(json['projektovyUkazovatel'], downloader)
                  Severity: Minor
                  Found in app/jobs/itms_job.rb - About 35 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 perform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def perform(version)
                      ActiveRecord::Base.transaction do
                        previous = version.previous
                        return unless previous
                  
                  
                  Severity: Minor
                  Found in app/jobs/metais/diff_consecutive_versions_job.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