Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
XWiki
xwiki-commons
Commits
97738e5f
Commit
97738e5f
authored
Jun 01, 2022
by
Vincent Massol
Browse files
[Misc] Remove code smell from Sonarqube
parent
e2caeb97
Changes
1
Hide whitespace changes
Inline
Side-by-side
xwiki-commons-tools/xwiki-commons-tool-xar/xwiki-commons-tool-xar-plugin/src/main/java/org/xwiki/tool/xar/VerifyMojo.java
View file @
97738e5f
...
...
@@ -191,7 +191,7 @@ public void execute() throws MojoExecutionException, MojoFailureException
}
// Verification 11: Verify that Translations documents don't use GLOBAL or USER visibility
if
(!
translationVisibilitySkip
&&
xdoc
.
containsTranslations
())
{
if
(!
this
.
translationVisibilitySkip
&&
xdoc
.
containsTranslations
())
{
for
(
String
visibility
:
xdoc
.
getTranslationVisibilities
())
{
if
(
visibility
.
equals
(
"USER"
)
||
visibility
.
equals
(
"GLOBAL"
))
{
errors
.
add
(
String
.
format
(
"[%s] ([%s]) page contains a translation using a wrong visibility "
...
...
@@ -217,12 +217,12 @@ public void execute() throws MojoExecutionException, MojoFailureException
verifyAttachmentMimetypes
(
errors
,
xdoc
.
getAttachmentData
());
// Verification 15: Verify that date fields are not set.
if
(!
skipDates
)
{
if
(!
this
.
skipDates
)
{
verifyDateFields
(
errors
,
xdoc
);
}
// Verification 16: Verify that author fields are not set.
if
(!
skipAuthors
)
{
if
(!
this
.
skipAuthors
)
{
verifyAuthorFields
(
errors
,
xdoc
);
}
...
...
@@ -274,7 +274,7 @@ private String getTitlePatternRuleforPage(String documentReference)
private
void
verifyDateFields
(
List
<
String
>
errors
,
XWikiDocument
xdoc
)
{
if
(!
skipDatesDocumentList
.
contains
(
xdoc
.
getReference
()))
{
if
(!
this
.
skipDatesDocumentList
.
contains
(
xdoc
.
getReference
()))
{
if
(
xdoc
.
isDatePresent
())
{
errors
.
add
(
"'date' field is present"
);
}
...
...
@@ -295,10 +295,8 @@ private void verifyDateFields(List<String> errors, XWikiDocument xdoc)
private
void
verifyAuthorFields
(
List
<
String
>
errors
,
XWikiDocument
xdoc
)
{
if
(!
skipAuthorsDocumentList
.
contains
(
xdoc
.
getReference
()))
{
if
(
xdoc
.
isOriginalMetadataAuthorPresent
())
{
errors
.
add
(
"'originalMetadataAuthor' field is present"
);
}
if
(!
this
.
skipAuthorsDocumentList
.
contains
(
xdoc
.
getReference
())
&&
xdoc
.
isOriginalMetadataAuthorPresent
())
{
errors
.
add
(
"'originalMetadataAuthor' field is present"
);
}
}
...
...
@@ -337,5 +335,4 @@ private boolean isTitlesMatching(String documentReference, String title)
}
return
true
;
}
}
Write
Preview
Supports
Markdown
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