Updating to use Drone and newest codestyle

This commit is contained in:
Hannes Papenberg 2019-10-13 10:12:37 +02:00
parent b51368529a
commit e9baadd522
9 changed files with 187 additions and 72 deletions

27
.drone.yml Normal file
View File

@ -0,0 +1,27 @@
---
kind: pipeline
name: default
clone:
depth: 42
steps:
- name: composer
image: joomlaprojects/docker-tools:develop
commands:
- composer validate --no-check-all --strict
- composer install --no-progress --no-suggest
- name: phpcs
image: joomlaprojects/docker-images:php7.2
commands:
- echo $(date)
- ./administrator/components/com_patchtester/vendor/bin/phpcs --extensions=php -p --ignore=administrator/components/com_patchtester/vendor --standard=administrator/components/com_patchtester/vendor/joomla/cms-coding-standards/lib/Joomla-CMS administrator
- echo $(date)
- name: crowdin
image: joomlaprojects/docker-images:php7.2
commands:
- echo $(date)
- ./administrator/components/com_patchtester/vendor/bin/crowdin --upload
- echo $(date)

View File

@ -100,18 +100,19 @@ class DisplayController extends AbstractController
protected function initializeState(AbstractModel $model)
{
$state = parent::initializeState($model);
$app = $this->getApplication();
// Load the filter state.
$state->set('filter.search', $this->getApplication()->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', ''));
$state->set('filter.applied', $this->getApplication()->getUserStateFromRequest($this->context . '.filter.applied', 'filter_applied', ''));
$state->set('filter.branch', $this->getApplication()->getUserStateFromRequest($this->context . '.filter.branch', 'filter_branch', ''));
$state->set('filter.rtc', $this->getApplication()->getUserStateFromRequest($this->context . '.filter.rtc', 'filter_rtc', ''));
$state->set('filter.search', $app->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', ''));
$state->set('filter.applied', $app->getUserStateFromRequest($this->context . '.filter.applied', 'filter_applied', ''));
$state->set('filter.branch', $app->getUserStateFromRequest($this->context . '.filter.branch', 'filter_branch', ''));
$state->set('filter.rtc', $app->getUserStateFromRequest($this->context . '.filter.rtc', 'filter_rtc', ''));
// Pre-fill the limits.
$limit = $this->getApplication()->getUserStateFromRequest('global.list.limit', 'limit', $this->getApplication()->get('list_limit', 20), 'uint');
$limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->get('list_limit', 20), 'uint');
$state->set('list.limit', $limit);
$fullOrdering = $this->getApplication()->getUserStateFromRequest($this->context . '.fullorder', 'list_fullordering', $this->defaultFullOrdering);
$fullOrdering = $app->getUserStateFromRequest($this->context . '.fullorder', 'list_fullordering', $this->defaultFullOrdering);
$orderingParts = explode(' ', $fullOrdering);
@ -140,7 +141,7 @@ class DisplayController extends AbstractController
$state->set('list.ordering', $ordering);
}
$value = $this->getApplication()->getUserStateFromRequest($this->context . '.limitstart', 'limitstart', 0);
$value = $app->getUserStateFromRequest($this->context . '.limitstart', 'limitstart', 0);
$limitstart = ($limit != 0 ? (floor($value / $limit) * $limit) : 0);
$state->set('list.start', $limitstart);

View File

@ -247,7 +247,11 @@ class PullModel extends AbstractModel
}
catch (UnexpectedResponse $e)
{
throw new \RuntimeException(Text::sprintf('COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB', $e->getMessage()), $e->getCode(), $e);
throw new \RuntimeException(
Text::sprintf('COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB', $e->getMessage()),
$e->getCode(),
$e
);
}
break;
@ -293,7 +297,9 @@ class PullModel extends AbstractModel
case 'renamed':
if (!File::delete(Path::clean(JPATH_ROOT . '/' . $file->originalFile)))
{
throw new \RuntimeException(Text::sprintf('COM_PATCHTESTER_ERROR_CANNOT_DELETE_FILE', JPATH_ROOT . '/' . $file->originalFile));
throw new \RuntimeException(
Text::sprintf('COM_PATCHTESTER_ERROR_CANNOT_DELETE_FILE', JPATH_ROOT . '/' . $file->originalFile)
);
}
if (!File::write(Path::clean(JPATH_ROOT . '/' . $file->filename), $file->body))

View File

@ -95,7 +95,7 @@ class PullsModel extends AbstractModel
}
// Load the list items and add the items to the internal cache.
$this->cache[$store] = $this->_getList($this->_getListQuery(), $this->getStart(), $this->getState()->get('list.limit'));
$this->cache[$store] = $this->getList($this->getListQueryCache(), $this->getStart(), $this->getState()->get('list.limit'));
return $this->cache[$store];
}
@ -293,7 +293,7 @@ class PullsModel extends AbstractModel
}
// Load the total and add the total to the internal cache.
$this->cache[$store] = (int) $this->_getListCount($this->_getListQuery());
$this->cache[$store] = (int) $this->getListCount($this->getListQueryCache());
return $this->cache[$store];
}
@ -452,7 +452,7 @@ class PullsModel extends AbstractModel
* @since 2.0
* @throws RuntimeException
*/
protected function _getList($query, $limitstart = 0, $limit = 0)
protected function getList($query, $limitstart = 0, $limit = 0)
{
return $this->getDb()->setQuery($query, $limitstart, $limit)->loadObjectList();
}
@ -466,7 +466,7 @@ class PullsModel extends AbstractModel
*
* @since 2.0
*/
protected function _getListCount($query)
protected function getListCount($query)
{
// Use fast COUNT(*) on JDatabaseQuery objects if there no GROUP BY or HAVING clause:
if ($query instanceof \JDatabaseQuery && $query->type == 'select' && $query->group === null && $query->having === null)
@ -494,7 +494,7 @@ class PullsModel extends AbstractModel
*
* @since 2.0
*/
protected function _getListQuery()
protected function getListQueryCache()
{
// Capture the last store id used.
static $lastStoreId;

View File

@ -92,15 +92,15 @@ $filterRtc = $this->escape($this->state->get('filter.rtc'));
<div class="js-stools-field-filter">
<select name="filter_applied" class="custom-select" onchange="this.form.submit();">
<option value=""><?php echo Text::_('COM_PATCHTESTER_FILTER_APPLIED_PATCHES'); ?></option>
<option value="yes"<?php if ($filterApplied == 'yes') echo ' selected="selected"'; ?>><?php echo Text::_('COM_PATCHTESTER_APPLIED'); ?></option>
<option value="no"<?php if ($filterApplied == 'no') echo ' selected="selected"'; ?>><?php echo Text::_('COM_PATCHTESTER_NOT_APPLIED'); ?></option>
<option value="yes"<?php echo $filterApplied == 'yes' ? ' selected="selected"' : ''; ?>><?php echo Text::_('COM_PATCHTESTER_APPLIED'); ?></option>
<option value="no"<?php echo $filterApplied == 'no' ? ' selected="selected"' : ''; ?>><?php echo Text::_('COM_PATCHTESTER_NOT_APPLIED'); ?></option>
</select>
</div>
<div class="js-stools-field-filter">
<select name="filter_rtc" class="custom-select" onchange="this.form.submit();">
<option value=""><?php echo Text::_('COM_PATCHTESTER_FILTER_RTC_PATCHES'); ?></option>
<option value="yes"<?php if ($filterRtc == 'yes') echo ' selected="selected"'; ?>><?php echo Text::_('COM_PATCHTESTER_RTC'); ?></option>
<option value="no"<?php if ($filterRtc == 'no') echo ' selected="selected"'; ?>><?php echo Text::_('COM_PATCHTESTER_NOT_RTC'); ?></option>
<option value="yes"<?php echo $filterRtc == 'yes' ? ' selected="selected"' : ''; ?>><?php echo Text::_('COM_PATCHTESTER_RTC'); ?></option>
<option value="no"<?php echo $filterRtc == 'no' ? ' selected="selected"' : ''; ?>><?php echo Text::_('COM_PATCHTESTER_NOT_RTC'); ?></option>
</select>
</div>
<div class="js-stools-field-filter">

View File

@ -56,7 +56,7 @@ foreach ($this->items as $i => $item) :
</td>
<td class="text-center">
<?php if ($item->applied) : ?>
<span class="badge badge-success"><?php echo Text::_('COM_PATCHTESTER_APPLIED'); ?></span>
<span class="badge badge-success"><?php echo Text::_('COM_PATCHTESTER_APPLIED'); ?></span>
<?php else : ?>
<span class="badge badge-secondary"><?php echo Text::_('COM_PATCHTESTER_NOT_APPLIED'); ?></span>
<?php endif; ?>

@ -1 +0,0 @@
Subproject commit 92233693cc8cf9634e00b8bc13b56c787d5f0871

View File

@ -14,7 +14,9 @@
"require-dev": {
"php": "^5.6|^7.0",
"joomla/crowdin-sync": "dev-master",
"squizlabs/php_codesniffer": "~1.5"
"joomla/cms-coding-standards": "~2.0.0-alpha2@dev",
"joomla/coding-standards": "~3.0@dev",
"squizlabs/php_codesniffer": "~3.0"
},
"autoload": {
"psr-4": {

182
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "35e372f08cd218b7040fd37d8e7dcaeb",
"content-hash": "8d399762bedfc6b5beec9b2d9b469030",
"packages": [],
"packages-dev": [
{
@ -332,6 +332,108 @@
],
"time": "2019-03-28T14:55:36+00:00"
},
{
"name": "joomla/cms-coding-standards",
"version": "2.0.0-alpha2",
"source": {
"type": "git",
"url": "https://github.com/joomla/cms-coding-standards.git",
"reference": "25abae52f9167fa47ce57331bbece8079ad27ab3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/joomla/cms-coding-standards/zipball/25abae52f9167fa47ce57331bbece8079ad27ab3",
"reference": "25abae52f9167fa47ce57331bbece8079ad27ab3",
"shasum": ""
},
"require": {
"joomla/coding-standards": "~2.0 || ~3.0",
"php": ">=5.3.10"
},
"require-dev": {
"phpunit/phpunit": "^4.8.7"
},
"suggest": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically."
},
"type": "phpcodesniffer-standard",
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"Joomla-CMS\\Sniffs\\": "lib/Joomla-CMS/Sniffs"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-2.0-or-later"
],
"authors": [
{
"name": "Joomla Coding Standards Contributors",
"homepage": "https://github.com/joomla/cms-coding-standards/graphs/contributors"
}
],
"description": "Extended Joomla Coding Standards for the Joomla CMS application",
"homepage": "https://github.com/joomla/cms-coding-standards",
"keywords": [
"coding standards",
"joomla",
"php codesniffer",
"phpcs"
],
"time": "2019-07-13T18:56:54+00:00"
},
{
"name": "joomla/coding-standards",
"version": "dev-3.x-dev",
"source": {
"type": "git",
"url": "https://github.com/joomla/coding-standards.git",
"reference": "fc041ba4352689d0834fc3f6bce14edc6e40aebe"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/joomla/coding-standards/zipball/fc041ba4352689d0834fc3f6bce14edc6e40aebe",
"reference": "fc041ba4352689d0834fc3f6bce14edc6e40aebe",
"shasum": ""
},
"require": {
"php": ">=5.4.0",
"squizlabs/php_codesniffer": "^3.4"
},
"require-dev": {
"phpunit/phpunit": "^4.8.7"
},
"type": "phpcodesniffer-standard",
"extra": {
"branch-alias": {
"dev-3.x-dev": "3.0-dev"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-2.0-or-later"
],
"authors": [
{
"name": "Joomla Coding Standards Contributors",
"homepage": "https://github.com/joomla/coding-standards/graphs/contributors"
}
],
"description": "Joomla Coding Standards",
"homepage": "https://github.com/joomla/coding-standards",
"keywords": [
"coding standards",
"joomla",
"php codesniffer",
"phpcs"
],
"time": "2019-07-12T10:04:53+00:00"
},
{
"name": "joomla/compat",
"version": "1.2.0",
@ -375,12 +477,12 @@
"source": {
"type": "git",
"url": "https://github.com/joomla-projects/crowdin-sync.git",
"reference": "8a61f12161b30ff4aa0402ad0dccd599b38714af"
"reference": "c1db9d2186a273b66297f4fbf239bbc06b70a9fb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/joomla-projects/crowdin-sync/zipball/8a61f12161b30ff4aa0402ad0dccd599b38714af",
"reference": "8a61f12161b30ff4aa0402ad0dccd599b38714af",
"url": "https://api.github.com/repos/joomla-projects/crowdin-sync/zipball/c1db9d2186a273b66297f4fbf239bbc06b70a9fb",
"reference": "c1db9d2186a273b66297f4fbf239bbc06b70a9fb",
"shasum": ""
},
"require": {
@ -401,7 +503,7 @@
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-2.0+"
"GPL-2.0-or-later"
],
"description": "CLI application to synchronize a project with Crowdin",
"homepage": "https://github.com/joomla-projects/crowdin-sync",
@ -409,7 +511,7 @@
"crowdin",
"joomla"
],
"time": "2019-03-29T12:07:12+00:00"
"time": "2019-09-10T14:24:41+00:00"
},
{
"name": "joomla/filter",
@ -812,61 +914,37 @@
},
{
"name": "squizlabs/php_codesniffer",
"version": "1.5.6",
"version": "3.5.0",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "6f3e42d311b882b25b4d409d23a289f4d3b803d5"
"reference": "0afebf16a2e7f1e434920fa976253576151effe9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/6f3e42d311b882b25b4d409d23a289f4d3b803d5",
"reference": "6f3e42d311b882b25b4d409d23a289f4d3b803d5",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/0afebf16a2e7f1e434920fa976253576151effe9",
"reference": "0afebf16a2e7f1e434920fa976253576151effe9",
"shasum": ""
},
"require": {
"ext-simplexml": "*",
"ext-tokenizer": "*",
"php": ">=5.1.2"
"ext-xmlwriter": "*",
"php": ">=5.4.0"
},
"suggest": {
"phpunit/php-timer": "dev-master"
"require-dev": {
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
},
"bin": [
"scripts/phpcs"
"bin/phpcs",
"bin/phpcbf"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-phpcs-fixer": "2.0.x-dev"
"dev-master": "3.x-dev"
}
},
"autoload": {
"classmap": [
"CodeSniffer.php",
"CodeSniffer/CLI.php",
"CodeSniffer/Exception.php",
"CodeSniffer/File.php",
"CodeSniffer/Report.php",
"CodeSniffer/Reporting.php",
"CodeSniffer/Sniff.php",
"CodeSniffer/Tokens.php",
"CodeSniffer/Reports/",
"CodeSniffer/CommentParser/",
"CodeSniffer/Tokenizers/",
"CodeSniffer/DocGenerators/",
"CodeSniffer/Standards/AbstractPatternSniff.php",
"CodeSniffer/Standards/AbstractScopeSniff.php",
"CodeSniffer/Standards/AbstractVariableSniff.php",
"CodeSniffer/Standards/IncorrectPatternException.php",
"CodeSniffer/Standards/Generic/Sniffs/",
"CodeSniffer/Standards/MySource/Sniffs/",
"CodeSniffer/Standards/PEAR/Sniffs/",
"CodeSniffer/Standards/PSR1/Sniffs/",
"CodeSniffer/Standards/PSR2/Sniffs/",
"CodeSniffer/Standards/Squiz/Sniffs/",
"CodeSniffer/Standards/Zend/Sniffs/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
@ -877,13 +955,13 @@
"role": "lead"
}
],
"description": "PHP_CodeSniffer tokenises PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
"homepage": "http://www.squizlabs.com/php-codesniffer",
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
"homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
"keywords": [
"phpcs",
"standards"
],
"time": "2014-12-04T22:32:15+00:00"
"time": "2019-09-26T23:12:26+00:00"
},
{
"name": "symfony/polyfill-ctype",
@ -1001,16 +1079,16 @@
},
{
"name": "symfony/yaml",
"version": "v3.4.31",
"version": "v3.4.32",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "3dc414b7db30695bae671a1d86013d03f4ae9834"
"reference": "768f817446da74a776a31eea335540f9dcb53942"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/3dc414b7db30695bae671a1d86013d03f4ae9834",
"reference": "3dc414b7db30695bae671a1d86013d03f4ae9834",
"url": "https://api.github.com/repos/symfony/yaml/zipball/768f817446da74a776a31eea335540f9dcb53942",
"reference": "768f817446da74a776a31eea335540f9dcb53942",
"shasum": ""
},
"require": {
@ -1056,13 +1134,15 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2019-08-20T13:31:17+00:00"
"time": "2019-09-10T10:38:46+00:00"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
"joomla/crowdin-sync": 20
"joomla/crowdin-sync": 20,
"joomla/cms-coding-standards": 20,
"joomla/coding-standards": 20
},
"prefer-stable": false,
"prefer-lowest": false,