Merge pull request #10386 from colinux/frozen-strings

Tech(perf): frozen string literals partout
This commit is contained in:
Colin Darie 2024-08-22 07:51:39 +00:00 committed by GitHub
commit bd4c31684d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2266 changed files with 4724 additions and 46 deletions

View file

@ -11,7 +11,7 @@ inherit_mode:
- Include
AllCops:
TargetRubyVersion: 3.2
TargetRubyVersion: 3.3
DisabledByDefault: true
SuggestExtensions: false
NewCops: enable
@ -23,6 +23,8 @@ AllCops:
- "bin/*"
- "node_modules/**/*"
- "vendor/**/*"
- "storage/**/*"
- "tmp/**/*"
DS/AddConcurrentIndex:
Enabled: true
@ -1175,7 +1177,7 @@ Style/FormatStringToken:
EnforcedStyle: template
Style/FrozenStringLiteralComment:
Enabled: false
Enabled: true
Style/GlobalVars:
Enabled: true

View file

@ -18,9 +18,11 @@ SimpleCov.start "rails" do
add_filter "/channels/" # not used
groups.delete("Channels")
add_filter "/lib/tasks/deployment/"
add_group "Components", "app/components"
add_group "API", ["app/graphql", "app/serializers"]
add_group "Manager", ["app/dashboards", "app/fields"]
add_group "Manager", ["app/dashboards", "app/fields", "app/controllers/manager"]
add_group "Models", ["app/models", "app/validators"]
add_group "Policies", "app/policies"
add_group "Services", "app/services"

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
source 'https://rubygems.org'
gem 'rails', '~> 7.0.8' # allows update to security fixes at any time

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
# A sample Guardfile
# More info at https://github.com/guard/guard#readme

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class ApplicationComponent < ViewComponent::Base
include ViewComponent::Translatable
include FlipperHelper

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Display a widget for uploading, editing and deleting a file attachment
class Attachment::EditComponent < ApplicationComponent
attr_reader :champ

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
# Display a widget for uploading, editing and deleting a file attachment
class Attachment::MultipleComponent < ApplicationComponent
DEFAULT_MAX_ATTACHMENTS = 10

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Attachment::PendingPollComponent < ApplicationComponent
attr_reader :attachments

View file

