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

Code quality/no spaces inside parenthesis #31273

Merged
merged 5 commits into from
Apr 30, 2018

Conversation

phil-davis
Copy link
Contributor

Description

Add php_cs_fixer rule no_spaces_inside_parenthesis

Motivation and Context

combine_consecutive_issets in #31271 leaves behind white space.

How Has This Been Tested?

Run php_cs_fixer locally

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@phil-davis
Copy link
Contributor Author

I put this on top of #31271 as they "sort of go together" but "not really".

IMO this seems like "a good thing" to tidy up some other random spaces around the code base.

@phil-davis
Copy link
Contributor Author

Why do I get no codecov reported?

unset($_SERVER['CONTENT_LENGTH']);
unset($_SERVER['REQUEST_METHOD']);
unset($_SERVER['HTTP_OC_CHUNKED'], $_SERVER['CONTENT_LENGTH'], $_SERVER['REQUEST_METHOD']);

Copy link
Member

Choose a reason for hiding this comment

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

still stupid blank lines ....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PHP-CS-Fixer/PHP-CS-Fixer#2804

no_extra_consecutive_blank_lines looks a good thing to add...

@phil-davis phil-davis force-pushed the code-quality/no_spaces_inside_parenthesis branch from de3b457 to 138aa50 Compare April 26, 2018 07:43
@phil-davis
Copy link
Contributor Author

Now I have 589 files changed. Can we get it over 1000?

@codecov
Copy link

codecov bot commented Apr 26, 2018

Codecov Report

Merging #31273 into master will increase coverage by <.01%.
The diff coverage is 58.69%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #31273      +/-   ##
============================================
+ Coverage     62.58%   62.59%   +<.01%     
+ Complexity    18384    18227     -157     
============================================
  Files          1145     1145              
  Lines         68411    68414       +3     
  Branches       1234     1234              
============================================
+ Hits          42818    42821       +3     
  Misses        25232    25232              
  Partials        361      361
Flag Coverage Δ Complexity Δ
#javascript 52.05% <ø> (ø) 0 <ø> (ø) ⬇️
#phpunit 63.79% <58.69%> (ø) 18227 <39> (-157) ⬇️
Impacted Files Coverage Δ Complexity Δ
apps/files_sharing/templates/list.php 0% <ø> (ø) 0 <0> (ø) ⬇️
lib/private/Files/Storage/Wrapper/Encryption.php 64.86% <ø> (ø) 156 <0> (ø) ⬇️
lib/private/AppFramework/Http/Request.php 96.72% <ø> (ø) 140 <0> (ø) ⬇️
apps/federation/lib/TrustedServers.php 98.41% <ø> (ø) 22 <0> (ø) ⬇️
...amework/Middleware/Security/SecurityMiddleware.php 98.36% <ø> (ø) 22 <0> (ø) ⬇️
apps/systemtags/templates/list.php 0% <ø> (ø) 0 <0> (ø) ⬇️
lib/private/Migration/SimpleOutput.php 42.85% <ø> (ø) 3 <0> (ø) ⬇️
core/templates/update.admin.php 0% <ø> (ø) 0 <0> (ø) ⬇️
apps/files/templates/simplelist.php 0% <ø> (ø) 0 <0> (ø) ⬇️
apps/dav/lib/Meta/RootCollection.php 30.76% <ø> (ø) 6 <0> (ø) ⬇️
... and 265 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c013e07...6d992b5. Read the comment docs.

@phil-davis
Copy link
Contributor Author

I lost code coverage by deleting blank lines???
Poor codecov - it does not really know what to do with this sort of rubbish change.

&& isset($_GET['checkReshare'])
&& isset($_GET['checkShares'])) {
if (isset($_GET['itemType'], $_GET['itemSource'], $_GET['checkReshare'], $_GET['checkShares'])

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Almost got there - I will fix this manually!

@@ -189,7 +189,7 @@ public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData =
$fileId = $cacheData['fileid'];
$data['fileid'] = $fileId;
// only reuse data if the file hasn't explicitly changed
if (isset($data['storage_mtime']) && isset($cacheData['storage_mtime']) && $data['storage_mtime'] === $cacheData['storage_mtime']) {
if (isset($data['storage_mtime'], $cacheData['storage_mtime']) && $data['storage_mtime'] === $cacheData['storage_mtime']) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

and here it puts in an extra space char - to fix...

@@ -123,7 +123,7 @@ public function update($path, $time = null) {

$data = $this->scanner->scan($path, Scanner::SCAN_SHALLOW, -1, false);
if (
isset($data['oldSize']) && isset($data['size']) &&
isset($data['oldSize'], $data['size']) &&
Copy link
Contributor Author

Choose a reason for hiding this comment

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

too much space here

@@ -110,7 +110,7 @@ public function compare($a, $b) {
$aa = self::naturalSortChunkify($a);
$bb = self::naturalSortChunkify($b);

for ($x = 0; isset($aa[$x]) && isset($bb[$x]); $x++) {
for ($x = 0; isset($aa[$x], $bb[$x]) ; $x++) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

B\onus space here

@phil-davis
Copy link
Contributor Author

@DeepDiver1975 this is ready for review and merge, if you want to take the plunge...

@phil-davis phil-davis force-pushed the code-quality/no_spaces_inside_parenthesis branch from aeac95b to 420a868 Compare April 28, 2018 06:28
@patrickjahns
Copy link
Contributor

Can we reset codecov results ? If not, can we put it into a clean PR so we know what codecov finds issues with

@phil-davis
Copy link
Contributor Author

PR #31306 has a clean cherry-pick of all these commits. Let's see what CI thinks about it.

@phil-davis
Copy link
Contributor Author

The other PR also gets 58.51% of diff hit (target 62.58%). I guess that of the lines touched by this code format change, on average they are only inside test-covered code 58.51% of the time, a bit less than the repo average of 62.58%.

I don't think we require to do massive unit test writing in order to implement code-style standards???

@DeepDiver1975
Copy link
Member

taking care about rebase

@DeepDiver1975 DeepDiver1975 force-pushed the code-quality/no_spaces_inside_parenthesis branch from 5a369c0 to 6d992b5 Compare April 30, 2018 09:22
@phil-davis
Copy link
Contributor Author

Are we going to backport these code-style changes?

I would like that to happen, to minimize future rubbish conflicts when backporting other PRs.

@DeepDiver1975
Copy link
Member

Are we going to backport these code-style changes?

yes - we will - but I'd first like to get the style sorted out on master and let devs adopt and see if this all works out

@phil-davis
Copy link
Contributor Author

sounds good. "backporting" in the end will be adding the "final" .php_cs and running it to fix everything. (i.e. a 1-by-1 backport of each PR in master will not be particularly easy and will not necessarily get things passing in stable10 anyway)

@phil-davis
Copy link
Contributor Author

Someone override codecov and merge if you like it.

@DeepDiver1975 DeepDiver1975 merged commit ed0c5df into master Apr 30, 2018
@DeepDiver1975 DeepDiver1975 deleted the code-quality/no_spaces_inside_parenthesis branch April 30, 2018 10:50
@phil-davis
Copy link
Contributor Author

Effective backport is included in #31453

@lock
Copy link

lock bot commented Jul 31, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants