SysMO-DB/seek

View on GitHub

Showing 1,025 of 1,025 total issues

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

  def extract_workflow_metadata
    @t2flow = T2Flow::Parser.new.parse(@workflow.content_blob.data_io_object.read)

    @workflow.title = @t2flow.annotations.titles.last unless @t2flow.annotations.titles.last.blank?
    @workflow.description = @t2flow.annotations.descriptions.last
Severity: Minor
Found in app/controllers/workflows_controller.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 new has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def new
    @assay=Assay.new
    @assay.create_from_asset = params[:create_from_asset]
    study = Study.find(params[:study_id]) if params[:study_id]
    @assay.study = study if params[:study_id] if study.try :can_edit?
Severity: Minor
Found in app/controllers/assays_controller.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 preview_permissions has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def preview_permissions
      policy = sharing_params_to_policy
      current_person = User.current_user.try(:person)
      contributor_person = (params['is_new_file'] == 'false') ?  User.find_by_id(params['contributor_id'].to_i).try(:person) : current_person
      creators = (params["creators"].blank? ? [] : ActiveSupport::JSON.decode(params["creators"])).uniq
Severity: Minor
Found in app/controllers/policies_controller.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 destroy has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def destroy
    object=params[:class].capitalize.constantize.find(params[:id])
    if object && object.is_a?(Sample)
       specimen = object.specimen
       id_column = Seek::Config.is_virtualliver ? 8 : 6
Severity: Minor
Found in app/controllers/biosamples_controller.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 filter_size has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def filter_size size
    max_size=1500
    matches = size.match /([0-9]+)x([0-9]+).*/
    if matches
      width = matches[1].to_i
Severity: Minor
Found in app/controllers/model_images_controller.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 uri_for_object has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def self.uri_for_object(resource_obj, *args)
      options = args.extract_options!
      # defaults:
      options.reverse_merge!(:params => nil,
                             :sub_path => nil)
Severity: Minor
Found in lib/seek/api.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 auth has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def auth
      # Skip certain auth if run is embedded
      if @run.embedded
        if ['cancel','read_interaction','write_interaction'].include?(action_name)
          return true
Severity: Minor
Found in app/controllers/taverna_player/runs_controller.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 add_roles has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def add_roles roles
      new_mask = self.roles_mask || 0
      roles.each do |role_details|
        rolename = role_details[0]
        raise UnknownRoleException.new("Unrecognised role name #{rolename}") unless ROLES.include?(rolename)
Severity: Minor
Found in lib/seek/admin_defined_roles.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

Function updateModels has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function updateModels() {
    model_text='<ul class="related_asset_list">';
    type="Model";
    model_ids=new Array();

Severity: Minor
Found in app/assets/javascripts/assays.js - About 1 hr to fix

    Function updatePublications has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function updatePublications() {
        publication_text='<ul class="related_asset_list">'
        
        for (var i=0;i<publication_array.length;i++) {        
            publication=publication_array[i];
    Severity: Minor
    Found in app/assets/javascripts/publication.js - About 1 hr to fix

      Function updateDataFiles has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function updateDataFiles() {
          data_file_text='<ul class="related_asset_list">'
          
          for (var i=0;i<data_files_assets.length;i++) {        
              data_file=data_files_assets[i];
      Severity: Minor
      Found in app/assets/javascripts/assays.js - About 1 hr to fix

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

              def self.included klass
                klass.class_eval do
                  include Seek::Search::CommonFields
        
                  searchable do
        Severity: Minor
        Found in lib/seek/search/search_sunspot.rb - About 1 hr to fix

          Method populate_assay has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def populate_assay assay_json, filename
          
                investigation_title = assay_json["investigation title"]
                assay_type_title = assay_json["assay type title"]
                study_title = assay_json["study title"]
          Severity: Minor
          Found in lib/seek/data/bio_samples.rb - About 1 hr to fix

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

                          :assay_mapping => {
            
                              :assay_sheet_name => "Tabelle2",
                              :parsing_direction => "vertical",
                              :probing_column => :"creator.last_name",
            Severity: Major
            Found in lib/seek/parser_mapper.rb and 1 other location - About 1 hr to fix
            lib/seek/parser_mapper.rb on lines 608..626

            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 59.

            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

              def create
                @help_document = HelpDocument.find(params[:help_attachment][:help_document_id])
                @help_attachment = HelpAttachment.new(params[:help_attachment])
                if @help_attachment.save
                  @error_text = []
            Severity: Major
            Found in app/controllers/help_attachments_controller.rb and 1 other location - About 1 hr to fix
            app/controllers/help_images_controller.rb on lines 6..19

            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 59.

            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

                      :assay_mapping => {
            
                          :assay_sheet_name => "Tabelle1",
                          :parsing_direction => "vertical",
                          :probing_column => :"creator.last_name",
            Severity: Major
            Found in lib/seek/parser_mapper.rb and 1 other location - About 1 hr to fix
            lib/seek/parser_mapper.rb on lines 513..531

            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 59.

            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

              def create
                @help_document = HelpDocument.find(params[:help_image][:help_document_id])
                @help_image = HelpImage.new(params[:help_image])
                if @help_image.save
                  @error_text = []
            Severity: Major
            Found in app/controllers/help_images_controller.rb and 1 other location - About 1 hr to fix
            app/controllers/help_attachments_controller.rb on lines 11..24

            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 59.

            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

            Function parse has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function parse(nodes, tree, id) {
                    for (var i = 0; i < nodes.length; i++) {
                        if (1 != nodes[i].nodeType) {
                            continue;
                        }
            Severity: Minor
            Found in app/assets/javascripts/dropMenu.js - About 1 hr to fix

              Function updateSops has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function updateSops() {
                  sop_text='<ul class="related_asset_list">';
              
                  sop_ids=new Array();
              
              
              Severity: Minor
              Found in app/assets/javascripts/assays.js - About 1 hr to fix

                Method perform_search has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def perform_search
                    @search_query = params[:search_query]
                    @search=@search_query # used for logging, and logs the origin search query - see ApplicationController#log_event
                    @search_query||=""
                    @search_type = params[:search_type]
                Severity: Minor
                Found in app/controllers/search_controller.rb - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language