theforeman/foreman

View on GitHub
app/registries/foreman/access_permissions.rb

Summary

Maintainability
D
2 days
Test Coverage

File access_permissions.rb has 602 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require_dependency 'foreman/access_control'

# Permissions
Foreman::AccessControl.map do |permission_set|
  permission_set.security_block :public do |map|
Severity: Major
Found in app/registries/foreman/access_permissions.rb - About 1 day to fix

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

      permission_set.security_block :locations do |map|
        map.permission :view_locations, {:locations =>  [:index, :show, :auto_complete_search, :welcome],
                                         :"api/v2/locations" => [:index, :show],
        }
        map.permission :create_locations, {:locations => [:new, :create, :clone_taxonomy, :step2, :nest],
    Severity: Major
    Found in app/registries/foreman/access_permissions.rb and 1 other location - About 1 hr to fix
    app/registries/foreman/access_permissions.rb on lines 516..529

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

    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

      permission_set.security_block :organizations do |map|
        map.permission :view_organizations, {:organizations =>  [:index, :show, :auto_complete_search, :welcome],
                                             :"api/v2/organizations" => [:index, :show],
                                           }
        map.permission :create_organizations, {:organizations => [:new, :create, :clone_taxonomy, :step2, :nest],
    Severity: Major
    Found in app/registries/foreman/access_permissions.rb and 1 other location - About 1 hr to fix
    app/registries/foreman/access_permissions.rb on lines 341..354

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

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

      permission_set.security_block :compute_profiles do |map|
        map.permission :view_compute_profiles, { :compute_profiles          => [:index, :show, :auto_complete_search, :welcome],
                                                 :"api/v2/compute_profiles" => [:index, :show] }
        map.permission :create_compute_profiles, { :compute_profiles        => [:new, :create],
                                                 :"api/v2/compute_profiles" => [:create] }
    Severity: Major
    Found in app/registries/foreman/access_permissions.rb and 6 other locations - About 1 hr to fix
    app/registries/foreman/access_permissions.rb on lines 24..37
    app/registries/foreman/access_permissions.rb on lines 162..173
    app/registries/foreman/access_permissions.rb on lines 177..188
    app/registries/foreman/access_permissions.rb on lines 378..389
    app/registries/foreman/access_permissions.rb on lines 532..543
    app/registries/foreman/access_permissions.rb on lines 558..571

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

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

      permission_set.security_block :domains do |map|
        map.permission :view_domains, {:domains => [:index, :show, :auto_complete_search, :welcome],
                                          :"api/v2/domains" => [:index, :show],
        }
        map.permission :create_domains, {:domains => [:new, :create],
    Severity: Major
    Found in app/registries/foreman/access_permissions.rb and 6 other locations - About 1 hr to fix
    app/registries/foreman/access_permissions.rb on lines 24..37
    app/registries/foreman/access_permissions.rb on lines 73..81
    app/registries/foreman/access_permissions.rb on lines 162..173
    app/registries/foreman/access_permissions.rb on lines 378..389
    app/registries/foreman/access_permissions.rb on lines 532..543
    app/registries/foreman/access_permissions.rb on lines 558..571

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

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

      permission_set.security_block :realms do |map|
        map.permission :view_realms, {:realms => [:index, :show, :auto_complete_search, :welcome],
                                          :"api/v2/realms" => [:index, :show],
        }
        map.permission :create_realms, {:realms => [:new, :create],
    Severity: Major
    Found in app/registries/foreman/access_permissions.rb and 6 other locations - About 1 hr to fix
    app/registries/foreman/access_permissions.rb on lines 24..37
    app/registries/foreman/access_permissions.rb on lines 73..81
    app/registries/foreman/access_permissions.rb on lines 177..188
    app/registries/foreman/access_permissions.rb on lines 378..389
    app/registries/foreman/access_permissions.rb on lines 532..543
    app/registries/foreman/access_permissions.rb on lines 558..571

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

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

      permission_set.security_block :architectures do |map|
        map.permission :view_architectures,
          :architectures => [:index, :show, :auto_complete_search, :welcome],
          :"api/v2/architectures" => [:index, :show]
        map.permission :create_architectures,
    Severity: Major
    Found in app/registries/foreman/access_permissions.rb and 6 other locations - About 1 hr to fix
    app/registries/foreman/access_permissions.rb on lines 73..81
    app/registries/foreman/access_permissions.rb on lines 162..173
    app/registries/foreman/access_permissions.rb on lines 177..188
    app/registries/foreman/access_permissions.rb on lines 378..389
    app/registries/foreman/access_permissions.rb on lines 532..543
    app/registries/foreman/access_permissions.rb on lines 558..571

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

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

      permission_set.security_block :users do |map|
        map.permission :view_users,
          :users => [:index, :show, :auto_complete_search, :test_mail],
          :"api/v2/users" => [:index, :show]
        map.permission :create_users,
    Severity: Major
    Found in app/registries/foreman/access_permissions.rb and 6 other locations - About 1 hr to fix
    app/registries/foreman/access_permissions.rb on lines 24..37
    app/registries/foreman/access_permissions.rb on lines 73..81
    app/registries/foreman/access_permissions.rb on lines 162..173
    app/registries/foreman/access_permissions.rb on lines 177..188
    app/registries/foreman/access_permissions.rb on lines 378..389
    app/registries/foreman/access_permissions.rb on lines 532..543

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

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

      permission_set.security_block :usergroups do |map|
        map.permission :view_usergroups, {:usergroups => [:index, :show, :auto_complete_search, :welcome],
                                             :"api/v2/usergroups" => [:index, :show],
        }
        map.permission :create_usergroups, {:usergroups => [:new, :create],
    Severity: Major
    Found in app/registries/foreman/access_permissions.rb and 6 other locations - About 1 hr to fix
    app/registries/foreman/access_permissions.rb on lines 24..37
    app/registries/foreman/access_permissions.rb on lines 73..81
    app/registries/foreman/access_permissions.rb on lines 162..173
    app/registries/foreman/access_permissions.rb on lines 177..188
    app/registries/foreman/access_permissions.rb on lines 378..389
    app/registries/foreman/access_permissions.rb on lines 558..571

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

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

      permission_set.security_block :models do |map|
        map.permission :view_models, {:models => [:index, :show, :auto_complete_search, :welcome],
                                         :"api/v2/models" => [:index, :show],
        }
        map.permission :create_models, {:models => [:new, :create],
    Severity: Major
    Found in app/registries/foreman/access_permissions.rb and 6 other locations - About 1 hr to fix
    app/registries/foreman/access_permissions.rb on lines 24..37
    app/registries/foreman/access_permissions.rb on lines 73..81
    app/registries/foreman/access_permissions.rb on lines 162..173
    app/registries/foreman/access_permissions.rb on lines 177..188
    app/registries/foreman/access_permissions.rb on lines 532..543
    app/registries/foreman/access_permissions.rb on lines 558..571

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

    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

    There are no issues that match your filters.

    Category
    Status