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
ad367643
Commit
ad367643
authored
Oct 14, 2021
by
Jannik Lehmann
Committed by
Jose Ivan Vargas
Oct 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored Code Quality terms and names
parent
ef834f6b
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
45 additions
and
54 deletions
+45
-54
app/assets/javascripts/reports/codequality_report/grouped_codequality_reports_app.vue
...ts/codequality_report/grouped_codequality_reports_app.vue
+4
-2
app/assets/javascripts/reports/codequality_report/store/getters.js
...s/javascripts/reports/codequality_report/store/getters.js
+15
-19
ee/app/assets/javascripts/codequality_report/codequality_report.vue
...ets/javascripts/codequality_report/codequality_report.vue
+3
-3
ee/spec/frontend/codequality_report/codequality_report_spec.js
...ec/frontend/codequality_report/codequality_report_spec.js
+2
-2
locale/gitlab.pot
locale/gitlab.pot
+7
-14
spec/frontend/reports/codequality_report/grouped_codequality_reports_app_spec.js
...odequality_report/grouped_codequality_reports_app_spec.js
+5
-5
spec/frontend/reports/codequality_report/store/getters_spec.js
...frontend/reports/codequality_report/store/getters_spec.js
+3
-3
spec/frontend/reports/components/report_section_spec.js
spec/frontend/reports/components/report_section_spec.js
+6
-6
No files found.
app/assets/javascripts/reports/codequality_report/grouped_codequality_reports_app.vue
View file @
ad367643
...
...
@@ -55,10 +55,12 @@ export default {
...
mapActions
([
'
fetchReports
'
,
'
setPaths
'
]),
},
loadingText
:
sprintf
(
s__
(
'
ciReport|Loading %{reportName} report
'
),
{
reportName
:
'
codeclimate
'
,
// eslint-disable-next-line @gitlab/require-i18n-strings
reportName
:
'
Code quality
'
,
}),
errorText
:
sprintf
(
s__
(
'
ciReport|Failed to load %{reportName} report
'
),
{
reportName
:
'
codeclimate
'
,
// eslint-disable-next-line @gitlab/require-i18n-strings
reportName
:
'
Code quality
'
,
}),
};
</
script
>
...
...
app/assets/javascripts/reports/codequality_report/store/getters.js
View file @
ad367643
import
{
spriteIcon
}
from
'
~/lib/utils/common_utils
'
;
import
{
sprintf
,
__
,
s__
,
n
__
}
from
'
~/locale
'
;
import
{
sprintf
,
s
__
}
from
'
~/locale
'
;
import
{
LOADING
,
ERROR
,
SUCCESS
,
STATUS_NOT_FOUND
}
from
'
../../constants
'
;
export
const
hasCodequalityIssues
=
(
state
)
=>
...
...
@@ -18,27 +18,23 @@ export const codequalityStatus = (state) => {
export
const
codequalityText
=
(
state
)
=>
{
const
{
newIssues
,
resolvedIssues
}
=
state
;
const
text
=
[];
let
text
;
if
(
!
newIssues
.
length
&&
!
resolvedIssues
.
length
)
{
text
.
push
(
s__
(
'
ciReport|No changes to code quality
'
));
}
else
{
text
.
push
(
s__
(
'
ciReport|Code quality
'
));
if
(
resolvedIssues
.
length
)
{
text
.
push
(
n__
(
'
improved on %d point
'
,
'
improved on %d points
'
,
resolvedIssues
.
length
));
}
if
(
newIssues
.
length
&&
resolvedIssues
.
length
)
{
text
.
push
(
__
(
'
and
'
));
}
if
(
newIssues
.
length
)
{
text
.
push
(
n__
(
'
degraded on %d point
'
,
'
degraded on %d points
'
,
newIssues
.
length
));
}
text
=
s__
(
'
ciReport|No changes to code quality
'
);
}
else
if
(
newIssues
.
length
&&
resolvedIssues
.
length
)
{
text
=
sprintf
(
s__
(
`ciReport|Code quality scanning detected %{issueCount} changes in merged results`
),
{
issueCount
:
newIssues
.
length
+
resolvedIssues
.
length
,
},
);
}
else
if
(
resolvedIssues
.
length
)
{
text
=
s__
(
`ciReport|Code quality improved`
);
}
else
if
(
newIssues
.
length
)
{
text
=
s__
(
`ciReport|Code quality degraded`
);
}
return
text
.
join
(
''
)
;
return
text
;
};
export
const
codequalityPopover
=
(
state
)
=>
{
...
...
ee/app/assets/javascripts/codequality_report/codequality_report.vue
View file @
ad367643
<
script
>
import
{
GlPagination
,
GlSkeletonLoader
}
from
'
@gitlab/ui
'
;
import
{
mapActions
,
mapState
,
mapGetters
}
from
'
vuex
'
;
import
{
GlPagination
,
GlSkeletonLoader
}
from
'
@gitlab/ui
'
;
import
{
componentNames
}
from
'
ee/reports/components/issue_body
'
;
import
reportsMixin
from
'
ee/vue_shared/security_reports/mixins/reports_mixin
'
;
import
{
n__
,
s__
,
sprintf
}
from
'
~/locale
'
;
...
...
@@ -71,8 +71,8 @@ export default {
<report-section
always-open
:status=
"codequalityStatus"
:loading-text=
"translateText('
codeclimate
').loading"
:error-text=
"translateText('
codeclimate
').error"
:loading-text=
"translateText('
Code Quality
').loading"
:error-text=
"translateText('
Code Quality
').error"
:success-text=
"codequalityText"
:unresolved-issues=
"codequalityIssues"
:resolved-issues=
"[]"
...
...
ee/spec/frontend/codequality_report/codequality_report_spec.js
View file @
ad367643
...
...
@@ -53,7 +53,7 @@ describe('Codequality report app', () => {
});
it
(
'
shows a loading state
'
,
()
=>
{
expect
(
findStatus
().
text
()).
toBe
(
'
Loading
codeclimate
report
'
);
expect
(
findStatus
().
text
()).
toBe
(
'
Loading
Code Quality
report
'
);
expect
(
findSkeletonLoader
().
exists
()).
toBe
(
true
);
});
});
...
...
@@ -65,7 +65,7 @@ describe('Codequality report app', () => {
it
(
'
shows a warning icon and error message
'
,
()
=>
{
expect
(
findWarningIcon
().
exists
()).
toBe
(
true
);
expect
(
findStatus
().
text
()).
toBe
(
'
Failed to load
codeclimate
report
'
);
expect
(
findStatus
().
text
()).
toBe
(
'
Failed to load
Code Quality
report
'
);
});
});
...
...
locale/gitlab.pot
View file @
ad367643
...
...
@@ -40,25 +40,12 @@ msgstr ""
msgid " You need to do this before %{grace_period_deadline}."
msgstr ""
msgid " and"
msgstr ""
msgid " and "
msgstr ""
msgid " and %{sliced}"
msgstr ""
msgid " degraded on %d point"
msgid_plural " degraded on %d points"
msgstr[0] ""
msgstr[1] ""
msgid " improved on %d point"
msgid_plural " improved on %d points"
msgstr[0] ""
msgstr[1] ""
msgid " or "
msgstr ""
...
...
@@ -39986,7 +39973,13 @@ msgstr ""
msgid "ciReport|Cluster Image Scanning"
msgstr ""
msgid "ciReport|Code quality"
msgid "ciReport|Code quality degraded"
msgstr ""
msgid "ciReport|Code quality improved"
msgstr ""
msgid "ciReport|Code quality scanning detected %{issueCount} changes in merged results"
msgstr ""
msgid "ciReport|Container Scanning"
...
...
spec/frontend/reports/codequality_report/grouped_codequality_reports_app_spec.js
View file @
ad367643
...
...
@@ -60,7 +60,7 @@ describe('Grouped code quality reports app', () => {
});
it
(
'
should render loading text
'
,
()
=>
{
expect
(
findWidget
().
text
()).
toEqual
(
'
Loading
codeclimate
report
'
);
expect
(
findWidget
().
text
()).
toEqual
(
'
Loading
Code quality
report
'
);
});
});
...
...
@@ -84,7 +84,7 @@ describe('Grouped code quality reports app', () => {
});
it
(
'
renders summary text
'
,
()
=>
{
expect
(
findWidget
().
text
()).
toContain
(
'
Code quality degraded
on 1 point
'
);
expect
(
findWidget
().
text
()).
toContain
(
'
Code quality degraded
'
);
});
it
(
'
renders custom codequality issue body
'
,
()
=>
{
...
...
@@ -99,7 +99,7 @@ describe('Grouped code quality reports app', () => {
});
it
(
'
renders summary text
'
,
()
=>
{
expect
(
findWidget
().
text
()).
toContain
(
'
Code quality improved
on 1 point
'
);
expect
(
findWidget
().
text
()).
toContain
(
'
Code quality improved
'
);
});
it
(
'
renders custom codequality issue body
'
,
()
=>
{
...
...
@@ -115,7 +115,7 @@ describe('Grouped code quality reports app', () => {
it
(
'
renders summary text
'
,
()
=>
{
expect
(
findWidget
().
text
()).
toContain
(
'
Code quality
improved on 1 point and degraded on 1 point
'
,
'
Code quality
scanning detected 2 changes in merged results
'
,
);
});
...
...
@@ -132,7 +132,7 @@ describe('Grouped code quality reports app', () => {
});
it
(
'
renders error text
'
,
()
=>
{
expect
(
findWidget
().
text
()).
toContain
(
'
Failed to load
codeclimate
report
'
);
expect
(
findWidget
().
text
()).
toContain
(
'
Failed to load
Code quality
report
'
);
});
it
(
'
does not render a help icon
'
,
()
=>
{
...
...
spec/frontend/reports/codequality_report/store/getters_spec.js
View file @
ad367643
...
...
@@ -61,9 +61,9 @@ describe('Codequality reports store getters', () => {
it
.
each
`
resolvedIssues | newIssues | expectedText
${
0
}
|
${
0
}
|
${
'
No changes to code quality
'
}
${
0
}
|
${
1
}
|
${
'
Code quality degraded
on 1 point
'
}
${
2
}
|
${
0
}
|
${
'
Code quality improved
on 2 points
'
}
${
1
}
|
${
2
}
|
${
'
Code quality
improved on 1 point and degraded on 2 poin
ts
'
}
${
0
}
|
${
1
}
|
${
'
Code quality degraded
'
}
${
2
}
|
${
0
}
|
${
'
Code quality improved
'
}
${
1
}
|
${
2
}
|
${
'
Code quality
scanning detected 3 changes in merged resul
ts
'
}
`
(
'
returns a summary containing $resolvedIssues resolved issues and $newIssues new issues
'
,
({
newIssues
,
resolvedIssues
,
expectedText
})
=>
{
...
...
spec/frontend/reports/components/report_section_spec.js
View file @
ad367643
...
...
@@ -23,7 +23,7 @@ describe('Report section', () => {
const
defaultProps
=
{
component
:
''
,
status
:
'
SUCCESS
'
,
loadingText
:
'
Loading
codeclimate
report
'
,
loadingText
:
'
Loading
Code Quality
report
'
,
errorText
:
'
foo
'
,
successText
:
'
Code quality improved on 1 point and degraded on 1 point
'
,
resolvedIssues
,
...
...
@@ -117,13 +117,13 @@ describe('Report section', () => {
vm
=
mountComponent
(
ReportSection
,
{
component
:
''
,
status
:
'
LOADING
'
,
loadingText
:
'
Loading
codeclimate
report
'
,
loadingText
:
'
Loading
Code Quality
report
'
,
errorText
:
'
foo
'
,
successText
:
'
Code quality improved on 1 point and degraded on 1 point
'
,
hasIssues
:
false
,
});
expect
(
vm
.
$el
.
textContent
.
trim
()).
toEqual
(
'
Loading
codeclimate
report
'
);
expect
(
vm
.
$el
.
textContent
.
trim
()).
toEqual
(
'
Loading
Code Quality
report
'
);
});
});
...
...
@@ -229,13 +229,13 @@ describe('Report section', () => {
vm
=
mountComponent
(
ReportSection
,
{
component
:
''
,
status
:
'
ERROR
'
,
loadingText
:
'
Loading
codeclimate
report
'
,
errorText
:
'
Failed to load
codeclimate
report
'
,
loadingText
:
'
Loading
Code Quality
report
'
,
errorText
:
'
Failed to load
Code Quality
report
'
,
successText
:
'
Code quality improved on 1 point and degraded on 1 point
'
,
hasIssues
:
false
,
});
expect
(
vm
.
$el
.
textContent
.
trim
()).
toEqual
(
'
Failed to load
codeclimate
report
'
);
expect
(
vm
.
$el
.
textContent
.
trim
()).
toEqual
(
'
Failed to load
Code Quality
report
'
);
});
});
...
...
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