sanger/sequencescape

View on GitHub

Showing 5,448 of 5,450 total issues

Complex method Endpoints::Searches::SearchActions#singular_search_action (34.6)
Open

    def singular_search_action(name) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
      bind_action(:create, to: name.to_s, as: name.to_sym) do |_action, request, response|
        record = request.target.scope(request.json['search']).send(name.to_sym)
        raise ActiveRecord::RecordNotFound, 'no resources found with that search criteria' if record.nil?

Severity: Minor
Found in app/api/endpoints/searches.rb by flog

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Complex method BatchesController#swap (34.5)
Open

  def swap # rubocop:todo Metrics/AbcSize
    if @batch.swap(
         current_user,
         'batch_1' => {
           'id' => params['batch']['1'],
Severity: Minor
Found in app/controllers/batches_controller.rb by flog

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Complex method Accession::Submission#to_xml (34.5)
Open

    def to_xml # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
      xml = Builder::XmlMarkup.new
      xml.instruct!
      xml.SUBMISSION(
        XML_NAMESPACE,
Severity: Minor
Found in lib/accession/accession/submission.rb by flog

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Complex method CsvParserClient::get_tube_rack_scan_results (34.3)
Open

  def self.get_tube_rack_scan_results(tube_rack_barcode, object_to_add_errors_to) # rubocop:todo Metrics/AbcSize
    endpoint = configatron.tube_rack_scans_microservice_url
    response = Net::HTTP.get_response(URI(endpoint + tube_rack_barcode))

    if response.body.nil?
Severity: Minor
Found in lib/csv_parser_client.rb by flog

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Method included has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def self.included(base) # rubocop:todo Metrics/MethodLength
      base.class_eval do
        def mx_library
          asset.external_identifier || 'UNKNOWN'
        end
Severity: Minor
Found in app/models/api/messages/flowcell_io.rb - About 1 hr to fix

    Complex method SubmissionsHelper#submission_status_message (34.1)
    Open

      def submission_status_message(submission) # rubocop:todo Metrics/CyclomaticComplexity
        case submission.state
        when 'building'
          display_user_guide(
            'This submission is still open for editing, further orders can still be added...',
    Severity: Minor
    Found in app/helpers/submissions_helper.rb by flog

    Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

    You can read more about ABC metrics or the flog tool

    Complex method Request::ChangeDecision#perform_decision_change_request_state! (34.1)
    Open

      def perform_decision_change_request_state! # rubocop:todo Metrics/AbcSize
        previous_state = request.state
        ActiveRecord::Base.transaction do
          # Really this toggle of states isn't ideal, as effectively it means
          # multiple requests in quick succession could toggle the state, which probably
    Severity: Minor
    Found in app/models/request/change_decision.rb by flog

    Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

    You can read more about ABC metrics or the flog tool

    Complex method HomesController#show (34.0)
    Open

      def show # rubocop:todo Metrics/AbcSize
        @links = configatron.fetch(:external_applications, [])
        @pipelines = current_user.pipelines.active
        @latest_batches = current_user.batches.latest_first.limit(10).includes(:pipeline)
        @assigned_batches = current_user.batches.latest_first.where('assignee_id != user_id').limit(10).includes(:pipeline)
    Severity: Minor
    Found in app/controllers/homes_controller.rb by flog

    Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

    You can read more about ABC metrics or the flog tool

    Complex method BatchesController#index (33.8)
    Open

      def index # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
        if logged_in?
          @user = params.fetch(:user, current_user)
          @batches = Batch.for_user(@user).order(id: :desc).includes(:user, :assignee, :pipeline).page(params[:page])
        else
    Severity: Minor
    Found in app/controllers/batches_controller.rb by flog

    Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

    You can read more about ABC metrics or the flog tool

    Function exports has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function (api) {
      var validEnv = ["development", "test", "production"];
      var currentEnv = api.env();
      var isDevelopmentEnv = api.env("development");
      var isProductionEnv = api.env("production");
    Severity: Minor
    Found in babel.config.js - About 1 hr to fix

      Complex method Order#duplicates_within (33.5)
      Open

        def duplicates_within(timespan) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
          matching_orders =
            Order
              .containing_samples(all_samples)
              .where(template_name: template_name)
      Severity: Minor
      Found in app/models/order.rb by flog

      Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

      You can read more about ABC metrics or the flog tool

      Complex method QcReportsController#create (33.5)
      Open

        def create # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
          study = Study.find_by(id: params[:qc_report][:study_id])
          exclude_existing = params[:qc_report][:exclude_existing] == '1'
          qc_report =
            QcReport.new(

      Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

      You can read more about ABC metrics or the flog tool

      Complex method LibPoolNormTubeGenerator#create! (33.5)
      Open

        def create! # rubocop:todo Metrics/AbcSize
          if valid?
            begin
              ActiveRecord::Base.transaction do
                lib_pool_tubes.each do |tube|

      Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

      You can read more about ABC metrics or the flog tool

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          const wrapper = shallowMount(BaseRadio, {
            propsData: {
              options: [
                { label: "Option a", value: "a" },
                { label: "Option b", value: "b" },
      Severity: Major
      Found in app/frontend/shared/components/BaseRadio.test.js and 1 other location - About 1 hr to fix
      app/frontend/shared/components/BaseRadio.test.js on lines 36..46

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 64.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          const wrapper = shallowMount(BaseRadio, {
            propsData: {
              options: [
                { label: "Option a", value: "a" },
                { label: "Option b", value: "b" },
      Severity: Major
      Found in app/frontend/shared/components/BaseRadio.test.js and 1 other location - About 1 hr to fix
      app/frontend/shared/components/BaseRadio.test.js on lines 22..32

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 64.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Complex method Studies::AssetGroupsController#create (33.4)
      Open

        def create # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
          @study = Study.find(params[:study_id])
          @asset_group = AssetGroup.new(params[:asset_group])
          @asset_group.study = @study
      
      

      Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

      You can read more about ABC metrics or the flog tool

      Complex method BatchesController#create (33.3)
      Open

        def create # rubocop:todo Metrics/AbcSize
          @pipeline = Pipeline.find(params[:id])
      
          requests = @pipeline.extract_requests_from_input_params(request_parameters)
      
      
      Severity: Minor
      Found in app/controllers/batches_controller.rb by flog

      Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

      You can read more about ABC metrics or the flog tool

      Method included has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.included(base) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
          base.class_eval do
            ## State machine
            ## namespace: true as destroyed clashes with rails, but we can't easily rename the state
            aasm column: :state, whiny_persistence: true, namespace: true, name: 'qc_state' do
      Severity: Minor
      Found in app/models/qcable/statemachine.rb - About 1 hr to fix

        Method build_association has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def build_association(as_class, options) # rubocop:todo Metrics/MethodLength
            # First we build the association into the current ActiveRecord::Base class
            as_name = as_class.name.demodulize.underscore
            association_name = "#{as_name}_metadata".underscore.to_sym
            class_name = "#{name}::Metadata"
        Severity: Minor
        Found in app/models/metadata.rb - About 1 hr to fix

          Complex method ModelExtensions::Order#request_options_structured= (33.1)
          Open

            def request_options_structured=(values) # rubocop:todo Metrics/AbcSize
              @request_options_structured =
                NonNilHash
                  .new
                  .tap do |attributes|
          Severity: Minor
          Found in app/api/model_extensions/order.rb by flog

          Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

          You can read more about ABC metrics or the flog tool

          Severity
          Category
          Status
          Source
          Language