Move instance variable assignment from haml back to controllers
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Searching at our codebase with the following RegExp: - @[a-z1-9_]+ = I can find many views defining instance variables in the haml code:
-
190occurrences in./app/views -
32occurrences in./ee/app/views
Variable list grouped by occurence
ag --no-filename -o -- "(- @\w+)" app/views/ ee/app/views/ | sort | uniq -c | sort -gr
83 - @content_class
21 - @hide_top_links
12 - @hide_breadcrumbs
8 - @no_container
6 - @project
6 - @message
6 - @gfm_form
6 - @can_bulk_update
6 - @breadcrumb_link
5 - @registries
5 - @projects
5 - @left_sidebar
4 - @sort
4 - @skip_current_level_breadcrumb
4 - @errors
3 - @user
3 - @no_breadcrumb_container
3 - @body_class
3 - @applications
2 - @url
2 - @transaction
2 - @runner
2 - @release
2 - @query
2 - @push_rule
2 - @plans
2 - @pipeline
2 - @new_commits
2 - @milestones
2 - @metric
2 - @merge_request
2 - @matching_refs
2 - @license
2 - @form
2 - @events
2 - @content_wrapper_class
2 - @application
1 - @users
1 - @user_map
1 - @transactions
1 - @token_names
1 - @themes
1 - @subscriptions
1 - @services
1 - @schedule
1 - @runners
1 - @right_sidebar
1 - @related_branches
1 - @registrations
1 - @project_notifications
1 - @profiles
1 - @pre_auth
1 - @page_versions
1 - @options
1 - @notices
1 - @notes
1 - @no_breadcrumb_border
1 - @lines
1 - @licenses
1 - @joined_projects
1 - @html_class
1 - @groups
1 - @group_runners
1 - @group_notifications
1 - @group_links
1 - @group
1 - @graphs
1 - @gitaly_servers
1 - @file_sample
1 - @emails
1 - @elasticsearch_reindexing_task
1 - @domains
1 - @disks
1 - @discussions
1 - @diff_lines
1 - @deploy_keys
1 - @commit
1 - @cohorts
1 - @builds
1 - @broadcast_messages
1 - @breadcrumbs_extra_links
1 - @breadcrumb_title
1 - @breadcrumb_dropdown_links
1 - @branches
1 - @blame
1 - @authorized_apps
1 - @authorized_anonymous_tokens
In order to run the command above you will need to install https://github.com/ggreer/the_silver_searcher (the ag command).
This is an anti-pattern, and part of the &1645 to move logic away from the view back to controllers/helpers where they should belong.
Edited by 🤖 GitLab Bot 🤖