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
cdd95ddd
Commit
cdd95ddd
authored
Dec 25, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add latest changes from gitlab-org/gitlab@master
parent
d4569178
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
1 deletion
+32
-1
changelogs/unreleased/121714-fix-sentry-stack-trace-highlight-for-php.yml
...eased/121714-fix-sentry-stack-trace-highlight-for-php.yml
+5
-0
lib/gitlab/error_tracking/stack_trace_highlight_decorator.rb
lib/gitlab/error_tracking/stack_trace_highlight_decorator.rb
+7
-1
spec/factories/error_tracking/error_event.rb
spec/factories/error_tracking/error_event.rb
+10
-0
spec/lib/gitlab/error_tracking/stack_trace_highlight_decorator_spec.rb
...ab/error_tracking/stack_trace_highlight_decorator_spec.rb
+10
-0
No files found.
changelogs/unreleased/121714-fix-sentry-stack-trace-highlight-for-php.yml
0 → 100644
View file @
cdd95ddd
---
title
:
Fix stack trace highlight for PHP
merge_request
:
22258
author
:
type
:
fixed
lib/gitlab/error_tracking/stack_trace_highlight_decorator.rb
View file @
cdd95ddd
...
...
@@ -28,7 +28,7 @@ module Gitlab
end
def
highlight_entry_context
(
filename
,
context
)
language
=
Rouge
::
Lexer
.
guess_by_filename
(
filename
).
tag
language
=
guess_language_by_filename
(
filename
)
context
.
map
do
|
line_number
,
line_of_code
|
[
...
...
@@ -38,6 +38,12 @@ module Gitlab
]
end
end
def
guess_language_by_filename
(
filename
)
Rouge
::
Lexer
.
guess_by_filename
(
filename
).
tag
rescue
Rouge
::
Guesser
::
Ambiguous
=>
e
e
.
alternatives
.
min_by
(
&
:tag
)
&
.
tag
end
end
end
end
spec/factories/error_tracking/error_event.rb
View file @
cdd95ddd
...
...
@@ -35,6 +35,16 @@ FactoryBot.define do
[
8
,
"}
\n
"
]
]
},
{
'function'
=>
'print'
,
'lineNo'
=>
3
,
'filename'
=>
'hello_world.php'
,
'context'
=>
[
[
1
,
"// PHP/Hack example
\n
"
],
[
2
,
"<?php
\n
"
],
[
3
,
"echo 'Hello, World!';
\n
"
]
]
},
{
'filename'
=>
'blank.txt'
}
...
...
spec/lib/gitlab/error_tracking/stack_trace_highlight_decorator_spec.rb
View file @
cdd95ddd
...
...
@@ -48,6 +48,16 @@ describe Gitlab::ErrorTracking::StackTraceHighlightDecorator do
[
8
,
'<span id="LC1" class="line" lang="swift"><span class="p">}</span></span>'
]
]
},
{
'function'
=>
'print'
,
'lineNo'
=>
3
,
'filename'
=>
'hello_world.php'
,
'context'
=>
[
[
1
,
'<span id="LC1" class="line" lang="hack"><span class="c1">// PHP/Hack example</span></span>'
],
[
2
,
'<span id="LC1" class="line" lang="hack"><span class="cp"><?php</span></span>'
],
[
3
,
'<span id="LC1" class="line" lang="hack"><span class="k">echo</span> <span class="s1">\'Hello, World!\'</span><span class="p">;</span></span>'
]
]
},
{
'filename'
=>
'blank.txt'
}
...
...
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