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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
fc83a730
Commit
fc83a730
authored
May 21, 2020
by
Rajendra Kadam
Committed by
Peter Leitzen
May 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use applogger in akismet service
parent
11271ac4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
8 deletions
+9
-8
app/services/spam/akismet_service.rb
app/services/spam/akismet_service.rb
+2
-2
changelogs/unreleased/rails-logger-cop-17.yml
changelogs/unreleased/rails-logger-cop-17.yml
+5
-0
spec/services/spam/akismet_service_spec.rb
spec/services/spam/akismet_service_spec.rb
+2
-6
No files found.
app/services/spam/akismet_service.rb
View file @
fc83a730
...
...
@@ -27,7 +27,7 @@ module Spam
is_spam
,
is_blatant
=
akismet_client
.
check
(
options
[
:ip_address
],
options
[
:user_agent
],
params
)
is_spam
||
is_blatant
rescue
=>
e
Rails
.
logger
.
error
(
"Unable to connect to Akismet:
#{
e
}
, skipping check"
)
# rubocop:disable Gitlab/RailsLogger
Gitlab
::
AppLogger
.
error
(
"Unable to connect to Akismet:
#{
e
}
, skipping check"
)
false
end
end
...
...
@@ -67,7 +67,7 @@ module Spam
akismet_client
.
public_send
(
type
,
options
[
:ip_address
],
options
[
:user_agent
],
params
)
# rubocop:disable GitlabSecurity/PublicSend
true
rescue
=>
e
Rails
.
logger
.
error
(
"Unable to connect to Akismet:
#{
e
}
, skipping!"
)
# rubocop:disable Gitlab/RailsLogger
Gitlab
::
AppLogger
.
error
(
"Unable to connect to Akismet:
#{
e
}
, skipping!"
)
false
end
end
...
...
changelogs/unreleased/rails-logger-cop-17.yml
0 → 100644
View file @
fc83a730
---
title
:
Use applogger in akismet service
merge_request
:
32205
author
:
Rajendra Kadam
type
:
fixed
spec/services/spam/akismet_service_spec.rb
View file @
fc83a730
...
...
@@ -45,9 +45,7 @@ describe Spam::AkismetService do
end
it
'logs an error'
do
logger_spy
=
double
(
:logger
)
expect
(
Rails
).
to
receive
(
:logger
).
and_return
(
logger_spy
)
expect
(
logger_spy
).
to
receive
(
:error
).
with
(
/skipping/
)
expect
(
Gitlab
::
AppLogger
).
to
receive
(
:error
).
with
(
/skipping/
)
subject
.
send
(
method_call
)
end
...
...
@@ -98,9 +96,7 @@ describe Spam::AkismetService do
end
it
'logs an error'
do
logger_spy
=
double
(
:logger
)
expect
(
Rails
).
to
receive
(
:logger
).
and_return
(
logger_spy
)
expect
(
logger_spy
).
to
receive
(
:error
).
with
(
/skipping check/
)
expect
(
Gitlab
::
AppLogger
).
to
receive
(
:error
).
with
(
/skipping check/
)
subject
.
spam?
end
...
...
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