Skip to content

include owncloud coding standard#31442

Merged
DeepDiver1975 merged 3 commits intomasterfrom
add-owncloud-coding-style
May 17, 2018
Merged

include owncloud coding standard#31442
DeepDiver1975 merged 3 commits intomasterfrom
add-owncloud-coding-style

Conversation

@patrickjahns
Copy link
Copy Markdown
Contributor

@patrickjahns patrickjahns commented May 15, 2018

Owncloud coding-standard 1.0.1 is available - use it in core https://github.com/owncloud/coding-standard

Description

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

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.

composer.json Outdated
"zendframework/zend-servicemanager": "^3.3",
"symfony/translation": "^3.4"
"symfony/translation": "^3.4",
"owncloud/coding-standard": "^1.0"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

shall be a dev dependency

@patrickjahns patrickjahns force-pushed the add-owncloud-coding-style branch from 9f07dde to bceb875 Compare May 15, 2018 16:20
@codecov
Copy link
Copy Markdown

codecov bot commented May 15, 2018

Codecov Report

Merging #31442 into master will decrease coverage by 0.05%.
The diff coverage is 74.86%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #31442      +/-   ##
============================================
- Coverage     62.65%    62.6%   -0.06%     
- Complexity    18248    18253       +5     
============================================
  Files          1145     1145              
  Lines         68464    68566     +102     
  Branches       1234     1234              
============================================
+ Hits          42897    42925      +28     
- Misses        25206    25280      +74     
  Partials        361      361
Flag Coverage Δ Complexity Δ
#javascript 52.05% <ø> (ø) 0 <ø> (ø) ⬇️
#phpunit 63.8% <74.86%> (-0.07%) 18253 <778> (+5)
Impacted Files Coverage Δ Complexity Δ
apps/files_external/appinfo/app.php 0% <ø> (ø) 0 <0> (ø) ⬇️
...al/lib/Controller/UserGlobalStoragesController.php 0% <ø> (ø) 0 <0> (ø) ⬇️
apps/files_external/lib/Lib/Backend/SFTP_Key.php 0% <ø> (ø) 0 <0> (ø) ⬇️
apps/federatedfilesharing/lib/PersonalPanel.php 96.42% <ø> (ø) 6 <0> (ø) ⬇️
apps/federatedfilesharing/appinfo/app.php 20.83% <ø> (ø) 0 <0> (ø) ⬇️
apps/files_external/lib/Lib/Backend/Local.php 76.92% <ø> (ø) 0 <0> (ø) ⬇️
apps/files_external/lib/Lib/Backend/SFTP.php 0% <ø> (ø) 0 <0> (ø) ⬇️
apps/comments/lib/Activity/Extension.php 0% <ø> (ø) 34 <0> (ø) ⬇️
apps/federation/lib/DAV/FedAuth.php 100% <ø> (ø) 2 <0> (ø) ⬇️
...s/federatedfilesharing/lib/AppInfo/Application.php 100% <ø> (ø) 3 <0> (ø) ⬇️
... and 477 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 f5fc814...50fb402. Read the comment docs.

Copy link
Copy Markdown
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.

Looks like a great thing. Having this consistency of "crud" helps in general code-readability.

Copy link
Copy Markdown
Member

@DeepDiver1975 DeepDiver1975 left a comment

Choose a reason for hiding this comment

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

  • yoda style is applied wrong. I want $var === null and not null === $var

@phil-davis
Copy link
Copy Markdown
Contributor

phil-davis commented May 16, 2018

@DeepDiver1975 are you happy with the code now?

Proposed "effective backport" to stable10 is in PR #31453

@patrickjahns
Copy link
Copy Markdown
Contributor Author

@DeepDiver1975
what do you mean by space around if ?

@DeepDiver1975
Copy link
Copy Markdown
Member

@DeepDiver1975
what do you mean by space around if ?

ignore

@DeepDiver1975
Copy link
Copy Markdown
Member

fixing yoda style - owncloud/coding-standard#6

@phil-davis
Copy link
Copy Markdown
Contributor

if (null === $var)
if (true === $booleanVar)
if ("a" === $stringVar)

looks weird, but actually is handy to do as a habit because then if you accidentally write only a single =

if (null = $var)
if (true = $booleanVar)
if ("a" = $stringVar)

it explodes immediately on you.
Whereas:

if ($var = null)

is a "silent" bug.

@patrickjahns
Copy link
Copy Markdown
Contributor Author

@phil-davis
that should be catched by codestyle checker - will do a quick test and confirm

@phil-davis
Copy link
Copy Markdown
Contributor

@DeepDiver1975 are you making a new release of the coding-standard?
And then we re-fix the code in this PR and my backport.
Or do we merge this attempt, and make another PR(s) to get rid of Yoda?

@patrickjahns patrickjahns force-pushed the add-owncloud-coding-style branch from 31a75fa to 5f0af49 Compare May 16, 2018 14:56
@patrickjahns
Copy link
Copy Markdown
Contributor Author

@DeepDiver1975
Re-done the PR with 1.0.1 coding-standard release - please re-check

@phil-davis
We still need to agree when we will apply the coding-standard to stable10 - please wait until there is a final ✅

@patrickjahns
Copy link
Copy Markdown
Contributor Author

regarding

<?php

if ($var = null) {
	echo "test";
}

this is not catched by the code checker

@phil-davis
Copy link
Copy Markdown
Contributor

phil-davis commented May 16, 2018

php-cs-fixer does not succeed in "un-Yoda-ing" /drone/src/tests/acceptance/features/bootstrap/Logging.php

I found that you have to get rid of the places that have array references like $myArray [$something] - manually take the space out between $myArray and [

Then it might be happy to un-Yoda itself.

Bug report PHP-CS-Fixer/PHP-CS-Fixer#3754 and PR to fix PHP-CS-Fixer/PHP-CS-Fixer#3755 - should be in php-cs-fixer 2.11.2

I pushed a commit that fixes Logging.php and will (hopefully) make this pass CI.

@DeepDiver1975 DeepDiver1975 merged commit 6b36c56 into master May 17, 2018
@DeepDiver1975 DeepDiver1975 deleted the add-owncloud-coding-style branch May 17, 2018 08:23
@phil-davis
Copy link
Copy Markdown
Contributor

phil-davis commented Jun 8, 2018

This and other related PRs/commits are in backport PR #31722 which will likely be merged some time after 10.0.9 (to avoid huge rebasing effort while sorting out a release)

@lock
Copy link
Copy Markdown

lock bot commented Jul 30, 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 30, 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