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

Updates php cs fixer 2.0 #263

Merged
merged 3 commits into from
Dec 7, 2016
Merged

Updates php cs fixer 2.0 #263

merged 3 commits into from
Dec 7, 2016

Conversation

bshaffer
Copy link
Contributor

@bshaffer bshaffer commented Dec 6, 2016

also fixes mailgun tests

@@ -1,6 +1,6 @@
<?php
/**
* Copyright 2015 Google Inc.
Copy link
Contributor

Choose a reason for hiding this comment

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

The year should be the year when you add the file, so you should not update it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh, that's true. Unfortunately, all the headers have to be the same for the linter to work. What if we changed them all to Copyright 2015, 2016 Google Inc.?

Also, the vast majority of these files were added in 2016, but the copyright header wasn't updated when copied.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you have exception for the linter? I also feel like it's a linter's bug

Copy link
Contributor Author

@bshaffer bshaffer Dec 6, 2016

Choose a reason for hiding this comment

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

We can just not check the header, if that's what you mean, but no there is no option to skip the copyright part of the header. I submitted PHP-CS-Fixer/PHP-CS-Fixer#2363 for this. But in the interim, we should decide to remove header checking from the linter, change it to 2015, 2016, or set all of them to 2016

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe skip checking the header?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Definitely true, although should new files have a previous year's copyright?

Copy link
Contributor

Choose a reason for hiding this comment

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

If new files have old year in the copyright, it looks very weird to me

Copy link

@keradus keradus Dec 6, 2016

Choose a reason for hiding this comment

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

treat the copyright per project, not per file.
then, all files should have same copyright.

you put copyrights in one, common place, for easy use, like LICENSE file. and then, copy-paste it to all files if one would only see one file, then for sure you don't want him to get under impression the file is copyleft.

you probably don't want to keep different files in one repo under different copyright. year, as trivial, but still, is one of that case, when you make different copyright for different files.

Copy link
Contributor

Choose a reason for hiding this comment

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

treat the copyright per project, not per file.

I don't think that's feasible. Files should be able to have different year in their copyright headers.

Copy link

Choose a reason for hiding this comment

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

ok, I took a look at this project more and I would say that i would treat different folders separately, like you have different composer files. for that, when you don't do submodule or other solution, just keep everything in one place, it may be a valid case to have different headers.

at the same time, I would not treat it as regular case nor bug of fixer. it could be extended to support that case for sure, feel free to contribute if you want to change current behaviour ;)

@@ -27,5 +27,6 @@ return PhpCsFixer\Config::create()
PhpCsFixer\Finder::create()
->notPath('appengine/wordpress/src/files/flexible/wp-config.php')
->notPath('appengine/wordpress/src/files/standard/wp-config.php')
->in(__DIR__)
Copy link

Choose a reason for hiding this comment

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

FYI: without this you would have to specify the path at every single fix run, like php-cs-fixer fix . instead of php-cs-fixer fix

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you! That is helpful.

@bshaffer
Copy link
Contributor Author

bshaffer commented Dec 7, 2016

FYI, I am keeping the copyright changes, because all of these files are actually Copyright 2016 anyway:

# determine the creation date for every file and print those added in 2015 or before
$ git ls-tree -r --name-only HEAD | \
while read filename; do
  echo "$(git log --format="%aD" -- $filename | tail -1) $filename";
done | grep -v 2016 | awk '{print $4, $7}' 
2015 .gitignore
2015 .travis.yml
2015 CONTRIBUTING.md
2013 LICENSE
2012 README.md
2015 TRAVIS.md
2015 bigquery/api/README.md
2015 bigquery/api/composer.json
2015 bigquery/api/composer.lock
2015 favicon.ico
2015 storage/api/README.md
2015 storage/api/composer.json
2015 storage/api/composer.lock

@tmatsuo
Copy link
Contributor

tmatsuo commented Dec 7, 2016

LGTM

@bshaffer bshaffer merged commit 591d481 into master Dec 7, 2016
@bshaffer bshaffer deleted the updates-php-cs-fixer-2.0 branch December 7, 2016 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants