SysMO-DB/seek

View on GitHub

Showing 1,025 of 1,025 total issues

Function addSelected has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

function addSelected(resource_type, source) {
    if (source == "target") {
        for(var key in checkedTargetMap[resource_type]) {
            if (allLinks[resource_type][key] == true) {

Severity: Minor
Found in app/assets/javascripts/link_adder.js - 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 permissions_to_people_group has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

  def permissions_to_people_group permissions, people_in_group
      permissions.each do |permission|
        contributor_id = permission.contributor_id
        access_type = permission.access_type
        case permission.contributor_type
Severity: Minor
Found in app/models/policy.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 do_projects_belong_to_project_manager_projects has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

  def do_projects_belong_to_project_manager_projects
      if (params[:person] and params[:person][:work_group_ids])
        if User.project_manager_logged_in? && !User.admin_logged_in?
          projects = []
          params[:person][:work_group_ids].each do |id|
Severity: Minor
Found in app/controllers/people_controller.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 edit_tag has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

  def edit_tag
    if request.post?
      @tag=TextValue.find(params[:id])
      replacement_tags = []

Severity: Minor
Found in app/controllers/admins_controller.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 clone_versioned_model has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

          def clone_versioned_model(orig_model, new_model, process_file_columns=true)
            self.versioned_attributes.each do |key|
              # Make sure to ignore file columns, white list columns, timestamp columns and any other ignore columns
              unless self.file_columns.include?(key) ||
                     self.white_list_columns.include?(key) ||
Severity: Minor
Found in lib/explicit_versioning.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

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

    for (var i=0, l = regexps.length; i < l; i++) {
      result.title = result.title.replace(regexps[i], highlighters[i]);
      result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
    };
Severity: Major
Found in doc/seek/js/searcher.js and 1 other location - About 3 hrs to fix
doc/seek/js/searcher.js on lines 161..164

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

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

    for (var i=1, l = regexps.length; i < l; i++) {
      result.title = result.title.replace(regexps[i], highlighters[i]);
      result.namespace = result.namespace.replace(regexps[i], highlighters[i]);
    };
Severity: Major
Found in doc/seek/js/searcher.js and 1 other location - About 3 hrs to fix
doc/seek/js/searcher.js on lines 139..142

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

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

Method duesseldorf_bode_mapping has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def duesseldorf_bode_mapping

      concentration_regex = /(\d*,?\.?\d*).*/
      gene_modification_regex = /([\w\d]+)([\/+-]+)/

Severity: Major
Found in lib/seek/parser_mapper.rb - About 3 hrs to fix

    Class Project has 26 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Project < ActiveRecord::Base
    
      include Seek::Rdf::RdfGeneration
      include Seek::Rdf::ReactToAssociatedChange
    
    
    Severity: Minor
    Found in app/models/project.rb - About 3 hrs to fix

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

      function hookEvent(element, eventName, callback)
      {
        if(typeof(element) == "string")
          element = document.getElementById(element);
        if(element == null)
      Severity: Major
      Found in app/assets/javascripts/jws/Resizeable_Textbox/javascript.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/jws/Resizeable_Container/javascript.js on lines 89..101

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

      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

          for(var i = 0; i < cells.size(); i += columns)
          {
          for(var j = 0; j < columns; j += 1)
          {
          text += (cells.eq(i + j).html() + "\t");
      Severity: Major
      Found in app/assets/javascripts/spreadsheet_explorer_plot.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/spreadsheet_explorer.js on lines 636..643

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

      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

          for(var i = 0; i < cells.size(); i += columns)
          {
              for(var j = 0; j < columns; j += 1)
              {
                  text += (cells.eq(i + j).html() + "\t");
      Severity: Major
      Found in app/assets/javascripts/spreadsheet_explorer.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/spreadsheet_explorer_plot.js on lines 56..63

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

      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

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

      function hookEvent(element, eventName, callback)
      {
        if(typeof(element) == "string")
          element = document.getElementById(element);
        if(element == null)
      app/assets/javascripts/jws/Resizeable_Textbox/javascript.js on lines 89..101

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

      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 Position has 73 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function Position(x, y)
      {
        this.X = x;
        this.Y = y;
        
      Severity: Major
      Found in app/assets/javascripts/jws/Resizeable_Textbox/javascript.js - About 2 hrs to fix

        Function Position has 73 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function Position(x, y)
        {
          this.X = x;
          this.Y = y;
          
        Severity: Major
        Found in app/assets/javascripts/jws/Resizeable_Container/javascript.js - About 2 hrs to fix

          Method display_single_entry has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

            def display_single_entry entry
                html=''
                unless entry.blank?
                    #get the link of the entry
                    entry_link = entry.url
          Severity: Minor
          Found in app/helpers/homes_helper.rb - About 2 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 delete_or_cancel_button has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

            def delete_or_cancel_button(run, redirect_to)
              if run.can_delete?
                if run.complete?
                # Delete
                  unless current_user.guest?
          Severity: Minor
          Found in app/helpers/runs_helper.rb - About 2 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 new_version has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

            def new_version
              if handle_upload_data
                comments=params[:revision_comment]
          
                respond_to do |format|
          Severity: Minor
          Found in app/controllers/data_files_controller.rb - About 2 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 update has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

            def update
              if params[:workflow]
                [:contributor_id, :contributor_type, :original_filename, :content_type, :content_blob_id, :created_at, :updated_at, :last_used_at].each do |column_name|
                  params[:workflow].delete(column_name)
                end
          Severity: Minor
          Found in app/controllers/workflows_controller.rb - About 2 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 forgot_password has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

            def forgot_password    
              if request.get?
                # forgot_password.rhtml
              elsif request.post?      
                user = User.find_by_login(params[:login])
          Severity: Minor
          Found in app/controllers/users_controller.rb - About 2 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

          Severity
          Category
          Status
          Source
          Language