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/combine consecutive issets combine consecutive unsets #31271

Conversation

DeepDiver1975
Copy link
Member

Description

Adding two additional php--cs-fixer rules

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.

@codecov
Copy link

codecov bot commented Apr 25, 2018

Codecov Report

Merging #31271 into master will increase coverage by <.01%.
The diff coverage is 72.72%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #31271      +/-   ##
============================================
+ Coverage     62.57%   62.57%   +<.01%     
- Complexity    18234    18380     +146     
============================================
  Files          1145     1145              
  Lines         68397    68390       -7     
  Branches       1234     1234              
============================================
- Hits          42801    42797       -4     
+ Misses        25235    25232       -3     
  Partials        361      361
Flag Coverage Δ Complexity Δ
#javascript 52.05% <ø> (ø) 0 <ø> (ø) ⬇️
#phpunit 63.77% <72.72%> (ø) 18380 <0> (+146) ⬆️
Impacted Files Coverage Δ Complexity Δ
apps/comments/lib/Dav/CommentsPlugin.php 86.04% <0%> (ø) 25 <0> (-1) ⬇️
core/ajax/share.php 0% <0%> (ø) 0 <0> (ø) ⬇️
lib/base.php 4.21% <0%> (ø) 152 <0> (-1) ⬇️
lib/private/Server.php 85.05% <100%> (ø) 250 <0> (-4) ⬇️
lib/private/User/Session.php 66.5% <100%> (-0.17%) 144 <0> (ø)
lib/private/Comments/Comment.php 98.93% <100%> (ø) 48 <0> (-1) ⬇️
lib/private/Files/Type/Detection.php 68.51% <100%> (ø) 46 <0> (-1) ⬇️
lib/private/DB/MDB2SchemaReader.php 96.11% <100%> (ø) 77 <0> (-1) ⬇️
apps/dav/lib/Connector/Sabre/File.php 84.28% <100%> (ø) 107 <0> (-1) ⬇️
lib/private/Files/Storage/DAV.php 81.01% <100%> (ø) 161 <0> (+161) ⬆️
... and 8 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 a7fc75d...b8793ad. Read the comment docs.

if (isset($_GET['itemType'], $_GET['itemSource'], $_GET['checkReshare'], $_GET['checkShares'])
) {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe to remove the empty lines...

@mmattel
Copy link
Contributor

mmattel commented Apr 25, 2018

@@ -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

Choose a reason for hiding this comment

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

The automagic fixer has left space(s) like here - it looks weird having the ) ;

@@ -684,7 +684,7 @@ public function __construct($webRoot, \OC\Config $config) {
'server' => $_SERVER,
'env' => $_ENV,
'cookies' => $_COOKIE,
'method' => (isset($_SERVER) && isset($_SERVER['REQUEST_METHOD']))
'method' => (isset($_SERVER, $_SERVER['REQUEST_METHOD']) )
Copy link
Contributor

Choose a reason for hiding this comment

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

And it left space between the closing brackets ) )
I suspect that when we add more checks, space in places like that will fail the code quality tests.

@phil-davis
Copy link
Contributor

phil-davis commented Apr 26, 2018

PHP-CS-Fixer/PHP-CS-Fixer#3339 explains why combine_consecutive_issets leaves space behind.
The suggested solution is to also use the rule no_spaces_inside_parenthesis

See PR #31273 for this.

Copy link
Contributor

@phil-davis phil-davis left a comment

Choose a reason for hiding this comment

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

@DeepDiver1975 I suggest we merge this, and immediately after merge #31273 which fixes up a bunch of white-space stuff.

That should annoy everyone with an open PR quite enough for 1 day ;)

@DeepDiver1975 DeepDiver1975 merged commit c013e07 into master Apr 30, 2018
@DeepDiver1975 DeepDiver1975 deleted the code-quality/combine_consecutive_issets-combine_consecutive_unsets branch April 30, 2018 09:19
@phil-davis
Copy link
Contributor

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