Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove invalid mail addresses when updating the license header #6926

Merged
merged 2 commits into from
Nov 7, 2017

Conversation

juliusknorr
Copy link
Member

Follow up of #6864

This will make sure we only have valid email addresses in the license header, so parsing of the phpdoc block will succeed.

Should i also run the script and commit the changes or is that done only during the release build process?

@juliusknorr juliusknorr added the 3. to review Waiting for reviews label Oct 24, 2017
@juliusknorr juliusknorr added this to the Nextcloud 13 milestone Oct 24, 2017
@MorrisJobke
Copy link
Member

The problem is, that for some users we only have a pseudonym. We should check if removing them from the license header is even possible. cc @schiessle

@juliusknorr
Copy link
Member Author

The problem is, that for some users we only have a pseudonym. We should check if removing them from the license header is even possible.

Ah yes, that could be a problem. We also could just remove the <> around the email then, so we keep the invalid mail besides the name.

@nickvergessen nickvergessen requested review from schiessle and removed request for nickvergessen, MorrisJobke and LukasReschke November 1, 2017 10:06
@rullzer
Copy link
Member

rullzer commented Nov 1, 2017

Reminder to myself to kick @schiessle about this

@schiessle
Copy link
Member

We also could just remove the <> around the email then, so we keep the invalid mail besides the name.

I think that's a good compromise. I would not remove anyone or any information which might be technically not correct (e.g. email) but still useful for a human who might be able to spot the typo easily and fix it. So I think removing the <> from not valid emails is a good approach in order to keep all information but still make it readable by a parser.

@juliusknorr
Copy link
Member Author

Ok, fixed the commit to just remove the brackets.

Please review @MorrisJobke @schiessle @rullzer

@codecov
Copy link

codecov bot commented Nov 3, 2017

Codecov Report

Merging #6926 into master will increase coverage by <.01%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##             master    #6926      +/-   ##
============================================
+ Coverage     50.73%   50.73%   +<.01%     
  Complexity    24413    24413              
============================================
  Files          1579     1579              
  Lines         93294    93294              
  Branches       1359     1359              
============================================
+ Hits          47332    47333       +1     
+ Misses        45962    45961       -1
Impacted Files Coverage Δ Complexity Δ
apps/files_trashbin/lib/Trashbin.php 72.53% <0%> (+0.24%) 136% <0%> (ø) ⬇️

@MorrisJobke
Copy link
Member

I would like to see #7083 in before that and will have a look at this afterwards to see the actual difference.

@MorrisJobke
Copy link
Member

Rebased and testing the output now :)

private function fixInvalidEmail($author) {
preg_match('/<(.*)>/', $author, $mailMatch);
if (count($mailMatch) === 2 && !filter_var($mailMatch[1], FILTER_VALIDATE_EMAIL)) {
$author = str_replace(' <'.$mailMatch[1].'>', $mailMatch[1], $author);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the leading space. Otherwise it will look like this:

diff --git a/lib/private/Setup.php b/lib/private/Setup.php
index 8e718b0232..af3d7a3c0c 100644
--- a/lib/private/Setup.php
+++ b/lib/private/Setup.php
@@ -2,7 +2,7 @@
 /**
  * @copyright Copyright (c) 2016, ownCloud, Inc.
  *
- * @author Administrator <Administrator@WINDOWS-2012>
+ * @author AdministratorAdministrator@WINDOWS-2012
  * @author Arthur Schiwon <[email protected]>
  * @author Bart Visscher <[email protected]>
  * @author Bernhard Posselt <[email protected]>

And maybe also add quotes around it to more easily recognise what was the email.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙈 Fixed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the quotes around the "email"?

private function fixInvalidEmail($author) {
preg_match('/<(.*)>/', $author, $mailMatch);
if (count($mailMatch) === 2 && !filter_var($mailMatch[1], FILTER_VALIDATE_EMAIL)) {
$author = str_replace('<'.$mailMatch[1].'>', $mailMatch[1], $author);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we have quotes around the previous email? Something like str_replace('<'.$mailMatch[1].'>', '"'.$mailMatch[1].'"', $author);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I somehow missed that. Fixed as well.

Copy link
Member

@MorrisJobke MorrisJobke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, works, and updated headers are committed to this branch as well 👍

@MorrisJobke MorrisJobke merged commit aa78998 into master Nov 7, 2017
@MorrisJobke MorrisJobke deleted the license-remove-invalid-mail branch November 7, 2017 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants