MaximilianMeister/nailed

View on GitHub

Showing 30 of 30 total issues

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

  $.getJSON("/json/bugzilla/trend/allopenl3", function (json) {
    new Morris.Line({
      element: 'l3_trend',
      data: json,
      xkey: 'time',
Severity: Major
Found in assets/javascript/nailed/index.js and 1 other location - About 1 day to fix
assets/javascript/nailed/index.js on lines 71..95

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

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

  $.getJSON("/json/bugzilla/trend/allbugs", function (json) {
    new Morris.Line({
      element: 'allbugs_trend',
      data: json,
      xkey: 'time',
Severity: Major
Found in assets/javascript/nailed/index.js and 1 other location - About 1 day to fix
assets/javascript/nailed/index.js on lines 46..70

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

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

function index(colors, product_query, org_query){
  $.getJSON("/json/changes/donut/allchanges", function (json) {
    function set_col() {
      var cols = new Array();
      for ( var x in json) {
Severity: Major
Found in assets/javascript/nailed/index.js - About 4 hrs to fix

    Function bugzilla has 120 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function bugzilla(colors, product, bugzilla_url){
      // BugZilla
      product_ = product.replace(/_/g, " ");
      $.getJSON("/json/bugzilla/" + product + "/trend/open", function (json) {
        new Morris.Line({
    Severity: Major
    Found in assets/javascript/nailed/bugzilla.js - About 4 hrs to fix

      File app.rb has 357 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require "sinatra/base"
      require "sprockets"
      require "haml"
      require "json"
      require "time"
      Severity: Minor
      Found in app.rb - About 4 hrs to fix

        Method get_change_requests has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_change_requests(state: 'open')
              Nailed.logger.info("#{@origin}: #{__method__}")
              Nailed::Config.all_repositories[@origin].each do |repo|
                updated_changerequests = []
                full_repo_name = "#{repo.organization.name}/#{repo.name}"
        Severity: Minor
        Found in lib/nailed/changes.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 get_bugs has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_bugs
              time = Time.now
              @products.each do |product|
                Nailed.logger.info("#{__method__}: Fetching bugs for #{product}")
                components = Nailed::Config.components[product]
        Severity: Minor
        Found in lib/nailed/bugzilla.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

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

                else if (typeof row.p2 !== "undefined")
                  return row.p2;
                else if (typeof row.p3 !== "undefined")
                  return row.p3;
                else if (typeof row.p4 !== "undefined")
        Severity: Major
        Found in assets/javascript/nailed/bugzilla.js and 1 other location - About 2 hrs to fix
        assets/javascript/nailed/bugzilla.js on lines 86..93

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

        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

                if (typeof row.s0 !== "undefined")
                  return row.s0;
                else if (typeof row.s1 !== "undefined")
                  return row.s1;
                else if (typeof row.s2 !== "undefined")
        Severity: Major
        Found in assets/javascript/nailed/bugzilla.js and 1 other location - About 2 hrs to fix
        assets/javascript/nailed/bugzilla.js on lines 52..59

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

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

            def get_trends(action, item)
              call = "#{__method__}-#{action}-#{item})".to_sym
              json = Nailed::Cache.get_cache(call)
        
              return json unless json.nil?
        Severity: Major
        Found in app.rb - About 2 hrs to fix

          Method get_change_requests has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def get_change_requests(state: 'open')
                Nailed.logger.info("#{@origin}: #{__method__}")
                Nailed::Config.all_repositories[@origin].each do |repo|
                  updated_changerequests = []
                  full_repo_name = "#{repo.organization.name}/#{repo.name}"
          Severity: Major
          Found in lib/nailed/changes.rb - About 2 hrs to fix

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

                new Morris.Bar({
                  element: 'bug_status',
                  data: json,
                  xkey: 'bugstatus',
                  ykeys: ['s0', 's1', 's2', 's3'],
            Severity: Major
            Found in assets/javascript/nailed/bugzilla.js and 2 other locations - About 1 hr to fix
            assets/javascript/nailed/bugzilla.js on lines 30..66
            assets/javascript/nailed/bugzilla.js on lines 103..121

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

                new Morris.Bar({
                  element: 'bug_prio',
                  data: json,
                  xkey: 'bugprio',
                  ykeys: ['p0', 'p1', 'p2', 'p3', 'p4', 'p5'],
            Severity: Major
            Found in assets/javascript/nailed/bugzilla.js and 2 other locations - About 1 hr to fix
            assets/javascript/nailed/bugzilla.js on lines 69..100
            assets/javascript/nailed/bugzilla.js on lines 103..121

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

                new Morris.Donut({
                  element: 'top_components',
                  data: json,
                  colors: [ colors["pie"]["red"],
                            colors["pie"]["orange"],
            Severity: Major
            Found in assets/javascript/nailed/bugzilla.js and 2 other locations - About 1 hr to fix
            assets/javascript/nailed/bugzilla.js on lines 30..66
            assets/javascript/nailed/bugzilla.js on lines 69..100

            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

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

                def get_bugs
                  time = Time.now
                  @products.each do |product|
                    Nailed.logger.info("#{__method__}: Fetching bugs for #{product}")
                    components = Nailed::Config.components[product]
            Severity: Minor
            Found in lib/nailed/bugzilla.rb - About 1 hr to fix

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

                  def initialize
                    logname = Nailed::Config.content["logfile"]
                    logfile = nil
                    case logname
                    when "stderr", "STDERR", "", nil
              Severity: Minor
              Found in lib/nailed/logger.rb - About 1 hr to fix

                Method filter has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    def filter(data, datapoints = 40)
                        filtered = Hash.new
                        num = data.length/datapoints
                        data.first.keys.each do |key|
                          filtered[key] = data.each_slice(num.zero? ? num.succ : num)
                Severity: Minor
                Found in app.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 get_jenkins_view_object has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def get_jenkins_view_object(job, parameter)
                
                      call = "#{__method__}-#{job}-#{parameter})".to_sym
                      view_object = Nailed::Cache.get_cache(call, 3600)
                
                
                Severity: Minor
                Found in app.rb - About 1 hr to fix

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

                      def update_parameter_values
                        Nailed::Config.jobs.each do |job|
                          builds = get_builds(job)
                          builds.each do |build|
                            build_number = build["number"]
                  Severity: Minor
                  Found in lib/nailed/jenkins.rb - About 1 hr to fix

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

                        def update_parameters
                          Nailed::Config.jobs.each do |job|
                    
                            # first delete all old parameters
                            db_parameters = Jenkinsparameter.select(:name).where(job: job).map(&:name)
                    Severity: Minor
                    Found in lib/nailed/jenkins.rb - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language