ClusterLabs/hawk

View on GitHub

Showing 2,363 of 2,363 total issues

Assignment Branch Condition size for initialize is too high. [676.6/15]
Open

  def initialize(id, user, pass, use_file = false, stonithwarning = false)
    Rails.logger.debug "Cib.initialize #{id}, #{user}, #{use_file}"

    if use_file
      cib_path = id
Severity: Minor
Found in hawk/app/models/cib.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [545/30]
Open

  def initialize(id, user, pass, use_file = false, stonithwarning = false)
    Rails.logger.debug "Cib.initialize #{id}, #{user}, #{use_file}"

    if use_file
      cib_path = id
Severity: Minor
Found in hawk/app/models/cib.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Class has too many lines. [1008/300]
Open

class Cib
  extend ActiveModel::Naming
  include ActiveModel::Conversion
  include FastGettext::Translation
  include Rails.application.routes.url_helpers # needed for routes
Severity: Minor
Found in hawk/app/models/cib.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method initialize has a Cognitive Complexity of 281 (exceeds 5 allowed). Consider refactoring.
Open

  def initialize(id, user, pass, use_file = false, stonithwarning = false)
    Rails.logger.debug "Cib.initialize #{id}, #{user}, #{use_file}"

    if use_file
      cib_path = id
Severity: Minor
Found in hawk/app/models/cib.rb - About 5 days 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 4 locations. Consider refactoring.
Open

$(function() {
  $('#masters #middle table.masters')
    .bootstrapTable({
      method: 'get',
      url: Routes.cib_masters_path(
Severity: Major
Found in hawk/app/assets/javascripts/module/masters.js and 3 other locations - About 4 days to fix
hawk/app/assets/javascripts/module/clones.js on lines 4..131
hawk/app/assets/javascripts/module/groups.js on lines 4..131
hawk/app/assets/javascripts/module/locations.js on lines 4..131

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

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

$(function() {
  $('#clones #middle table.clones')
    .bootstrapTable({
      method: 'get',
      url: Routes.cib_clones_path(
Severity: Major
Found in hawk/app/assets/javascripts/module/clones.js and 3 other locations - About 4 days to fix
hawk/app/assets/javascripts/module/groups.js on lines 4..131
hawk/app/assets/javascripts/module/locations.js on lines 4..131
hawk/app/assets/javascripts/module/masters.js on lines 4..131

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

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

$(function() {
  $('#locations #middle table.locations')
    .bootstrapTable({
      method: 'get',
      url: Routes.cib_locations_path(
Severity: Major
Found in hawk/app/assets/javascripts/module/locations.js and 3 other locations - About 4 days to fix
hawk/app/assets/javascripts/module/clones.js on lines 4..131
hawk/app/assets/javascripts/module/groups.js on lines 4..131
hawk/app/assets/javascripts/module/masters.js on lines 4..131

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

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

$(function() {
  $('#groups #middle table.groups')
    .bootstrapTable({
      method: 'get',
      url: Routes.cib_groups_path(
Severity: Major
Found in hawk/app/assets/javascripts/module/groups.js and 3 other locations - About 4 days to fix
hawk/app/assets/javascripts/module/clones.js on lines 4..131
hawk/app/assets/javascripts/module/locations.js on lines 4..131
hawk/app/assets/javascripts/module/masters.js on lines 4..131

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

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

  $('#users #middle table.users')
    .bootstrapTable({
      method: 'get',
      url: Routes.cib_users_path(
        $('body').data('cib'),
Severity: Major
Found in hawk/app/assets/javascripts/module/users.js and 3 other locations - About 3 days to fix
hawk/app/assets/javascripts/module/colocations.js on lines 5..122
hawk/app/assets/javascripts/module/orders.js on lines 5..120
hawk/app/assets/javascripts/module/roles.js on lines 5..120

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

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

  $('#roles #middle table.roles')
    .bootstrapTable({
      method: 'get',
      url: Routes.cib_roles_path(
        $('body').data('cib'),
Severity: Major
Found in hawk/app/assets/javascripts/module/roles.js and 3 other locations - About 3 days to fix
hawk/app/assets/javascripts/module/colocations.js on lines 5..122
hawk/app/assets/javascripts/module/orders.js on lines 5..120
hawk/app/assets/javascripts/module/users.js on lines 5..120

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

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

  $('#orders #middle table.orders')
    .bootstrapTable({
      method: 'get',
      url: Routes.cib_orders_path(
        $('body').data('cib'),
Severity: Major
Found in hawk/app/assets/javascripts/module/orders.js and 3 other locations - About 3 days to fix
hawk/app/assets/javascripts/module/colocations.js on lines 5..122
hawk/app/assets/javascripts/module/roles.js on lines 5..120
hawk/app/assets/javascripts/module/users.js on lines 5..120

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

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

  $('#colocations #middle table.colocations')
    .bootstrapTable({
      method: 'get',
      url: Routes.cib_colocations_path(
        $('body').data('cib'),
Severity: Major
Found in hawk/app/assets/javascripts/module/colocations.js and 3 other locations - About 3 days to fix
hawk/app/assets/javascripts/module/orders.js on lines 5..120
hawk/app/assets/javascripts/module/roles.js on lines 5..120
hawk/app/assets/javascripts/module/users.js on lines 5..120

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

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

      }, {
        field: 'operate',
        title: __('Operations'),
        sortable: false,
        clickToSelect: false,
Severity: Major
Found in hawk/app/assets/javascripts/module/alerts.js and 1 other location - About 3 days to fix
hawk/app/assets/javascripts/module/tags.js on lines 42..140

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

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

      }, {
        field: 'operate',
        title: __('Operations'),
        sortable: false,
        clickToSelect: false,
Severity: Major
Found in hawk/app/assets/javascripts/module/tags.js and 1 other location - About 3 days to fix
hawk/app/assets/javascripts/module/alerts.js on lines 33..131

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

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

Module has too many lines. [351/100]
Open

module Util

  # From http://mentalized.net/journal/2011/04/14/ruby_how_to_check_if_a_string_is_numeric/
  def numeric?(n)
    Float(n) != nil rescue false
Severity: Minor
Found in hawk/app/lib/util.rb by rubocop

This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

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

  def initialize(id, user, pass, use_file = false, stonithwarning = false)
    Rails.logger.debug "Cib.initialize #{id}, #{user}, #{use_file}"

    if use_file
      cib_path = id
Severity: Major
Found in hawk/app/models/cib.rb - About 2 days to fix

    File cib.rb has 1042 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'util'
    require 'cibtools'
    require 'string'
    require 'rexml/document' unless defined? REXML::Document
    require 'rexml/xpath' unless defined? REXML::XPath
    Severity: Major
    Found in hawk/app/models/cib.rb - About 2 days to fix

      Module has too many lines. [252/100]
      Open

      module ApplicationHelper
        def branding_config
          @branding_config ||= begin
            config = YAML.load_file(
              Rails.root.join(

      This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

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

              }, {
                field: 'maintenance',
                title: __('Maintenance'),
                sortable: false,
                clickToSelect: false,
      Severity: Major
      Found in hawk/app/assets/javascripts/module/nodes.js and 1 other location - About 2 days to fix
      hawk/app/assets/javascripts/module/nodes.js on lines 157..211

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

      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

              }, {
                field: 'standby',
                title: __('Standby'),
                sortable: false,
                clickToSelect: false,
      Severity: Major
      Found in hawk/app/assets/javascripts/module/nodes.js and 1 other location - About 2 days to fix
      hawk/app/assets/javascripts/module/nodes.js on lines 102..157

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

      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