theforeman/foreman

View on GitHub

Showing 722 of 1,271 total issues

Method define_host_params has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def define_host_params(host)
      host_params = {
        "enable-epel" => "true",
        "package_upgrade" => "true",
        "ansible_tower_provisioning" => "true",
Severity: Minor
Found in app/services/foreman/template_snapshot_service.rb - About 1 hr to fix

    Function schedulerHintFilterSelected has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function schedulerHintFilterSelected(item) {
      const filter = $(item).val();
    
      if (filter === '') {
        $('#scheduler_hint_wrapper').empty();
    Severity: Minor
    Found in webpack/assets/javascripts/compute_resource/openstack.js - About 1 hr to fix

      Function pxeLoaderCompatibilityCheck has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function pxeLoaderCompatibilityCheck() {
        var pxeLoader = $('#host_pxe_loader').val();
        var osTitle = $('#host_operatingsystem_id option:selected').text();
        var compatible = tfm.hosts.checkPXELoaderCompatibility(osTitle, pxeLoader);
        if (compatible === false) {
      Severity: Minor
      Found in app/assets/javascripts/host_edit.js - About 1 hr to fix

        Function override_param has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function override_param(item) {
          var param = $(item)
            .closest('tr')
            .addClass('override-param');
          var n = param.find('[id^=name_]').text();
        Severity: Minor
        Found in app/assets/javascripts/parameter_override.js - About 1 hr to fix

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

            def get_overview(report, options = {})
              options[:origin] = nil if options[:origin] == 'All'
          
              state_labels = {
                active_hosts_ok_enabled: _('Active'),
          Severity: Minor
          Found in app/helpers/dashboard_helper.rb - About 1 hr to fix

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

              def audited_icon(audit)
                style = 'label-info'
                if main_object? audit
                  style = case audit.action
                            when 'create'
            Severity: Minor
            Found in app/helpers/audits_helper.rb - About 1 hr to fix

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

                        def install_packages(packages)
                          return '' if packages.blank?
              
                          banner = <<~CMD
                            echo '#'
              Severity: Minor
              Found in app/services/foreman/renderer/scope/macros/host_template.rb - About 1 hr to fix

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

                    def settings_map
                      {
                        'FOREMAN_REQUIRE_SSL' => [:boolean, :require_ssl],
                        'FOREMAN_SUPPORT_JSONP' => [:boolean, :support_jsonp],
                        'FOREMAN_MARK_TRANSLATED' => [:boolean, :mark_translated],
                Severity: Minor
                Found in app/services/foreman/env_settings_loader.rb - About 1 hr to fix

                  Function update_form has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function update_form(element, options) {
                    options = options || {};
                    var url = $(element).data('url');
                    var data = serializeForm().replace('method=patch', 'method=post');
                    if (options.data) data = data + options.data;
                  Severity: Minor
                  Found in app/assets/javascripts/host_edit.js - 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

                  Function RepositoryModal has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const RepositoryModal = ({
                    repoData,
                    handleRepoData,
                    isLoading,
                    isModalOpen,

                  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

                  Function FiltersForm has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const FiltersForm = ({ roleName, roleId, isNew, data, history }) => {
                    const [role, setRole] = useState(roleId);
                    const [type, setType] = useState(EMPTY_RESOURCE_TYPE);
                    const [chosenPermissions, setChosenPermissions] = useState([]);
                    const [isUnlimited, setIsUnlimited] = useState(!!data['unlimited?']);

                  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

                  Function getAreaChartConfig has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const getAreaChartConfig = ({
                    data,
                    config = 'timeseries',
                    onclick,
                    yAxisLabel,
                  Severity: Minor
                  Found in webpack/assets/javascripts/services/charts/AreaChartService.js - 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

                  Function RegistrationCommandsPage has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const RegistrationCommandsPage = () => {
                    const dispatch = useDispatch();
                  
                    // Context
                    const currentOrganization = useForemanOrganization();

                  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

                  Function render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                    render() {
                      const {
                        data: {
                          name,
                          isSafemodeEnabled,
                  Severity: Minor
                  Found in webpack/assets/javascripts/react_app/components/Editor/Editor.js - 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

                  Function formatArraySelection has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const formatArraySelection = (attr, setting) => {
                    const selectValues = arraySelection(setting);
                  
                    if (!setting[attr] || !selectValues) {
                      return null;

                  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

                  Function Controller has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const Controller = ({
                    addDiskEnabled,
                    addDisk,
                    removeDisk,
                    updateController,

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

                    def queue_tftp_update
                      set_tftp = false
                      # we switched build mode
                      set_tftp = true if old.host.build? != host.build?
                      # medium or arch changed
                  Severity: Minor
                  Found in app/models/concerns/orchestration/tftp.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 export_iterable has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def export_iterable(items, include_blank)
                      if items.is_a?(Hash)
                        items.each { |key, value| items[key] = value.respond_to?(:to_export) ? value.to_export(include_blank) : value }
                        items.to_hash.stringify_keys
                      else
                  Severity: Minor
                  Found in app/models/concerns/exportable.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 resolve has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def resolve(args)
                          includes = [:domains]
                          includes << { taxable_taxonomies: :taxonomy } if args[:location]
                  
                          scope = lambda do |scope|
                  Severity: Minor
                  Found in app/graphql/resolvers/domain/subnets.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 complete_value_from_db has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def complete_value_from_db(field, val)
                        count = 20
                        case field.field
                        when :name
                          results = @registry.filter_map { |set| ((set.full_name =~ /\s/) ? "\"#{set.full_name.gsub('"', '\"')}\"" : set.full_name) if set.name.include?(val) || set.full_name&.include?(val) }
                  Severity: Minor
                  Found in app/registries/setting_registry.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

                  Severity
                  Category
                  Status
                  Source
                  Language