Verified Commit d6e525f4 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:ambulance: fix(personal) Fix comment style in social handlers

issue #6085
Showing with 5 additions and 4 deletions
+5 -4
...@@ -175,7 +175,7 @@ class socialHandler_github extends socialHandler ...@@ -175,7 +175,7 @@ class socialHandler_github extends socialHandler
function validate ($value) function validate ($value)
{ {
# Regex from https://github.com/shinnn/github-username-regex /* Regex from https://github.com/shinnn/github-username-regex */
if (!preg_match('/^[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}$/i', $value)) { if (!preg_match('/^[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}$/i', $value)) {
throw new socialHandlerInvalidValueException(_('GitHub account names have at most 39 characters, contain only alphanumeric characters or hyphens, cannot have multiple consecutive hyphens, and cannot begin or end with a hyphen')); throw new socialHandlerInvalidValueException(_('GitHub account names have at most 39 characters, contain only alphanumeric characters or hyphens, cannot have multiple consecutive hyphens, and cannot begin or end with a hyphen'));
} }
...@@ -199,7 +199,7 @@ class socialHandler_googlescholar extends socialHandler ...@@ -199,7 +199,7 @@ class socialHandler_googlescholar extends socialHandler
function validate ($value) function validate ($value)
{ {
# Regex from https://www.wikidata.org/wiki/Property:P1960 /* Regex from https://www.wikidata.org/wiki/Property:P1960 */
if (!preg_match('/^[-\w]{12}$/', $value)) { if (!preg_match('/^[-\w]{12}$/', $value)) {
throw new socialHandlerInvalidValueException(_('Google Scholar account IDs have exactly 12 alphanumerical characters or hyphens or underscores')); throw new socialHandlerInvalidValueException(_('Google Scholar account IDs have exactly 12 alphanumerical characters or hyphens or underscores'));
} }
...@@ -223,8 +223,9 @@ class socialHandler_matrix extends socialHandler ...@@ -223,8 +223,9 @@ class socialHandler_matrix extends socialHandler
function validate ($value) function validate ($value)
{ {
# Grammar specified in https://matrix.org/docs/spec/appendices#identifier-grammar /* Grammar specified in https://matrix.org/docs/spec/appendices#identifier-grammar
# Currently, we do not check the server name (valid DNS or IPv4 address or IPv6 address) and optional port number * Currently, we do not check the server name (valid DNS or IPv4 address or IPv6 address) and optional port number
*/
if (!preg_match('/^@[-=\.\/\w]+:.+$/', $value)) { if (!preg_match('/^@[-=\.\/\w]+:.+$/', $value)) {
throw new socialHandlerInvalidValueException(_('Matrix user IDs have the format \'@username:server\'')); throw new socialHandlerInvalidValueException(_('Matrix user IDs have the format \'@username:server\''));
} }
......
  • SonarQube analysis reported 3 issues

    • :arrow_down_small: 3 minor

    Note: The following issues were found on lines that were not modified in the commit. Because these issues can't be reported as line comments, they are summarized here:

    1. :arrow_down_small: Rename class "socialHandler_github" to match the regular expression ^[a-zA-Z][a-zA-Z0-9]*$. :blue_book:
    2. :arrow_down_small: Rename class "socialHandler_googlescholar" to match the regular expression ^[a-zA-Z][a-zA-Z0-9]*$. :blue_book:
    3. :arrow_down_small: Rename class "socialHandler_matrix" to match the regular expression ^[a-zA-Z][a-zA-Z0-9]*$. :blue_book:
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment