Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
32af384a
Commit
32af384a
authored
Aug 09, 2018
by
gfyoung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable frozen string in rest of app/models/**/*.rb
Partially addresses #47424.
parent
ce2f1ec8
Changes
56
Hide whitespace changes
Inline
Side-by-side
Showing
56 changed files
with
127 additions
and
14 deletions
+127
-14
app/models/programming_language.rb
app/models/programming_language.rb
+2
-0
app/models/project_services/asana_service.rb
app/models/project_services/asana_service.rb
+2
-0
app/models/project_services/assembla_service.rb
app/models/project_services/assembla_service.rb
+2
-0
app/models/project_services/bamboo_service.rb
app/models/project_services/bamboo_service.rb
+2
-0
app/models/project_services/bugzilla_service.rb
app/models/project_services/bugzilla_service.rb
+2
-0
app/models/project_services/buildkite_service.rb
app/models/project_services/buildkite_service.rb
+2
-0
app/models/project_services/builds_email_service.rb
app/models/project_services/builds_email_service.rb
+2
-0
app/models/project_services/campfire_service.rb
app/models/project_services/campfire_service.rb
+4
-2
app/models/project_services/chat_message/base_message.rb
app/models/project_services/chat_message/base_message.rb
+2
-0
app/models/project_services/chat_message/issue_message.rb
app/models/project_services/chat_message/issue_message.rb
+2
-0
app/models/project_services/chat_message/merge_message.rb
app/models/project_services/chat_message/merge_message.rb
+2
-0
app/models/project_services/chat_message/note_message.rb
app/models/project_services/chat_message/note_message.rb
+2
-0
app/models/project_services/chat_message/pipeline_message.rb
app/models/project_services/chat_message/pipeline_message.rb
+2
-0
app/models/project_services/chat_message/push_message.rb
app/models/project_services/chat_message/push_message.rb
+2
-0
app/models/project_services/chat_message/wiki_page_message.rb
...models/project_services/chat_message/wiki_page_message.rb
+2
-0
app/models/project_services/chat_notification_service.rb
app/models/project_services/chat_notification_service.rb
+2
-0
app/models/project_services/ci_service.rb
app/models/project_services/ci_service.rb
+2
-0
app/models/project_services/custom_issue_tracker_service.rb
app/models/project_services/custom_issue_tracker_service.rb
+2
-0
app/models/project_services/deployment_service.rb
app/models/project_services/deployment_service.rb
+2
-0
app/models/project_services/drone_ci_service.rb
app/models/project_services/drone_ci_service.rb
+2
-0
app/models/project_services/emails_on_push_service.rb
app/models/project_services/emails_on_push_service.rb
+2
-0
app/models/project_services/external_wiki_service.rb
app/models/project_services/external_wiki_service.rb
+2
-0
app/models/project_services/flowdock_service.rb
app/models/project_services/flowdock_service.rb
+2
-0
app/models/project_services/gemnasium_service.rb
app/models/project_services/gemnasium_service.rb
+2
-0
app/models/project_services/gitlab_issue_tracker_service.rb
app/models/project_services/gitlab_issue_tracker_service.rb
+2
-0
app/models/project_services/hangouts_chat_service.rb
app/models/project_services/hangouts_chat_service.rb
+2
-0
app/models/project_services/hipchat_service.rb
app/models/project_services/hipchat_service.rb
+11
-11
app/models/project_services/irker_service.rb
app/models/project_services/irker_service.rb
+2
-0
app/models/project_services/issue_tracker_service.rb
app/models/project_services/issue_tracker_service.rb
+2
-0
app/models/project_services/jira_service.rb
app/models/project_services/jira_service.rb
+2
-0
app/models/project_services/kubernetes_service.rb
app/models/project_services/kubernetes_service.rb
+2
-0
app/models/project_services/mattermost_service.rb
app/models/project_services/mattermost_service.rb
+2
-0
app/models/project_services/mattermost_slash_commands_service.rb
...els/project_services/mattermost_slash_commands_service.rb
+2
-0
app/models/project_services/microsoft_teams_service.rb
app/models/project_services/microsoft_teams_service.rb
+2
-0
app/models/project_services/mock_ci_service.rb
app/models/project_services/mock_ci_service.rb
+2
-0
app/models/project_services/mock_deployment_service.rb
app/models/project_services/mock_deployment_service.rb
+2
-0
app/models/project_services/mock_monitoring_service.rb
app/models/project_services/mock_monitoring_service.rb
+2
-0
app/models/project_services/monitoring_service.rb
app/models/project_services/monitoring_service.rb
+2
-0
app/models/project_services/packagist_service.rb
app/models/project_services/packagist_service.rb
+2
-0
app/models/project_services/pipelines_email_service.rb
app/models/project_services/pipelines_email_service.rb
+2
-0
app/models/project_services/pivotaltracker_service.rb
app/models/project_services/pivotaltracker_service.rb
+2
-0
app/models/project_services/prometheus_service.rb
app/models/project_services/prometheus_service.rb
+2
-0
app/models/project_services/pushover_service.rb
app/models/project_services/pushover_service.rb
+3
-1
app/models/project_services/redmine_service.rb
app/models/project_services/redmine_service.rb
+2
-0
app/models/project_services/slack_service.rb
app/models/project_services/slack_service.rb
+2
-0
app/models/project_services/slack_slash_commands_service.rb
app/models/project_services/slack_slash_commands_service.rb
+2
-0
app/models/project_services/slash_commands_service.rb
app/models/project_services/slash_commands_service.rb
+2
-0
app/models/project_services/teamcity_service.rb
app/models/project_services/teamcity_service.rb
+2
-0
app/models/protected_branch/merge_access_level.rb
app/models/protected_branch/merge_access_level.rb
+2
-0
app/models/protected_branch/push_access_level.rb
app/models/protected_branch/push_access_level.rb
+2
-0
app/models/protected_tag/create_access_level.rb
app/models/protected_tag/create_access_level.rb
+2
-0
app/models/repository_language.rb
app/models/repository_language.rb
+2
-0
app/models/site_statistic.rb
app/models/site_statistic.rb
+2
-0
app/models/storage/hashed_project.rb
app/models/storage/hashed_project.rb
+2
-0
app/models/storage/legacy_project.rb
app/models/storage/legacy_project.rb
+2
-0
changelogs/unreleased/frozen-string-enable-app-models-even-more-still.yml
...eased/frozen-string-enable-app-models-even-more-still.yml
+5
-0
No files found.
app/models/programming_language.rb
View file @
32af384a
# frozen_string_literal: true
class
ProgrammingLanguage
<
ActiveRecord
::
Base
validates
:name
,
presence:
true
validates
:color
,
allow_blank:
false
,
color:
true
...
...
app/models/project_services/asana_service.rb
View file @
32af384a
# frozen_string_literal: true
require
'asana'
class
AsanaService
<
Service
...
...
app/models/project_services/assembla_service.rb
View file @
32af384a
# frozen_string_literal: true
class
AssemblaService
<
Service
prop_accessor
:token
,
:subdomain
validates
:token
,
presence:
true
,
if: :activated?
...
...
app/models/project_services/bamboo_service.rb
View file @
32af384a
# frozen_string_literal: true
class
BambooService
<
CiService
include
ReactiveService
...
...
app/models/project_services/bugzilla_service.rb
View file @
32af384a
# frozen_string_literal: true
class
BugzillaService
<
IssueTrackerService
validates
:project_url
,
:issues_url
,
:new_issue_url
,
presence:
true
,
public_url:
true
,
if: :activated?
...
...
app/models/project_services/buildkite_service.rb
View file @
32af384a
# frozen_string_literal: true
require
"addressable/uri"
class
BuildkiteService
<
CiService
...
...
app/models/project_services/builds_email_service.rb
View file @
32af384a
# frozen_string_literal: true
# This class is to be removed with 9.1
# We should also by then remove BuildsEmailService from database
class
BuildsEmailService
<
Service
...
...
app/models/project_services/campfire_service.rb
View file @
32af384a
# frozen_string_literal: true
class
CampfireService
<
Service
prop_accessor
:token
,
:subdomain
,
:room
validates
:token
,
presence:
true
,
if: :activated?
...
...
@@ -82,7 +84,7 @@ class CampfireService < Service
before
=
push
[
:before
]
after
=
push
[
:after
]
message
=
""
message
=
[]
message
<<
"[
#{
project
.
full_name
}
] "
message
<<
"
#{
push
[
:user_name
]
}
"
...
...
@@ -95,6 +97,6 @@ class CampfireService < Service
message
<<
"
#{
project
.
web_url
}
/compare/
#{
before
}
...
#{
after
}
"
end
message
message
.
join
end
end
app/models/project_services/chat_message/base_message.rb
View file @
32af384a
# frozen_string_literal: true
require
'slack-notifier'
module
ChatMessage
...
...
app/models/project_services/chat_message/issue_message.rb
View file @
32af384a
# frozen_string_literal: true
module
ChatMessage
class
IssueMessage
<
BaseMessage
attr_reader
:title
...
...
app/models/project_services/chat_message/merge_message.rb
View file @
32af384a
# frozen_string_literal: true
module
ChatMessage
class
MergeMessage
<
BaseMessage
attr_reader
:merge_request_iid
...
...
app/models/project_services/chat_message/note_message.rb
View file @
32af384a
# frozen_string_literal: true
module
ChatMessage
class
NoteMessage
<
BaseMessage
attr_reader
:note
...
...
app/models/project_services/chat_message/pipeline_message.rb
View file @
32af384a
# frozen_string_literal: true
module
ChatMessage
class
PipelineMessage
<
BaseMessage
attr_reader
:ref_type
...
...
app/models/project_services/chat_message/push_message.rb
View file @
32af384a
# frozen_string_literal: true
module
ChatMessage
class
PushMessage
<
BaseMessage
attr_reader
:after
...
...
app/models/project_services/chat_message/wiki_page_message.rb
View file @
32af384a
# frozen_string_literal: true
module
ChatMessage
class
WikiPageMessage
<
BaseMessage
attr_reader
:title
...
...
app/models/project_services/chat_notification_service.rb
View file @
32af384a
# frozen_string_literal: true
# Base class for Chat notifications services
# This class is not meant to be used directly, but only to inherit from.
class
ChatNotificationService
<
Service
...
...
app/models/project_services/ci_service.rb
View file @
32af384a
# frozen_string_literal: true
# Base class for CI services
# List methods you need to implement to get your CI service
# working with GitLab Merge Requests
...
...
app/models/project_services/custom_issue_tracker_service.rb
View file @
32af384a
# frozen_string_literal: true
class
CustomIssueTrackerService
<
IssueTrackerService
validates
:project_url
,
:issues_url
,
:new_issue_url
,
presence:
true
,
public_url:
true
,
if: :activated?
...
...
app/models/project_services/deployment_service.rb
View file @
32af384a
# frozen_string_literal: true
# Base class for deployment services
#
# These services integrate with a deployment solution like Kubernetes/OpenShift,
...
...
app/models/project_services/drone_ci_service.rb
View file @
32af384a
# frozen_string_literal: true
class
DroneCiService
<
CiService
include
ReactiveService
...
...
app/models/project_services/emails_on_push_service.rb
View file @
32af384a
# frozen_string_literal: true
class
EmailsOnPushService
<
Service
boolean_accessor
:send_from_committer_email
boolean_accessor
:disable_diffs
...
...
app/models/project_services/external_wiki_service.rb
View file @
32af384a
# frozen_string_literal: true
class
ExternalWikiService
<
Service
prop_accessor
:external_wiki_url
...
...
app/models/project_services/flowdock_service.rb
View file @
32af384a
# frozen_string_literal: true
require
"flowdock-git-hook"
# Flow dock depends on Grit to compute the number of commits between two given
...
...
app/models/project_services/gemnasium_service.rb
View file @
32af384a
# frozen_string_literal: true
require
"gemnasium/gitlab_service"
class
GemnasiumService
<
Service
...
...
app/models/project_services/gitlab_issue_tracker_service.rb
View file @
32af384a
# frozen_string_literal: true
class
GitlabIssueTrackerService
<
IssueTrackerService
include
Gitlab
::
Routing
...
...
app/models/project_services/hangouts_chat_service.rb
View file @
32af384a
# frozen_string_literal: true
require
'hangouts_chat'
class
HangoutsChatService
<
ChatNotificationService
...
...
app/models/project_services/hipchat_service.rb
View file @
32af384a
# frozen_string_literal: true
class
HipchatService
<
Service
include
ActionView
::
Helpers
::
SanitizeHelper
...
...
@@ -108,7 +110,7 @@ class HipchatService < Service
before
=
push
[
:before
]
after
=
push
[
:after
]
message
=
""
message
=
[]
message
<<
"
#{
push
[
:user_name
]
}
"
if
Gitlab
::
Git
.
blank_ref?
(
before
)
...
...
@@ -132,7 +134,7 @@ class HipchatService < Service
end
end
message
message
.
join
end
def
markdown
(
text
,
options
=
{})
...
...
@@ -165,11 +167,11 @@ class HipchatService < Service
description
=
obj_attr
[
:description
]
issue_link
=
"<a href=
\"
#{
issue_url
}
\"
>issue #
#{
issue_iid
}
</a>"
message
=
"
#{
user_name
}
#{
state
}
#{
issue_link
}
in
#{
project_link
}
: <b>
#{
title
}
</b>"
message
=
[
"
#{
user_name
}
#{
state
}
#{
issue_link
}
in
#{
project_link
}
: <b>
#{
title
}
</b>"
]
message
<<
"<pre>
#{
markdown
(
description
)
}
</pre>"
message
message
.
join
end
def
create_merge_request_message
(
data
)
...
...
@@ -184,12 +186,11 @@ class HipchatService < Service
merge_request_url
=
"
#{
project_url
}
/merge_requests/
#{
merge_request_id
}
"
merge_request_link
=
"<a href=
\"
#{
merge_request_url
}
\"
>merge request !
#{
merge_request_id
}
</a>"
message
=
"
#{
user_name
}
#{
state
}
#{
merge_request_link
}
in "
\
"
#{
project_link
}
: <b>
#{
title
}
</b>"
message
=
[
"
#{
user_name
}
#{
state
}
#{
merge_request_link
}
in "
\
"
#{
project_link
}
: <b>
#{
title
}
</b>"
]
message
<<
"<pre>
#{
markdown
(
description
)
}
</pre>"
message
message
.
join
end
def
format_title
(
title
)
...
...
@@ -235,12 +236,11 @@ class HipchatService < Service
end
subject_html
=
"<a href=
\"
#{
note_url
}
\"
>
#{
subject_type
}
#{
subject_desc
}
</a>"
message
=
"
#{
user_name
}
commented on
#{
subject_html
}
in
#{
project_link
}
: "
message
=
[
"
#{
user_name
}
commented on
#{
subject_html
}
in
#{
project_link
}
: "
]
message
<<
title
message
<<
"<pre>
#{
markdown
(
note
,
ref:
commit_id
)
}
</pre>"
message
message
.
join
end
def
create_pipeline_message
(
data
)
...
...
app/models/project_services/irker_service.rb
View file @
32af384a
# frozen_string_literal: true
require
'uri'
class
IrkerService
<
Service
...
...
app/models/project_services/issue_tracker_service.rb
View file @
32af384a
# frozen_string_literal: true
class
IssueTrackerService
<
Service
validate
:one_issue_tracker
,
if: :activated?
,
on: :manual_change
...
...
app/models/project_services/jira_service.rb
View file @
32af384a
# frozen_string_literal: true
class
JiraService
<
IssueTrackerService
include
Gitlab
::
Routing
include
ApplicationHelper
...
...
app/models/project_services/kubernetes_service.rb
View file @
32af384a
# frozen_string_literal: true
##
# NOTE:
# We'll move this class to Clusters::Platforms::Kubernetes, which contains exactly the same logic.
...
...
app/models/project_services/mattermost_service.rb
View file @
32af384a
# frozen_string_literal: true
class
MattermostService
<
ChatNotificationService
def
title
'Mattermost notifications'
...
...
app/models/project_services/mattermost_slash_commands_service.rb
View file @
32af384a
# frozen_string_literal: true
class
MattermostSlashCommandsService
<
SlashCommandsService
include
TriggersHelper
...
...
app/models/project_services/microsoft_teams_service.rb
View file @
32af384a
# frozen_string_literal: true
class
MicrosoftTeamsService
<
ChatNotificationService
def
title
'Microsoft Teams Notification'
...
...
app/models/project_services/mock_ci_service.rb
View file @
32af384a
# frozen_string_literal: true
# For an example companion mocking service, see https://gitlab.com/gitlab-org/gitlab-mock-ci-service
class
MockCiService
<
CiService
ALLOWED_STATES
=
%w[failed canceled running pending success success_with_warnings skipped not_found]
.
freeze
...
...
app/models/project_services/mock_deployment_service.rb
View file @
32af384a
# frozen_string_literal: true
class
MockDeploymentService
<
DeploymentService
def
title
'Mock deployment'
...
...
app/models/project_services/mock_monitoring_service.rb
View file @
32af384a
# frozen_string_literal: true
class
MockMonitoringService
<
MonitoringService
def
title
'Mock monitoring'
...
...
app/models/project_services/monitoring_service.rb
View file @
32af384a
# frozen_string_literal: true
# Base class for monitoring services
#
# These services integrate with a deployment solution like Prometheus
...
...
app/models/project_services/packagist_service.rb
View file @
32af384a
# frozen_string_literal: true
class
PackagistService
<
Service
prop_accessor
:username
,
:token
,
:server
...
...
app/models/project_services/pipelines_email_service.rb
View file @
32af384a
# frozen_string_literal: true
class
PipelinesEmailService
<
Service
prop_accessor
:recipients
boolean_accessor
:notify_only_broken_pipelines
...
...
app/models/project_services/pivotaltracker_service.rb
View file @
32af384a
# frozen_string_literal: true
class
PivotaltrackerService
<
Service
API_ENDPOINT
=
'https://www.pivotaltracker.com/services/v5/source_commits'
.
freeze
...
...
app/models/project_services/prometheus_service.rb
View file @
32af384a
# frozen_string_literal: true
class
PrometheusService
<
MonitoringService
include
PrometheusAdapter
...
...
app/models/project_services/pushover_service.rb
View file @
32af384a
# frozen_string_literal: true
class
PushoverService
<
Service
BASE_URI
=
'https://api.pushover.net/1'
.
freeze
...
...
@@ -79,7 +81,7 @@ class PushoverService < Service
end
if
data
[
:total_commits_count
]
>
0
message
<<
"
\n
Total commits count:
#{
data
[
:total_commits_count
]
}
"
message
=
[
message
,
"Total commits count:
#{
data
[
:total_commits_count
]
}
"
].
join
(
"
\n
"
)
end
pushover_data
=
{
...
...
app/models/project_services/redmine_service.rb
View file @
32af384a
# frozen_string_literal: true
class
RedmineService
<
IssueTrackerService
validates
:project_url
,
:issues_url
,
:new_issue_url
,
presence:
true
,
public_url:
true
,
if: :activated?
...
...
app/models/project_services/slack_service.rb
View file @
32af384a
# frozen_string_literal: true
class
SlackService
<
ChatNotificationService
def
title
'Slack notifications'
...
...
app/models/project_services/slack_slash_commands_service.rb
View file @
32af384a
# frozen_string_literal: true
class
SlackSlashCommandsService
<
SlashCommandsService
include
TriggersHelper
...
...
app/models/project_services/slash_commands_service.rb
View file @
32af384a
# frozen_string_literal: true
# Base class for Chat services
# This class is not meant to be used directly, but only to inherrit from.
class
SlashCommandsService
<
Service
...
...
app/models/project_services/teamcity_service.rb
View file @
32af384a
# frozen_string_literal: true
class
TeamcityService
<
CiService
include
ReactiveService
...
...
app/models/protected_branch/merge_access_level.rb
View file @
32af384a
# frozen_string_literal: true
class
ProtectedBranch::MergeAccessLevel
<
ActiveRecord
::
Base
include
ProtectedBranchAccess
end
app/models/protected_branch/push_access_level.rb
View file @
32af384a
# frozen_string_literal: true
class
ProtectedBranch::PushAccessLevel
<
ActiveRecord
::
Base
include
ProtectedBranchAccess
end
app/models/protected_tag/create_access_level.rb
View file @
32af384a
# frozen_string_literal: true
class
ProtectedTag::CreateAccessLevel
<
ActiveRecord
::
Base
include
ProtectedTagAccess
...
...
app/models/repository_language.rb
View file @
32af384a
# frozen_string_literal: true
class
RepositoryLanguage
<
ActiveRecord
::
Base
belongs_to
:project
belongs_to
:programming_language
...
...
app/models/site_statistic.rb
View file @
32af384a
# frozen_string_literal: true
class
SiteStatistic
<
ActiveRecord
::
Base
# prevents the creation of multiple rows
default_value_for
:id
,
1
...
...
app/models/storage/hashed_project.rb
View file @
32af384a
# frozen_string_literal: true
module
Storage
class
HashedProject
attr_accessor
:project
...
...
app/models/storage/legacy_project.rb
View file @
32af384a
# frozen_string_literal: true
module
Storage
class
LegacyProject
attr_accessor
:project
...
...
changelogs/unreleased/frozen-string-enable-app-models-even-more-still.yml
0 → 100644
View file @
32af384a
---
title
:
Enable frozen string in rest of app/models/**/*.rb
merge_request
:
gfyoung
author
:
type
:
performance
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment