diff options
author | gfyoung <gfyoung17@gmail.com> | 2018-07-19 11:43:13 -0700 |
---|---|---|
committer | gfyoung <gfyoung17@gmail.com> | 2018-07-23 11:27:39 -0700 |
commit | dce26700b2be13ca475b6b2cb3dfac4ec1170e6f (patch) | |
tree | d72440df9b681fdc07d7abf06193f66409366943 /app | |
parent | e23b966d8dd2a161d3493c0b991c0c2ce43fea75 (diff) | |
download | gitlab-ce-dce26700b2be13ca475b6b2cb3dfac4ec1170e6f.tar.gz |
Enable frozen string in app/serializers/**/*.rbrepo-forks/gitlab-ce-frozen-string-enable-app-serializers
Partially addresses #47424.
Diffstat (limited to 'app')
99 files changed, 211 insertions, 8 deletions
diff --git a/app/serializers/analytics_build_entity.rb b/app/serializers/analytics_build_entity.rb index bdc22d71202..99663c8d5eb 100644 --- a/app/serializers/analytics_build_entity.rb +++ b/app/serializers/analytics_build_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AnalyticsBuildEntity < Grape::Entity include RequestAwareEntity include EntityDateHelper diff --git a/app/serializers/analytics_build_serializer.rb b/app/serializers/analytics_build_serializer.rb index f172d67d356..9c9f76a1c28 100644 --- a/app/serializers/analytics_build_serializer.rb +++ b/app/serializers/analytics_build_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AnalyticsBuildSerializer < BaseSerializer entity AnalyticsBuildEntity end diff --git a/app/serializers/analytics_commit_entity.rb b/app/serializers/analytics_commit_entity.rb index 402cecbfd08..b25c603c9f0 100644 --- a/app/serializers/analytics_commit_entity.rb +++ b/app/serializers/analytics_commit_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AnalyticsCommitEntity < CommitEntity include EntityDateHelper diff --git a/app/serializers/analytics_commit_serializer.rb b/app/serializers/analytics_commit_serializer.rb index cdbfecf2b70..0f65687a3c0 100644 --- a/app/serializers/analytics_commit_serializer.rb +++ b/app/serializers/analytics_commit_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AnalyticsCommitSerializer < BaseSerializer entity AnalyticsCommitEntity end diff --git a/app/serializers/analytics_generic_serializer.rb b/app/serializers/analytics_generic_serializer.rb index 9f4859e8410..10391c13034 100644 --- a/app/serializers/analytics_generic_serializer.rb +++ b/app/serializers/analytics_generic_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AnalyticsGenericSerializer < BaseSerializer def represent(resource, opts = {}) resource.symbolize_keys! diff --git a/app/serializers/analytics_issue_entity.rb b/app/serializers/analytics_issue_entity.rb index b7d95ea020f..ab15bd0ac7a 100644 --- a/app/serializers/analytics_issue_entity.rb +++ b/app/serializers/analytics_issue_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AnalyticsIssueEntity < Grape::Entity include RequestAwareEntity include EntityDateHelper diff --git a/app/serializers/analytics_issue_serializer.rb b/app/serializers/analytics_issue_serializer.rb index 4fb3e8f1bb4..4a1777276a4 100644 --- a/app/serializers/analytics_issue_serializer.rb +++ b/app/serializers/analytics_issue_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AnalyticsIssueSerializer < AnalyticsGenericSerializer entity AnalyticsIssueEntity end diff --git a/app/serializers/analytics_merge_request_entity.rb b/app/serializers/analytics_merge_request_entity.rb index 888265eaa38..b7134da9461 100644 --- a/app/serializers/analytics_merge_request_entity.rb +++ b/app/serializers/analytics_merge_request_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AnalyticsMergeRequestEntity < AnalyticsIssueEntity expose :state diff --git a/app/serializers/analytics_merge_request_serializer.rb b/app/serializers/analytics_merge_request_serializer.rb index 4622a1dd855..f0b9115d02c 100644 --- a/app/serializers/analytics_merge_request_serializer.rb +++ b/app/serializers/analytics_merge_request_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AnalyticsMergeRequestSerializer < AnalyticsGenericSerializer entity AnalyticsMergeRequestEntity end diff --git a/app/serializers/analytics_stage_entity.rb b/app/serializers/analytics_stage_entity.rb index 3e355a13e06..ae7c20c3bba 100644 --- a/app/serializers/analytics_stage_entity.rb +++ b/app/serializers/analytics_stage_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AnalyticsStageEntity < Grape::Entity include EntityDateHelper diff --git a/app/serializers/analytics_stage_serializer.rb b/app/serializers/analytics_stage_serializer.rb index 613cf6874d8..86786273240 100644 --- a/app/serializers/analytics_stage_serializer.rb +++ b/app/serializers/analytics_stage_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AnalyticsStageSerializer < BaseSerializer entity AnalyticsStageEntity end diff --git a/app/serializers/analytics_summary_entity.rb b/app/serializers/analytics_summary_entity.rb index 9c37afd53e1..39c6b4b06b2 100644 --- a/app/serializers/analytics_summary_entity.rb +++ b/app/serializers/analytics_summary_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AnalyticsSummaryEntity < Grape::Entity expose :value, safe: true expose :title diff --git a/app/serializers/analytics_summary_serializer.rb b/app/serializers/analytics_summary_serializer.rb index c87a24aa47c..b22bd737f03 100644 --- a/app/serializers/analytics_summary_serializer.rb +++ b/app/serializers/analytics_summary_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AnalyticsSummarySerializer < BaseSerializer entity AnalyticsSummaryEntity end diff --git a/app/serializers/award_emoji_entity.rb b/app/serializers/award_emoji_entity.rb index 6e03cd02392..212931a2fa9 100644 --- a/app/serializers/award_emoji_entity.rb +++ b/app/serializers/award_emoji_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AwardEmojiEntity < Grape::Entity expose :name expose :user, using: API::Entities::UserSafe diff --git a/app/serializers/base_serializer.rb b/app/serializers/base_serializer.rb index 8cade280b0c..7b65bd22f54 100644 --- a/app/serializers/base_serializer.rb +++ b/app/serializers/base_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class BaseSerializer attr_reader :params diff --git a/app/serializers/blob_entity.rb b/app/serializers/blob_entity.rb index b501fd5e964..3ac61481dea 100644 --- a/app/serializers/blob_entity.rb +++ b/app/serializers/blob_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class BlobEntity < Grape::Entity include RequestAwareEntity diff --git a/app/serializers/build_action_entity.rb b/app/serializers/build_action_entity.rb index f2d76a8ad81..f9da3f63911 100644 --- a/app/serializers/build_action_entity.rb +++ b/app/serializers/build_action_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class BuildActionEntity < Grape::Entity include RequestAwareEntity diff --git a/app/serializers/build_artifact_entity.rb b/app/serializers/build_artifact_entity.rb index 6e0e33bc09b..414f436e76e 100644 --- a/app/serializers/build_artifact_entity.rb +++ b/app/serializers/build_artifact_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class BuildArtifactEntity < Grape::Entity include RequestAwareEntity diff --git a/app/serializers/build_details_entity.rb b/app/serializers/build_details_entity.rb index 2de9624aed4..b887b99d31c 100644 --- a/app/serializers/build_details_entity.rb +++ b/app/serializers/build_details_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class BuildDetailsEntity < JobEntity expose :coverage, :erased_at, :duration expose :tag_list, as: :tags diff --git a/app/serializers/build_metadata_entity.rb b/app/serializers/build_metadata_entity.rb index f16f3badffa..6242ee8957d 100644 --- a/app/serializers/build_metadata_entity.rb +++ b/app/serializers/build_metadata_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class BuildMetadataEntity < Grape::Entity expose :timeout_human_readable expose :timeout_source do |metadata| diff --git a/app/serializers/build_serializer.rb b/app/serializers/build_serializer.rb index bae9932847f..0649fdad6a8 100644 --- a/app/serializers/build_serializer.rb +++ b/app/serializers/build_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class BuildSerializer < BaseSerializer entity JobEntity diff --git a/app/serializers/cluster_application_entity.rb b/app/serializers/cluster_application_entity.rb index 77fc3336521..2bd17e58086 100644 --- a/app/serializers/cluster_application_entity.rb +++ b/app/serializers/cluster_application_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ClusterApplicationEntity < Grape::Entity expose :name expose :status_name, as: :status diff --git a/app/serializers/cluster_entity.rb b/app/serializers/cluster_entity.rb index 7e5b0997878..c59f68bbc49 100644 --- a/app/serializers/cluster_entity.rb +++ b/app/serializers/cluster_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ClusterEntity < Grape::Entity include RequestAwareEntity diff --git a/app/serializers/cluster_serializer.rb b/app/serializers/cluster_serializer.rb index 2e13c1501e7..4bb4d4880d4 100644 --- a/app/serializers/cluster_serializer.rb +++ b/app/serializers/cluster_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ClusterSerializer < BaseSerializer entity ClusterEntity diff --git a/app/serializers/cohort_activity_month_entity.rb b/app/serializers/cohort_activity_month_entity.rb index e6788a8b596..cdbc89a2dcd 100644 --- a/app/serializers/cohort_activity_month_entity.rb +++ b/app/serializers/cohort_activity_month_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CohortActivityMonthEntity < Grape::Entity include ActionView::Helpers::NumberHelper diff --git a/app/serializers/cohort_entity.rb b/app/serializers/cohort_entity.rb index 7cdba5b0484..3d0213e1038 100644 --- a/app/serializers/cohort_entity.rb +++ b/app/serializers/cohort_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CohortEntity < Grape::Entity include ActionView::Helpers::NumberHelper diff --git a/app/serializers/cohorts_entity.rb b/app/serializers/cohorts_entity.rb index 98f5995ba6f..a84d568bf30 100644 --- a/app/serializers/cohorts_entity.rb +++ b/app/serializers/cohorts_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CohortsEntity < Grape::Entity expose :months_included expose :cohorts, using: CohortEntity diff --git a/app/serializers/cohorts_serializer.rb b/app/serializers/cohorts_serializer.rb index fe9367b13d8..ceca5e1e5a8 100644 --- a/app/serializers/cohorts_serializer.rb +++ b/app/serializers/cohorts_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CohortsSerializer < AnalyticsGenericSerializer entity CohortsEntity end diff --git a/app/serializers/commit_entity.rb b/app/serializers/commit_entity.rb index c8dd98cc04d..b3287c66554 100644 --- a/app/serializers/commit_entity.rb +++ b/app/serializers/commit_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CommitEntity < API::Entities::Commit include RequestAwareEntity diff --git a/app/serializers/concerns/with_pagination.rb b/app/serializers/concerns/with_pagination.rb index 89631b73fcf..c8ffae355e8 100644 --- a/app/serializers/concerns/with_pagination.rb +++ b/app/serializers/concerns/with_pagination.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WithPagination attr_accessor :paginator diff --git a/app/serializers/container_repositories_serializer.rb b/app/serializers/container_repositories_serializer.rb index 56dc70b5687..e1ce3c7b3ae 100644 --- a/app/serializers/container_repositories_serializer.rb +++ b/app/serializers/container_repositories_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ContainerRepositoriesSerializer < BaseSerializer entity ContainerRepositoryEntity end diff --git a/app/serializers/container_repository_entity.rb b/app/serializers/container_repository_entity.rb index 1103cf30a07..59bf35f5aff 100644 --- a/app/serializers/container_repository_entity.rb +++ b/app/serializers/container_repository_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ContainerRepositoryEntity < Grape::Entity include RequestAwareEntity diff --git a/app/serializers/container_tag_entity.rb b/app/serializers/container_tag_entity.rb index 8f1488e6cbb..637294877f8 100644 --- a/app/serializers/container_tag_entity.rb +++ b/app/serializers/container_tag_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ContainerTagEntity < Grape::Entity include RequestAwareEntity diff --git a/app/serializers/container_tags_serializer.rb b/app/serializers/container_tags_serializer.rb index 6ff3adff135..982ce33f6e3 100644 --- a/app/serializers/container_tags_serializer.rb +++ b/app/serializers/container_tags_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ContainerTagsSerializer < BaseSerializer entity ContainerTagEntity diff --git a/app/serializers/deploy_key_entity.rb b/app/serializers/deploy_key_entity.rb index 2678f99510c..54bf030aba1 100644 --- a/app/serializers/deploy_key_entity.rb +++ b/app/serializers/deploy_key_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class DeployKeyEntity < Grape::Entity expose :id expose :user_id diff --git a/app/serializers/deploy_key_serializer.rb b/app/serializers/deploy_key_serializer.rb index 8f849eb88b7..a1cd98b631b 100644 --- a/app/serializers/deploy_key_serializer.rb +++ b/app/serializers/deploy_key_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class DeployKeySerializer < BaseSerializer entity DeployKeyEntity end diff --git a/app/serializers/deploy_keys_project_entity.rb b/app/serializers/deploy_keys_project_entity.rb index 568ef5ab75e..5775ad72d0d 100644 --- a/app/serializers/deploy_keys_project_entity.rb +++ b/app/serializers/deploy_keys_project_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class DeployKeysProjectEntity < Grape::Entity expose :can_push expose :project, using: ProjectEntity diff --git a/app/serializers/deployment_entity.rb b/app/serializers/deployment_entity.rb index 241c689bccd..344148a1fb7 100644 --- a/app/serializers/deployment_entity.rb +++ b/app/serializers/deployment_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class DeploymentEntity < Grape::Entity include RequestAwareEntity diff --git a/app/serializers/deployment_serializer.rb b/app/serializers/deployment_serializer.rb index cba5c3f311f..04db6b88489 100644 --- a/app/serializers/deployment_serializer.rb +++ b/app/serializers/deployment_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class DeploymentSerializer < BaseSerializer entity DeploymentEntity diff --git a/app/serializers/diff_file_entity.rb b/app/serializers/diff_file_entity.rb index 61135fba97b..79844c9210a 100644 --- a/app/serializers/diff_file_entity.rb +++ b/app/serializers/diff_file_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class DiffFileEntity < Grape::Entity include RequestAwareEntity include BlobHelper diff --git a/app/serializers/diffs_entity.rb b/app/serializers/diffs_entity.rb index bb804e5347a..f75ace14d9c 100644 --- a/app/serializers/diffs_entity.rb +++ b/app/serializers/diffs_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class DiffsEntity < Grape::Entity include DiffHelper include RequestAwareEntity diff --git a/app/serializers/diffs_serializer.rb b/app/serializers/diffs_serializer.rb index 6771e10c5ac..9e5eb1699d4 100644 --- a/app/serializers/diffs_serializer.rb +++ b/app/serializers/diffs_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class DiffsSerializer < BaseSerializer entity DiffsEntity end diff --git a/app/serializers/discussion_entity.rb b/app/serializers/discussion_entity.rb index 7505bbdeb3d..6f95e6f9ca1 100644 --- a/app/serializers/discussion_entity.rb +++ b/app/serializers/discussion_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class DiscussionEntity < Grape::Entity include RequestAwareEntity include NotesHelper diff --git a/app/serializers/discussion_serializer.rb b/app/serializers/discussion_serializer.rb index ed5e1224bb2..5be40e74175 100644 --- a/app/serializers/discussion_serializer.rb +++ b/app/serializers/discussion_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class DiscussionSerializer < BaseSerializer entity DiscussionEntity end diff --git a/app/serializers/entity_date_helper.rb b/app/serializers/entity_date_helper.rb index 464217123b4..cc0c2abf863 100644 --- a/app/serializers/entity_date_helper.rb +++ b/app/serializers/entity_date_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module EntityDateHelper include ActionView::Helpers::DateHelper include ActionView::Helpers::TagHelper @@ -50,15 +52,20 @@ module EntityDateHelper elsif entity.due_date is_upcoming = (entity.due_date - Date.today).to_i > 0 time_ago = time_ago_in_words(entity.due_date) - content = time_ago.gsub(/\d+/) { |match| "<strong>#{match}</strong>" } - content.slice!("about ") - content << " " + (is_upcoming ? _("remaining") : _("ago")) - content.html_safe + + # https://gitlab.com/gitlab-org/gitlab-ce/issues/49440 + # + # Need to improve the i18n here and do a full translation + # of the string instead of piecewise translations. + content = time_ago + .gsub(/\d+/) { |match| "<strong>#{match}</strong>" } + .remove("about ") + remaining_or_ago = is_upcoming ? _("remaining") : _("ago") + + "#{content} #{remaining_or_ago}".html_safe elsif entity.start_date && entity.start_date.past? - days = entity.elapsed_days - content = content_tag(:strong, days) - content << " #{'day'.pluralize(days)} elapsed" - content.html_safe + days = entity.elapsed_days + "#{content_tag(:strong, days)} #{'day'.pluralize(days)} elapsed".html_safe end end end diff --git a/app/serializers/entity_request.rb b/app/serializers/entity_request.rb index 456ba1174c0..49e026e8c2a 100644 --- a/app/serializers/entity_request.rb +++ b/app/serializers/entity_request.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class EntityRequest # We use EntityRequest object to collect parameters and variables # from the controller. Because options that are being passed to the entity diff --git a/app/serializers/environment_entity.rb b/app/serializers/environment_entity.rb index 83558fc6659..b18e9706db6 100644 --- a/app/serializers/environment_entity.rb +++ b/app/serializers/environment_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class EnvironmentEntity < Grape::Entity include RequestAwareEntity diff --git a/app/serializers/environment_serializer.rb b/app/serializers/environment_serializer.rb index 84722f33f59..dc1686c30c4 100644 --- a/app/serializers/environment_serializer.rb +++ b/app/serializers/environment_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class EnvironmentSerializer < BaseSerializer include WithPagination diff --git a/app/serializers/group_child_entity.rb b/app/serializers/group_child_entity.rb index ee150eefd9e..f6804fe7f6a 100644 --- a/app/serializers/group_child_entity.rb +++ b/app/serializers/group_child_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class GroupChildEntity < Grape::Entity include ActionView::Helpers::NumberHelper include RequestAwareEntity diff --git a/app/serializers/group_child_serializer.rb b/app/serializers/group_child_serializer.rb index 2baef0a5703..789707c2c9b 100644 --- a/app/serializers/group_child_serializer.rb +++ b/app/serializers/group_child_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class GroupChildSerializer < BaseSerializer include WithPagination diff --git a/app/serializers/group_entity.rb b/app/serializers/group_entity.rb index 6d8466da902..c46c342ee5d 100644 --- a/app/serializers/group_entity.rb +++ b/app/serializers/group_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class GroupEntity < Grape::Entity include ActionView::Helpers::NumberHelper include RequestAwareEntity diff --git a/app/serializers/group_serializer.rb b/app/serializers/group_serializer.rb index 8cf7eb63bcf..38c5757a6c1 100644 --- a/app/serializers/group_serializer.rb +++ b/app/serializers/group_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class GroupSerializer < BaseSerializer include WithPagination diff --git a/app/serializers/group_variable_entity.rb b/app/serializers/group_variable_entity.rb index 62cf0b21e1e..0edab4a3092 100644 --- a/app/serializers/group_variable_entity.rb +++ b/app/serializers/group_variable_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class GroupVariableEntity < Grape::Entity expose :id expose :key diff --git a/app/serializers/group_variable_serializer.rb b/app/serializers/group_variable_serializer.rb index 8f8205924aa..ed20b240cce 100644 --- a/app/serializers/group_variable_serializer.rb +++ b/app/serializers/group_variable_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class GroupVariableSerializer < BaseSerializer entity GroupVariableEntity end diff --git a/app/serializers/issuable_entity.rb b/app/serializers/issuable_entity.rb index 6f31fbd6b7c..e71bd3313fb 100644 --- a/app/serializers/issuable_entity.rb +++ b/app/serializers/issuable_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class IssuableEntity < Grape::Entity include RequestAwareEntity diff --git a/app/serializers/issuable_sidebar_entity.rb b/app/serializers/issuable_sidebar_entity.rb index 29138c803df..773d78d324c 100644 --- a/app/serializers/issuable_sidebar_entity.rb +++ b/app/serializers/issuable_sidebar_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class IssuableSidebarEntity < Grape::Entity include TimeTrackableEntity include RequestAwareEntity diff --git a/app/serializers/issue_entity.rb b/app/serializers/issue_entity.rb index 840fdbcbf14..16a477c92fa 100644 --- a/app/serializers/issue_entity.rb +++ b/app/serializers/issue_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class IssueEntity < IssuableEntity include TimeTrackableEntity diff --git a/app/serializers/issue_serializer.rb b/app/serializers/issue_serializer.rb index 2555595379b..37cf5e28396 100644 --- a/app/serializers/issue_serializer.rb +++ b/app/serializers/issue_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class IssueSerializer < BaseSerializer # This overrided method takes care of which entity should be used # to serialize the `issue` based on `basic` key in `opts` param. diff --git a/app/serializers/issue_sidebar_entity.rb b/app/serializers/issue_sidebar_entity.rb index 6c823dbfe95..349ad9d1fef 100644 --- a/app/serializers/issue_sidebar_entity.rb +++ b/app/serializers/issue_sidebar_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class IssueSidebarEntity < IssuableSidebarEntity expose :assignees, using: API::Entities::UserBasic end diff --git a/app/serializers/job_entity.rb b/app/serializers/job_entity.rb index 960e7291ae6..7bc1d87dea5 100644 --- a/app/serializers/job_entity.rb +++ b/app/serializers/job_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class JobEntity < Grape::Entity include RequestAwareEntity diff --git a/app/serializers/job_group_entity.rb b/app/serializers/job_group_entity.rb index 8554de55517..0941a9d36be 100644 --- a/app/serializers/job_group_entity.rb +++ b/app/serializers/job_group_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class JobGroupEntity < Grape::Entity include RequestAwareEntity diff --git a/app/serializers/label_entity.rb b/app/serializers/label_entity.rb index 4452161051e..98743d62b50 100644 --- a/app/serializers/label_entity.rb +++ b/app/serializers/label_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class LabelEntity < Grape::Entity expose :id, if: ->(label, _) { !label.is_a?(GlobalLabel) } diff --git a/app/serializers/label_serializer.rb b/app/serializers/label_serializer.rb index ad6ba8c46c9..25b9f7de243 100644 --- a/app/serializers/label_serializer.rb +++ b/app/serializers/label_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class LabelSerializer < BaseSerializer entity LabelEntity diff --git a/app/serializers/lfs_file_lock_entity.rb b/app/serializers/lfs_file_lock_entity.rb index 264a77adc3f..7961c4e666b 100644 --- a/app/serializers/lfs_file_lock_entity.rb +++ b/app/serializers/lfs_file_lock_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class LfsFileLockEntity < Grape::Entity root 'locks', 'lock' diff --git a/app/serializers/lfs_file_lock_serializer.rb b/app/serializers/lfs_file_lock_serializer.rb index ba8fb1a461d..0367097e376 100644 --- a/app/serializers/lfs_file_lock_serializer.rb +++ b/app/serializers/lfs_file_lock_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class LfsFileLockSerializer < BaseSerializer entity LfsFileLockEntity end diff --git a/app/serializers/merge_request_basic_entity.rb b/app/serializers/merge_request_basic_entity.rb index 1c06691026d..f7eb74cf392 100644 --- a/app/serializers/merge_request_basic_entity.rb +++ b/app/serializers/merge_request_basic_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class MergeRequestBasicEntity < IssuableSidebarEntity expose :assignee_id expose :merge_status diff --git a/app/serializers/merge_request_basic_serializer.rb b/app/serializers/merge_request_basic_serializer.rb index cc5c664c8fa..a68b48b00db 100644 --- a/app/serializers/merge_request_basic_serializer.rb +++ b/app/serializers/merge_request_basic_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class MergeRequestBasicSerializer < BaseSerializer entity MergeRequestBasicEntity end diff --git a/app/serializers/merge_request_create_entity.rb b/app/serializers/merge_request_create_entity.rb index 11234313293..e7a93004dda 100644 --- a/app/serializers/merge_request_create_entity.rb +++ b/app/serializers/merge_request_create_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class MergeRequestCreateEntity < Grape::Entity expose :iid diff --git a/app/serializers/merge_request_create_serializer.rb b/app/serializers/merge_request_create_serializer.rb index 08daf473319..b6df9ee13fc 100644 --- a/app/serializers/merge_request_create_serializer.rb +++ b/app/serializers/merge_request_create_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class MergeRequestCreateSerializer < BaseSerializer entity MergeRequestCreateEntity end diff --git a/app/serializers/merge_request_diff_entity.rb b/app/serializers/merge_request_diff_entity.rb index 32c761b45ac..433bfe60474 100644 --- a/app/serializers/merge_request_diff_entity.rb +++ b/app/serializers/merge_request_diff_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class MergeRequestDiffEntity < Grape::Entity include Gitlab::Routing include GitHelper diff --git a/app/serializers/merge_request_metrics_entity.rb b/app/serializers/merge_request_metrics_entity.rb index 3548107ac16..1c9db08d103 100644 --- a/app/serializers/merge_request_metrics_entity.rb +++ b/app/serializers/merge_request_metrics_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class MergeRequestMetricsEntity < Grape::Entity expose :latest_closed_at, as: :closed_at expose :merged_at diff --git a/app/serializers/merge_request_serializer.rb b/app/serializers/merge_request_serializer.rb index caf193bdae3..1f8c830e1aa 100644 --- a/app/serializers/merge_request_serializer.rb +++ b/app/serializers/merge_request_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class MergeRequestSerializer < BaseSerializer # This overrided method takes care of which entity should be used # to serialize the `merge_request` based on `serializer` key in `opts` param. diff --git a/app/serializers/merge_request_user_entity.rb b/app/serializers/merge_request_user_entity.rb index 33fc7b724d5..fd2d2897113 100644 --- a/app/serializers/merge_request_user_entity.rb +++ b/app/serializers/merge_request_user_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class MergeRequestUserEntity < UserEntity include RequestAwareEntity include BlobHelper diff --git a/app/serializers/merge_request_widget_entity.rb b/app/serializers/merge_request_widget_entity.rb index a78bd77cf7c..4fe04e4b206 100644 --- a/app/serializers/merge_request_widget_entity.rb +++ b/app/serializers/merge_request_widget_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class MergeRequestWidgetEntity < IssuableEntity expose :state expose :in_progress_merge_commit_sha diff --git a/app/serializers/note_attachment_entity.rb b/app/serializers/note_attachment_entity.rb index 1ad50568ab9..dc801e2bf4e 100644 --- a/app/serializers/note_attachment_entity.rb +++ b/app/serializers/note_attachment_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class NoteAttachmentEntity < Grape::Entity expose :url expose :filename diff --git a/app/serializers/note_entity.rb b/app/serializers/note_entity.rb index 0e1f94a9f61..daa5c24d0f5 100644 --- a/app/serializers/note_entity.rb +++ b/app/serializers/note_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class NoteEntity < API::Entities::Note include RequestAwareEntity include NotesHelper diff --git a/app/serializers/note_user_entity.rb b/app/serializers/note_user_entity.rb index 7289f3a0222..b00dfa7d353 100644 --- a/app/serializers/note_user_entity.rb +++ b/app/serializers/note_user_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class NoteUserEntity < UserEntity unexpose :web_url end diff --git a/app/serializers/pipeline_details_entity.rb b/app/serializers/pipeline_details_entity.rb index 8ba9cac53c4..3b56767f774 100644 --- a/app/serializers/pipeline_details_entity.rb +++ b/app/serializers/pipeline_details_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class PipelineDetailsEntity < PipelineEntity expose :details do expose :ordered_stages, as: :stages, using: StageEntity diff --git a/app/serializers/pipeline_entity.rb b/app/serializers/pipeline_entity.rb index f782b411b84..6cf1925adda 100644 --- a/app/serializers/pipeline_entity.rb +++ b/app/serializers/pipeline_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class PipelineEntity < Grape::Entity include RequestAwareEntity diff --git a/app/serializers/pipeline_serializer.rb b/app/serializers/pipeline_serializer.rb index 17a022539bb..4a33160afa1 100644 --- a/app/serializers/pipeline_serializer.rb +++ b/app/serializers/pipeline_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class PipelineSerializer < BaseSerializer include WithPagination entity PipelineDetailsEntity diff --git a/app/serializers/project_entity.rb b/app/serializers/project_entity.rb index b3e5fd21e97..60c4ba135d6 100644 --- a/app/serializers/project_entity.rb +++ b/app/serializers/project_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ProjectEntity < Grape::Entity include RequestAwareEntity diff --git a/app/serializers/project_mirror_entity.rb b/app/serializers/project_mirror_entity.rb index a9c08ac021a..8aba244cd11 100644 --- a/app/serializers/project_mirror_entity.rb +++ b/app/serializers/project_mirror_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ProjectMirrorEntity < Grape::Entity expose :id diff --git a/app/serializers/project_note_entity.rb b/app/serializers/project_note_entity.rb index e541bfbee8d..d7c4d0aacc6 100644 --- a/app/serializers/project_note_entity.rb +++ b/app/serializers/project_note_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ProjectNoteEntity < NoteEntity expose :human_access do |note| note.project.team.human_max_access(note.author_id) diff --git a/app/serializers/project_note_serializer.rb b/app/serializers/project_note_serializer.rb index 763ad0bdb3f..2182904e815 100644 --- a/app/serializers/project_note_serializer.rb +++ b/app/serializers/project_note_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ProjectNoteSerializer < BaseSerializer entity ProjectNoteEntity end diff --git a/app/serializers/project_serializer.rb b/app/serializers/project_serializer.rb index 74de1e79a8f..23b96c2fc9e 100644 --- a/app/serializers/project_serializer.rb +++ b/app/serializers/project_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ProjectSerializer < BaseSerializer entity ProjectEntity end diff --git a/app/serializers/request_aware_entity.rb b/app/serializers/request_aware_entity.rb index d53fcfb8c1b..1524c1291d8 100644 --- a/app/serializers/request_aware_entity.rb +++ b/app/serializers/request_aware_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RequestAwareEntity extend ActiveSupport::Concern diff --git a/app/serializers/runner_entity.rb b/app/serializers/runner_entity.rb index db26eadab2d..04ec80e0efa 100644 --- a/app/serializers/runner_entity.rb +++ b/app/serializers/runner_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class RunnerEntity < Grape::Entity include RequestAwareEntity diff --git a/app/serializers/stage_entity.rb b/app/serializers/stage_entity.rb index 2516df70ad9..00e6d32ee3a 100644 --- a/app/serializers/stage_entity.rb +++ b/app/serializers/stage_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class StageEntity < Grape::Entity include RequestAwareEntity diff --git a/app/serializers/stage_serializer.rb b/app/serializers/stage_serializer.rb index 091d8e91e43..11fb0d3f852 100644 --- a/app/serializers/stage_serializer.rb +++ b/app/serializers/stage_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class StageSerializer < BaseSerializer include WithPagination diff --git a/app/serializers/status_entity.rb b/app/serializers/status_entity.rb index 47df7f9dcf9..306c30f0323 100644 --- a/app/serializers/status_entity.rb +++ b/app/serializers/status_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class StatusEntity < Grape::Entity include RequestAwareEntity diff --git a/app/serializers/submodule_entity.rb b/app/serializers/submodule_entity.rb index ed1f1ae0ef0..e475a4f301f 100644 --- a/app/serializers/submodule_entity.rb +++ b/app/serializers/submodule_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class SubmoduleEntity < Grape::Entity include RequestAwareEntity diff --git a/app/serializers/time_trackable_entity.rb b/app/serializers/time_trackable_entity.rb index e81cd7bec72..613d19703a4 100644 --- a/app/serializers/time_trackable_entity.rb +++ b/app/serializers/time_trackable_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module TimeTrackableEntity extend ActiveSupport::Concern extend Grape diff --git a/app/serializers/tree_entity.rb b/app/serializers/tree_entity.rb index 9f1b485347f..9b7dc80e1d9 100644 --- a/app/serializers/tree_entity.rb +++ b/app/serializers/tree_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class TreeEntity < Grape::Entity include RequestAwareEntity diff --git a/app/serializers/tree_root_entity.rb b/app/serializers/tree_root_entity.rb index 496f070ddbd..f1cfcd943d8 100644 --- a/app/serializers/tree_root_entity.rb +++ b/app/serializers/tree_root_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # TODO: Inherit from TreeEntity, when `Tree` implements `id` and `name` like `Gitlab::Git::Tree`. class TreeRootEntity < Grape::Entity include RequestAwareEntity diff --git a/app/serializers/tree_serializer.rb b/app/serializers/tree_serializer.rb index 713ade23bc9..536b8ab1ae2 100644 --- a/app/serializers/tree_serializer.rb +++ b/app/serializers/tree_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class TreeSerializer < BaseSerializer entity TreeRootEntity end diff --git a/app/serializers/user_entity.rb b/app/serializers/user_entity.rb index 876512b12dc..6236d66ff4a 100644 --- a/app/serializers/user_entity.rb +++ b/app/serializers/user_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class UserEntity < API::Entities::UserBasic include RequestAwareEntity diff --git a/app/serializers/user_serializer.rb b/app/serializers/user_serializer.rb index 49a71ebac61..2111e1b5667 100644 --- a/app/serializers/user_serializer.rb +++ b/app/serializers/user_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class UserSerializer < BaseSerializer entity UserEntity end diff --git a/app/serializers/variable_entity.rb b/app/serializers/variable_entity.rb index d576745c073..85cf367fe51 100644 --- a/app/serializers/variable_entity.rb +++ b/app/serializers/variable_entity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class VariableEntity < Grape::Entity expose :id expose :key diff --git a/app/serializers/variable_serializer.rb b/app/serializers/variable_serializer.rb index 32ae82ab51c..586666cad8e 100644 --- a/app/serializers/variable_serializer.rb +++ b/app/serializers/variable_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class VariableSerializer < BaseSerializer entity VariableEntity end |