qomoteam/qomo

View on GitHub

Showing 97 of 97 total issues

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

  def filemeta(abs_path)
    if File.directory?(abs_path)
      kind = :directory
    else
      extname = File.extname(abs_path)
Severity: Minor
Found in app/services/datastore.rb - About 1 hr to fix

    Function init has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        init: function(options) {
          return this.each(function() {
            this.self = $(this);
    
            methods.destroy.call(this.self);
    Severity: Minor
    Found in app/assets/javascripts/jquery.raty.js - About 1 hr to fix

      Function exclusion has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            exclusion: function(element, options) {
              var lower, message, option, ref, upper;
              message = this.presence(element, options);
              if (message) {
                if (options.allow_blank === true) {
      Severity: Minor
      Found in app/assets/javascripts/rails.validations.js - About 1 hr to fix

        Method read has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def read(path, offset, len)
            File.open(path) do |file|
              offset ||= 0
              len ||= 10.kilobytes
              content = ''
        Severity: Minor
        Found in app/services/reader/text_reader.rb - About 1 hr to fix

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

            def show
              unless params[:uid] or current_user
                redirect_to new_user_session_path
                return
              end
          Severity: Minor
          Found in app/controllers/datastore_controller.rb - About 1 hr to fix

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

                            if self.article['url'].endswith('.pdf'):
                                self.article['url_pdf'] = self.article['url']
            Severity: Major
            Found in scripts/scholar.py and 2 other locations - About 1 hr to fix
            scripts/scholar.py on lines 410..411
            scripts/scholar.py on lines 573..574

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

            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 3 locations. Consider refactoring.
            Open

                            if self.article['url'].endswith('.pdf'):
                                self.article['url_pdf'] = self.article['url']
            Severity: Major
            Found in scripts/scholar.py and 2 other locations - About 1 hr to fix
            scripts/scholar.py on lines 520..521
            scripts/scholar.py on lines 573..574

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

            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 show has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              def show
                if params[:user_id]
                  user = User.find_by_username params[:user_id]
                  not_found unless user
                  @tool = Tool.find_by_owner_id_and_slug user.id, params['id']
            Severity: Minor
            Found in app/controllers/tools_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 filemeta has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              def filemeta(abs_path)
                if File.directory?(abs_path)
                  kind = :directory
                else
                  extname = File.extname(abs_path)
            Severity: Minor
            Found in app/services/datastore.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

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

                                if self.article['url'].endswith('.pdf'):
                                    self.article['url_pdf'] = self.article['url']
            Severity: Major
            Found in scripts/scholar.py and 2 other locations - About 1 hr to fix
            scripts/scholar.py on lines 410..411
            scripts/scholar.py on lines 520..521

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

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

              def filetree
                dir = params[:dir]
                if !dir.blank?
                  username = dir.split(':')[0][1..-1]
                  path = dir.split(':')[1..-1].join('/')
            Severity: Minor
            Found in app/controllers/library_controller.rb - About 1 hr to fix

              Function length has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    length: function(element, options) {
                      var CHECKS, blankOptions, check, fn, message, operator, tokenized_length, tokenizer;
                      tokenizer = options.js_tokenizer || "split('')";
                      tokenized_length = new Function('element', "return (element.val()." + tokenizer + " || '').length")(element);
                      CHECKS = {
              Severity: Minor
              Found in app/assets/javascripts/rails.validations.js - About 1 hr to fix

                Function uniqueness has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      uniqueness: function(element, options) {
                        var form, matches, name, name_prefix, name_suffix, valid, value;
                        name = element.attr('name');
                        if (/_attributes\]\[\d/.test(name)) {
                          matches = name.match(/^(.+_attributes\])\[\d+\](.+)$/);
                Severity: Minor
                Found in app/assets/javascripts/rails.validations.js - About 1 hr to fix

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

                    def self.find(ids) # can accept an array of ids or a single id or a string of ids separated by commas
                      param = ids.class == Array ? ids.join(",") : ids
                  
                      uri = URI.parse("https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=pubmed&id=#{param}")
                      response = Net::HTTP.get_response(uri)
                  Severity: Minor
                  Found in app/services/pubmed_api.rb - About 1 hr to fix

                    Function get_url has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def get_url(self):
                            if self.words is None and self.words_some is None \
                               and self.words_none is None and self.phrase is None \
                               and self.author is None and self.pub is None \
                               and self.timeframe[0] is None and self.timeframe[1] is None:
                    Severity: Minor
                    Found in scripts/scholar.py - About 55 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 empty_params has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def empty_params
                        ep = []
                        self.boxes.values.each do |box|
                          @tool = Tool.find box['tool_id']
                          np = @tool.params
                    Severity: Minor
                    Found in app/models/pipeline.rb - About 45 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 asset_download has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def asset_download
                        if params[:release_id]
                          release = Release.find params[:release_id]
                          not_found unless release
                          tool = release.tool
                    Severity: Minor
                    Found in app/controllers/tools_controller.rb - About 45 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

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

                                        self.article['year'] = year[0] if len(year) > 0 else None
                    Severity: Minor
                    Found in scripts/scholar.py and 1 other location - About 45 mins to fix
                    scripts/scholar.py on lines 525..525

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

                    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 search
                        @categories = Category.roots
                        q = params[:q]
                        tool = Tool.find_by_accession_label q
                    
                    
                    Severity: Minor
                    Found in app/controllers/tools_controller.rb and 1 other location - About 45 mins to fix
                    app/controllers/pipelines_controller.rb on lines 25..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 40.

                    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 search
                        @categories = Category.roots
                        q = params[:q]
                        pipeline = Pipeline.find_by_accession_label q
                        return redirect_to user_pipeline_path(pipeline.owner.username, pipeline.slug) if pipeline&.shared
                    Severity: Minor
                    Found in app/controllers/pipelines_controller.rb and 1 other location - About 45 mins to fix
                    app/controllers/tools_controller.rb on lines 25..34

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

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language