@ -1,2 +1,4 @@
# frozen_string_literal: true
class Attachment::ProgressBarComponent < ApplicationComponent
end

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Attachment::ProgressComponent < ApplicationComponent
attr_reader :attachment
attr_reader :ignore_antivirus

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Attachment::ShowComponent < ApplicationComponent
def initialize(attachment:, new_tab: false, truncate: false)
@attachment = attachment

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Conditions::ChampsConditionsComponent < Conditions::ConditionsComponent
def initialize(tdc:, upper_tdcs:, procedure_id:)
@tdc, @condition, @source_tdcs = tdc, tdc.condition, upper_tdcs

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Conditions::ConditionsComponent < ApplicationComponent
include Logic

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Conditions::ConditionsErrorsComponent < ApplicationComponent
def initialize(conditions:, source_tdcs:)
@conditions, @source_tdcs = conditions, source_tdcs

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Conditions::IneligibiliteRulesComponent < Conditions::ConditionsComponent
include Logic

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Conditions::RoutingRulesComponent < Conditions::ConditionsComponent
include Logic

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dossiers::AccuseLectureComponent < ApplicationComponent
def initialize(dossier:)
@dossier = dossier

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dossiers::AutosaveFooterComponent < ApplicationComponent
include ApplicationHelper
attr_reader :dossier

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dossiers::BatchAlertComponent < ApplicationComponent
attr_reader :batch

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dossiers::BatchOperationComponent < ApplicationComponent
attr_reader :statut, :procedure

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dossiers::BatchOperationInlineButtonsComponent < ApplicationComponent
attr_reader :opt, :icons, :form

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dossiers::BatchSelectMoreComponent < ApplicationComponent
def initialize(dossiers_count:, filtered_sorted_ids:)
@dossiers_count = dossiers_count

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dossiers::ChampsRowsShowComponent < ApplicationComponent
attr_reader :profile
attr_reader :seen_at

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dossiers::DeletedDossiersComponent < ApplicationComponent
include DossierHelper

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dossiers::EditFooterComponent < ApplicationComponent
delegate :can_passer_en_construction?, to: :@dossier

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dossiers::ExportDropdownComponent < ApplicationComponent
include ApplicationHelper

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dossiers::ExportLinkComponent < ApplicationComponent
include ApplicationHelper
include TabsHelper

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dossiers::GeoAreaComponent < ApplicationComponent
attr_reader :geo_area, :editing

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dossiers::GeoAreasComponent < ApplicationComponent
attr_reader :champ, :editing

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dossiers::IndividualFormComponent < ApplicationComponent
delegate :for_tiers?, to: :@dossier

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dossiers::InvalidIneligibiliteRulesComponent < ApplicationComponent
delegate :can_passer_en_construction?, to: :@dossier

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dossiers::MessageComponent < ApplicationComponent
def initialize(commentaire:, connected_user:, messagerie_seen_at: nil, show_reply_button: false, groupe_gestionnaire: nil)
@commentaire = commentaire

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dossiers::NotifiedToggleComponent < ApplicationComponent
def initialize(procedure:, procedure_presentation:)
@procedure = procedure

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dossiers::RowShowComponent < ApplicationComponent
attr_reader :label
attr_reader :profile

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dossiers::UserFilterComponent < ApplicationComponent
include DossierHelper

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dossiers::UserProcedureFilterComponent < ApplicationComponent
include DossierHelper

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dropdown::MenuComponent < ApplicationComponent
renders_one :button_inner_html
renders_one :menu_header_html

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
# see: https://www.systeme-de-design.gouv.fr/elements-d-interface/composants/alerte
class Dsfr::AlertComponent < ApplicationComponent
renders_one :body

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
# see: https://www.systeme-de-design.gouv.fr/elements-d-interface/composants/mise-en-avant
class Dsfr::CalloutComponent < ApplicationComponent
renders_one :body

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dsfr::CardVerticalComponent < ApplicationComponent
renders_many :footer_buttons

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dsfr::ComboboxComponent < ApplicationComponent
def initialize(form: nil, options: nil, url: nil, selected: nil, allows_custom_value: false, limit: nil, input_html_options: {}, hidden_html_options: {})
@form, @options, @url, @selected, @allows_custom_value, @limit, @input_html_options, @hidden_html_options = form, options, url, selected, allows_custom_value, limit, input_html_options, hidden_html_options

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dsfr::CopyButtonComponent < ApplicationComponent
def initialize(text:, title:, success: nil)
@text = text

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dsfr::DownloadComponent < ApplicationComponent
attr_reader :attachment
attr_reader :html_class

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dsfr::InputComponent < ApplicationComponent
include Dsfr::InputErrorable

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Dsfr
module InputErrorable
extend ActiveSupport::Concern

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Dsfr
class InputStatusMessageComponent < ApplicationComponent
def initialize(errors_on_attribute:, error_full_messages:, describedby_id:, champ:)

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dsfr::ListComponent < ApplicationComponent
renders_many :items
renders_one :empty

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
# see: https://www.systeme-de-design.gouv.fr/elements-d-interface/composants/bandeau-d-information-importante/
class Dsfr::NoticeComponent < ApplicationComponent
renders_one :title

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dsfr::RadioButtonListComponent < ApplicationComponent
attr_reader :error

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dsfr::SidemenuComponent < ApplicationComponent
renders_many :links, "LinkComponent"

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Dsfr::ToggleComponent < ApplicationComponent
def initialize(form:, target:, title:, disabled: nil, hint: nil, toggle_labels: { checked: 'Activé', unchecked: 'Désactivé' }, opt: nil, extra_class_names: nil)
@form = form

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::AddressComponent < EditableChamp::EditableChampBaseComponent
def dsfr_input_classname
'fr-select'

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::AnnuaireEducationComponent < EditableChamp::EditableChampBaseComponent
def dsfr_input_classname
'fr-select'

View file

@ -1,2 +1,4 @@
# frozen_string_literal: true
class EditableChamp::AsteriskMandatoryComponent < ApplicationComponent
end

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::CarteComponent < EditableChamp::EditableChampBaseComponent
include ApplicationHelper
def dsfr_champ_container

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::ChampLabelComponent < ApplicationComponent
include Dsfr::InputErrorable

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::ChampLabelContentComponent < ApplicationComponent
include ApplicationHelper
include Dsfr::InputErrorable

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::CheckboxComponent < EditableChamp::EditableChampBaseComponent
def dsfr_input_classname
'fr-checkbox'

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::CiviliteComponent < EditableChamp::EditableChampBaseComponent
def dsfr_champ_container
:fieldset

View file

