Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HAML inconsistency question #1918

Open
kwerle opened this issue Feb 10, 2025 · 0 comments
Open

HAML inconsistency question #1918

kwerle opened this issue Feb 10, 2025 · 0 comments

Comments

@kwerle
Copy link

kwerle commented Feb 10, 2025

This relates to #1914, #1842

I would like to understand why brakeman is behaving a certain way with JS in HAML so that I better know what we will have to watch for.

The following block of code is no longer in our app:

= javascript_tag do
  :plain
    MY.ActiveDataContext = {
      toContextParam: "#{@active_data_context.to_context_param}"
    }
    Object.defineProperty(MY, 'features', {
      value: Object.freeze({
        toContextParam: "#{@active_data_context.to_context_param}"
        enableAnnotations: #{@active_data_set&.random_method || false},
        enableForms: #{@active_data_set&.forms_enabled? || false},
        enableInventoryFields: #{current_user.username || false},
        enableMixtures: #{@active_data_set&.mixtures_enabled? || false},
        cardinalMixtureType: #{@active_data_set&.cardinal_mixture_type},
        enableDL: #{@active_data_set&.dl_enabled? || false},
        elnWitnessingEnabled: #{@active_data_set&.eln_witnessing_enabled? || false},
        structureEditor: "ketcher",
        isRegistrationSystem: #{!@active_data_set&.registration_system.nil?},
      }),
      writeable: false,
    })

Brakeman 7.0.0 complains about both instances of @active_data_context.to_context_param - rightly - which is what lead to the removal of this code. But all the other lines pass. And they all look equally horrible.

Why are those 2 lines caught and the others not?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant