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

Remove space indent exceptions #19609

Merged
merged 5 commits into from
Feb 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ protected function getOptions()
$itemId = (int) $associations[$language->lang_code]['id'];
$options[$langCode]->value = $language->lang_code . ':' . $itemId . ':edit';

// Check if user does have permission to edit the associated item.
// Check if user does have permission to edit the associated item.
$canEdit = AssociationsHelper::allowEdit($extensionName, $typeName, $itemId);

// Check if item can be checked out
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
});"
);
?>
<form action="<?php echo JRoute::_('index.php?option=com_associations&view=associations&layout=modal&tmpl=component&function=' . $function . '&' . JSession::getFormToken() . '=1');
?>" method="post" name="adminForm" id="adminForm">
<form action="<?php echo JRoute::_('index.php?option=com_associations&view=associations&layout=modal&tmpl=component&function='
. $function . '&' . JSession::getFormToken() . '=1'); ?>" method="post" name="adminForm" id="adminForm">

<?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_menus/controllers/item.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ public function save($key = null, $urlVar = null)
$segments = explode(':', $data['link']);
$protocol = strtolower($segments[0]);
$scheme = array('http', 'https', 'ftp', 'ftps', 'gopher', 'mailto', 'news', 'prospero', 'telnet', 'rlogin', 'tn3270', 'wais','mid', 'cid', 'nntp',
'tel', 'urn', 'ldap', 'file', 'fax', 'modem', 'git', 'sms');
'tel', 'urn', 'ldap', 'file', 'fax', 'modem', 'git', 'sms');
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure about the indentation here.

Copy link
Contributor

Choose a reason for hiding this comment

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

The tab is ok here but can we please also add a new line after 'news', @photodude ? So in the end we get three lines for the array?

Copy link
Contributor Author

@photodude photodude Feb 8, 2018

Choose a reason for hiding this comment

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

Where would you expect the alignment if each array term was on their own line?
I believe it would be aligning to someplace close to the ( on the following lines after $scheme = array('h...

So we should be correct. It looks visually correct to me.
Note: I have not verified the alignment with the PHPCS2 code style checks. I just did this as a quick edit with the github web editor.

Since drone is not currently complaining, I would suggest this is correct.
Additionally, we can adjust it if necessary as we finalize the move to PHPCS2/3.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zero-24 It's a bit out of scope, but we can add the final new line and the ending coma for the array list.

Generally, I try to avoid going beyond the scope of these narrow CS PRs. Fix one file/folder group or fix one type of error.

I think this is worth adding as a fix here as long as we try to keep additional changes to a minimum. (like just this one case in this file and not every case)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, Future PR for the array multiple line style... Thanks for the merge and review everyone

Copy link
Contributor

Choose a reason for hiding this comment

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

PR is here: #19610


if (!in_array($protocol, $scheme))
{
Expand Down
7 changes: 1 addition & 6 deletions build/phpcs/Joomla/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,7 @@
<rule ref="Generic.PHP.DeprecatedFunctions" />
<rule ref="Generic.PHP.ForbiddenFunctions"/>
<rule ref="Generic.PHP.LowerCaseConstant" />
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent">
<!-- These exceptions are temporary for now -->
<exclude-pattern type="relative">administrator/components/*</exclude-pattern>
<exclude-pattern type="relative">components/*</exclude-pattern>
<exclude-pattern type="relative">libraries/cms/*</exclude-pattern>
</rule>
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent" />

<!-- Include some additional sniffs from the PEAR standard -->
<rule ref="PEAR.Classes.ClassDeclaration" />
Expand Down
2 changes: 1 addition & 1 deletion components/com_content/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{
// Can create in any category (component permission) or at least in one category
$canCreateRecords = $user->authorise('core.create', 'com_content')
|| count($user->getAuthorisedCategories('com_content', 'core.create')) > 0;
|| count($user->getAuthorisedCategories('com_content', 'core.create')) > 0;

// Instead of checking edit on all records, we can use **same** check as the form editing view
$values = (array) JFactory::getApplication()->getUserState('com_content.edit.article.id');
Expand Down