@ -1,2 +1,4 @@
# frozen_string_literal: true
class EditableChamp::CnafComponent < EditableChamp::EditableChampBaseComponent
end

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::COJOComponent < EditableChamp::EditableChampBaseComponent
def input_group_class
if @champ.accreditation_success?

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::CommunesComponent < EditableChamp::EditableChampBaseComponent
include ApplicationHelper

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::DateComponent < EditableChamp::EditableChampBaseComponent
def dsfr_input_classname
'fr-input'

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::DatetimeComponent < EditableChamp::EditableChampBaseComponent
def dsfr_input_classname
'fr-input'

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::DecimalNumberComponent < EditableChamp::EditableChampBaseComponent
def dsfr_input_classname
'fr-input'

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::DepartementsComponent < EditableChamp::EditableChampBaseComponent
include ApplicationHelper

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::DgfipComponent < EditableChamp::EditableChampBaseComponent
def dsfr_input_classname
'fr-input'

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::DossierLinkComponent < EditableChamp::EditableChampBaseComponent
def dsfr_input_classname
'fr-input'

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::DropDownListComponent < EditableChamp::EditableChampBaseComponent
def render?
@champ.options?

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::DropDownOtherInputComponent < EditableChamp::EditableChampBaseComponent
def render?
@champ.other?

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::EditableChampBaseComponent < ApplicationComponent
include Dsfr::InputErrorable

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::EditableChampComponent < ApplicationComponent
def initialize(form:, champ:, seen_at: nil)
@form, @champ, @seen_at = form, champ, seen_at

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::EmailComponent < EditableChamp::EditableChampBaseComponent
def dsfr_input_classname
'fr-input'

View file

@ -1,2 +1,4 @@
# frozen_string_literal: true
class EditableChamp::EngagementJuridiqueComponent < EditableChamp::EditableChampBaseComponent
end

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::EpciComponent < EditableChamp::EditableChampBaseComponent
include ApplicationHelper

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::EtablissementTitreComponent < ApplicationComponent
include EtablissementHelper

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::ExplicationComponent < EditableChamp::EditableChampBaseComponent
delegate :type_de_champ, to: :@champ
delegate :notice_explicative, to: :type_de_champ

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::ExpressionReguliereComponent < EditableChamp::EditableChampBaseComponent
def dsfr_input_classname
'fr-input'

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::HeaderSectionComponent < ApplicationComponent
def initialize(form: nil, champ:, seen_at: nil, html_class: {})
@champ = champ

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::IbanComponent < EditableChamp::EditableChampBaseComponent
def dsfr_input_classname
'fr-input'

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::IntegerNumberComponent < EditableChamp::EditableChampBaseComponent
def dsfr_input_classname
'fr-input'

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::LinkedDropDownListComponent < EditableChamp::EditableChampBaseComponent
def dsfr_champ_container
:fieldset

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::MesriComponent < EditableChamp::EditableChampBaseComponent
def dsfr_input_classname
'fr-input'

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::MultipleDropDownListComponent < EditableChamp::EditableChampBaseComponent
include ApplicationHelper

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::NumberComponent < EditableChamp::EditableChampBaseComponent
def dsfr_input_classname
'fr-input'

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::PaysComponent < EditableChamp::EditableChampBaseComponent
include ApplicationHelper

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::PhoneComponent < EditableChamp::EditableChampBaseComponent
def dsfr_input_classname
'fr-input'

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::PieceJustificativeComponent < EditableChamp::EditableChampBaseComponent
def dsfr_input_classname
'fr-input'

View file

@ -1,2 +1,4 @@
# frozen_string_literal: true
class EditableChamp::PoleEmploiComponent < EditableChamp::EditableChampBaseComponent
end

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::RegionsComponent < EditableChamp::EditableChampBaseComponent
include ApplicationHelper

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::RepetitionComponent < EditableChamp::EditableChampBaseComponent
def legend_params
@champ.description.present? ? { describedby: dom_id(@champ, :repetition) } : {}

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::RepetitionRowComponent < ApplicationComponent
def initialize(form:, dossier:, type_de_champ:, row_id:, row_number:, seen_at: nil)
@form, @dossier, @type_de_champ, @row_id, @row_number, @seen_at = form, dossier, type_de_champ, row_id, row_number, seen_at

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::RNAComponent < EditableChamp::EditableChampBaseComponent
def dsfr_input_classname
'fr-input'

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::RNFComponent < EditableChamp::EditableChampBaseComponent
def dsfr_input_classname
'fr-input'

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::SectionComponent < ApplicationComponent
include ApplicationHelper
include TreeableConcern

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::SiretComponent < EditableChamp::EditableChampBaseComponent
def dsfr_input_classname
'fr-input'

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::TextComponent < EditableChamp::EditableChampBaseComponent
def dsfr_input_classname
'fr-input'

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::TextareaComponent < EditableChamp::EditableChampBaseComponent
include HtmlToStringHelper
def dsfr_input_classname

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EditableChamp::TitreIdentiteComponent < EditableChamp::EditableChampBaseComponent
def dsfr_input_classname
'fr-input'

Some files were not shown because too many files have changed in this diff Show more