Skip to content

style: add operator_linebreak - #40

Merged
nickvergessen merged 1 commit into
masterfrom
enh/operator_linebreak
Nov 6, 2024
Merged

style: add operator_linebreak#40
nickvergessen merged 1 commit into
masterfrom
enh/operator_linebreak

Conversation

@blizzz

Copy link
Copy Markdown
Member

Ensure that conditional statements are split into multiple lines and that the operator is placed at the beginning. This actually implements the style described in https://docs.nextcloud.com/server/latest/developer_manual/getting_started/codingguidelines.html#control-structures

...
diff --git a/apps/dav/lib/CalDAV/BirthdayService.php b/apps/dav/lib/CalDAV/BirthdayService.php
index e1e46316d74..680b228766f 100644
--- a/apps/dav/lib/CalDAV/BirthdayService.php+++ b/apps/dav/lib/CalDAV/BirthdayService.php@@ -295,8 +295,8 @@ class BirthdayService {
}
return (
- $newCalendarData->VEVENT->DTSTART->getValue() !== $existingBirthday->VEVENT->DTSTART->getValue() ||- $newCalendarData->VEVENT->SUMMARY->getValue() !== $existingBirthday->VEVENT->SUMMARY->getValue()+ $newCalendarData->VEVENT->DTSTART->getValue() !== $existingBirthday->VEVENT->DTSTART->getValue()+ || $newCalendarData->VEVENT->SUMMARY->getValue() !== $existingBirthday->VEVENT->SUMMARY->getValue()
);
}
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php
index c9d323d27df..b1e31733b7a 100644
--- a/apps/dav/lib/CalDAV/CalDavBackend.php+++ b/apps/dav/lib/CalDAV/CalDavBackend.php@@ -394,8 +394,8 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
// New share can not have more permissions than the old one.
continue;
}
- if (isset($calendars[$row['id']][$readOnlyPropertyName]) &&- $calendars[$row['id']][$readOnlyPropertyName] === 0) {+ if (isset($calendars[$row['id']][$readOnlyPropertyName])+ && $calendars[$row['id']][$readOnlyPropertyName] === 0) {
// Old share is already read-write, no more permissions can be gained
continue;
}
@@ -1929,8 +1929,8 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
if ($pattern !== '') {
$innerQuery->andWhere($innerQuery->expr()->iLike('op.value',
- $outerQuery->createNamedParameter('%' .- $this->db->escapeLikeParameter($pattern) . '%')));+ $outerQuery->createNamedParameter('%'+ . $this->db->escapeLikeParameter($pattern) . '%')));
}
$start = null;
...

Downside: a lot if fixes in server:

 223 files changed, 1864 insertions(+), 1875 deletions(-)

@blizzzblizzz added the enhancement New feature or request label Nov 6, 2024
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
@blizzz
blizzzforce-pushed the enh/operator_linebreak branch from 1652d37 to abad0dcCompareNovember 6, 2024 11:45

@susnuxsusnux left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Agree! I find this much better readable, as the operator is in the same line as the condition and you do not need to look for it on the previous condition.

@ChristophWurstChristophWurst left a comment

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.

👍 smooth operators

@nickvergessen
nickvergessen merged commit 7b16bcf into masterNov 6, 2024
@nickvergessen
nickvergessen deleted the enh/operator_linebreak branch November 6, 2024 12:30
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancementNew feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@blizzz@nickvergessen@ChristophWurst@susnux