theforeman/foreman

View on GitHub

Showing 722 of 1,271 total issues

Consider simplifying this complex logical expression.
Open

      if os_name == 'Debian' &&
          (facts[:ansible_distribution_major_version][%r{/sid}i] ||
           facts[:ansible_distribution_major_version] == 'n/a')
        debian_os_major_sid
      else
Severity: Major
Found in app/services/foreman_ansible/operating_system_parser.rb - About 40 mins to fix

    Method selectable_f has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def selectable_f(f, attr, array, select_options = {}, html_options = {})
    Severity: Minor
    Found in app/helpers/form_helper.rb - About 35 mins to fix

      Method selectable_f_inline has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def selectable_f_inline(f, attr, array, select_options = {}, html_options = {})
      Severity: Minor
      Found in app/helpers/form_helper.rb - About 35 mins to fix

        Method time_zone_select_f has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def time_zone_select_f(f, attr, default_timezone, select_options = {}, html_options = {})
        Severity: Minor
        Found in app/helpers/form_helper.rb - About 35 mins to fix

          Method form_select_f has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def form_select_f(f, attr, array, select_options = {}, html_options = {})
          Severity: Minor
          Found in app/helpers/form_helper.rb - About 35 mins to fix

            Method checkbox_f has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def checkbox_f(f, attr, options = {}, checked_value = "1", unchecked_value = "0")
            Severity: Minor
            Found in app/helpers/form_helper.rb - About 35 mins to fix

              Method link_to_add_fields has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                def link_to_add_fields(name, f, association, partial = nil, options = {})
              Severity: Minor
              Found in app/helpers/form_helper.rb - About 35 mins to fix

                Method orderable_select_f has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  def orderable_select_f(f, attr, choices, select_options = {}, html_options = {})
                Severity: Minor
                Found in app/helpers/form_helper.rb - About 35 mins to fix

                  Function update_capabilities has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function update_capabilities(capabilities) {
                    capabilities = capabilities.split(' ');
                    $('#image_provisioning').empty();
                    $('#image_selection').appendTo($('#image_provisioning'));
                    update_provisioning_image();
                  Severity: Minor
                  Found in app/assets/javascripts/host_edit.js - About 35 mins 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 CardTemplate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const CardTemplate = ({
                    header,
                    children,
                    expandable,
                    dropdownItems,

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

                  export const CardExpansionContextWrapper = ({ children }) => {
                    const [cardExpandStates, dispatch] = useReducer(cardExpansionReducer, {});
                    // On mount, get values from localStorage and set them in state
                    const initializeCardFromLocalStorage = useCallback(key => {
                      const value = localStorage.getItem(`${key} card expanded`);

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

                  const ConfirmModal = () => {
                    const {
                      id,
                      isOpen,
                      title,
                  Severity: Minor
                  Found in webpack/assets/javascripts/react_app/components/ConfirmModal/index.js - About 35 mins 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 interface_domain_selected has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function interface_domain_selected(element) {
                    // mark the selected value to preserve it for form hiding
                    preserve_selected_options($(element));
                  
                    var domain_id = element.value;
                  Severity: Minor
                  Found in app/assets/javascripts/host_edit.js - About 35 mins 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 EditorModal has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const EditorModal = ({
                    changeDiffViewType,
                    changeEditorValue,
                    diffViewType,
                    editorValue,

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

                  function nic_info(form) {
                    var info = '';
                    var virtual_types = ['Nic::Bond', 'Nic::Bridge'];
                    if (
                      form.find('.virtual').is(':checked') ||
                  Severity: Minor
                  Found in app/assets/javascripts/host_edit_interfaces.js - About 35 mins 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 subnetMaskChanged has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function subnetMaskChanged(field) {
                    var mask = field.val();
                    var cidr_field = $('#subnet_cidr');
                    clearError(field);
                    if (isBlank(mask)) {
                  Severity: Minor
                  Found in app/assets/javascripts/subnets.js - About 35 mins 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 instanceTypeSelected has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export function instanceTypeSelected(item) {
                    const instanceType = $(item).val();
                  
                    if (!item.disabled) {
                      const url = $(item).attr('data-url');
                  Severity: Minor
                  Found in webpack/assets/javascripts/compute_resource/ovirt.js - About 35 mins 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 SettingValueField has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const SettingValueField = ({ setting, form, field }) => {
                    const { selectValues } = setting;
                    const cssClasses = classNames({ 'masked-input': setting.encrypted });
                  
                    let inputField = <FormControl {...field} className={cssClasses} />;

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

                  function fix_template_context(content, context) {
                    // context will be something like this for a brand new form:
                    // project[tasks_attributes][new_1255929127459][assignments_attributes][new_1255929128105]
                    // or for an edit form:
                    // project[tasks_attributes][0][assignments_attributes][1]
                  Severity: Minor
                  Found in app/assets/javascripts/lookup_keys.js - About 35 mins 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 deleteHost has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const deleteHost = (
                    hostName,
                    compute,
                    destroyVmOnHostDelete
                  ) => dispatch => {

                  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