the-berta-project/berta

View on GitHub

Showing 12 of 12 total issues

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

    def users
      user_pool = OpenNebula::UserPool.new(client)
      Berta::Utils::OpenNebula::Helper.handle_error { user_pool.info }
      logger.debug "Fetched users: #{user_pool.map(&:id)}"
      user_pool.map { |user| Berta::EntityHandler.new(user) }
Severity: Minor
Found in lib/berta/service.rb and 1 other location - About 25 mins to fix
lib/berta/service.rb on lines 67..71

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

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 groups
      group_pool = OpenNebula::GroupPool.new(client)
      Berta::Utils::OpenNebula::Helper.handle_error { group_pool.info }
      logger.debug "Fetched groups: #{group_pool.map(&:id)}"
      group_pool.map { |group| Berta::EntityHandler.new(group) }
Severity: Minor
Found in lib/berta/service.rb and 1 other location - About 25 mins to fix
lib/berta/service.rb on lines 60..64

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

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

      def filter_groups(vmhs)
        groupi = vmhs.select { |vmh| @groups.include?(vmh.handle['GNAME']) }
        logger.debug "[#{self.class}] filtered based on GROUPs: #{groupi.map { |vmh| vmh.handle.id }}"
        groupi
Severity: Minor
Found in lib/berta/utils/filter.rb and 2 other locations - About 25 mins to fix
lib/berta/utils/filter.rb on lines 58..61
lib/berta/utils/filter.rb on lines 64..67

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

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

      def filter_ids(vmhs)
        idi = vmhs.select { |vmh| @ids.include?(vmh.handle['ID']) }
        logger.debug "[#{self.class}] filtered based on IDs: #{idi.map { |vmh| vmh.handle.id }}"
        idi
Severity: Minor
Found in lib/berta/utils/filter.rb and 2 other locations - About 25 mins to fix
lib/berta/utils/filter.rb on lines 64..67
lib/berta/utils/filter.rb on lines 70..73

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

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

      def filter_users(vmhs)
        useri = vmhs.select { |vmh| @users.include?(vmh.handle['UNAME']) }
        logger.debug "[#{self.class}] filtered based on USERs: #{useri.map { |vmh| vmh.handle.id }}"
        useri
Severity: Minor
Found in lib/berta/utils/filter.rb and 2 other locations - About 25 mins to fix
lib/berta/utils/filter.rb on lines 58..61
lib/berta/utils/filter.rb on lines 70..73

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

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

    def filter_ids!(vmhs)
      deleted, keep = vmhs.partition { |vmh| excluded_id?(vmh) }
      logger.debug "Excluding based on IDs. Excluded IDs            : #{deleted.map { |vmh| vmh.handle.id }}"
      vmhs.replace(keep)
      deleted
Severity: Minor
Found in lib/berta/exclusions.rb and 4 other locations - About 20 mins to fix
lib/berta/exclusions.rb on lines 77..81
lib/berta/exclusions.rb on lines 84..88
lib/berta/exclusions.rb on lines 91..95
lib/berta/exclusions.rb on lines 98..102

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

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

    def filter_users!(vmhs)
      deleted, keep = vmhs.partition { |vmh| excluded_user?(vmh) }
      logger.debug "Excluding based on USERs. Excluded IDs          : #{deleted.map { |vmh| vmh.handle.id }}"
      vmhs.replace(keep)
      deleted
Severity: Minor
Found in lib/berta/exclusions.rb and 4 other locations - About 20 mins to fix
lib/berta/exclusions.rb on lines 70..74
lib/berta/exclusions.rb on lines 84..88
lib/berta/exclusions.rb on lines 91..95
lib/berta/exclusions.rb on lines 98..102

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

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

    def filter_groups!(vmhs)
      deleted, keep = vmhs.partition { |vmh| excluded_group?(vmh) }
      logger.debug "Excluding based on GROUPs. Excluded IDs         : #{deleted.map { |vmh| vmh.handle.id }}"
      vmhs.replace(keep)
      deleted
Severity: Minor
Found in lib/berta/exclusions.rb and 4 other locations - About 20 mins to fix
lib/berta/exclusions.rb on lines 70..74
lib/berta/exclusions.rb on lines 77..81
lib/berta/exclusions.rb on lines 91..95
lib/berta/exclusions.rb on lines 98..102

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

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

    def filter_resources!(vmhs)
      keep, deleted = vmhs.partition { |vmh| takes_resources?(vmh) }
      logger.debug "Excluding based on RESOURCE_STATEs. Excluded IDs: #{deleted.map { |vmh| vmh.handle.id }}"
      vmhs.replace(keep)
      deleted
Severity: Minor
Found in lib/berta/exclusions.rb and 4 other locations - About 20 mins to fix
lib/berta/exclusions.rb on lines 70..74
lib/berta/exclusions.rb on lines 77..81
lib/berta/exclusions.rb on lines 84..88
lib/berta/exclusions.rb on lines 91..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 28.

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 log_filter
        logger.debug "Filter ids     : #{@ids}"
        logger.debug "Filter users   : #{@users}"
        logger.debug "Filter groups  : #{@groups}"
        logger.debug "Filter clusters: #{@clusters.map { |cluster| cluster['NAME'] }}"
Severity: Minor
Found in lib/berta/utils/filter.rb and 1 other location - About 20 mins to fix
lib/berta/exclusions.rb on lines 40..44

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

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 log_exclusions
      logger.debug "Excluded ids     : #{@ids}"
      logger.debug "Excluded users   : #{@users}"
      logger.debug "Excluded groups  : #{@groups}"
      logger.debug "Excluded clusters: #{@clusters.map { |cluster| cluster['NAME'] }}"
Severity: Minor
Found in lib/berta/exclusions.rb and 1 other location - About 20 mins to fix
lib/berta/utils/filter.rb on lines 93..97

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

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

    def filter_clusters!(vmhs)
      deleted, keep = vmhs.partition { |vmh| excluded_cluster?(vmh) }
      logger.debug "Excluding based on CLUSTERs. Excluded IDs       : #{deleted.map { |vmh| vmh.handle.id }}"
      vmhs.replace(keep)
      deleted
Severity: Minor
Found in lib/berta/exclusions.rb and 4 other locations - About 20 mins to fix
lib/berta/exclusions.rb on lines 70..74
lib/berta/exclusions.rb on lines 77..81
lib/berta/exclusions.rb on lines 84..88
lib/berta/exclusions.rb on lines 98..102

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

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