Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions .github/workflows/app-code-check.yml

This file was deleted.

61 changes: 56 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,70 @@ on:
- stable*

jobs:
php-cs-fixer:
runs-on: ubuntu-latest

strategy:
matrix:
php-versions: [7.4]

name: php-cs

steps:
- name: Checkout
uses: actions/checkout@master
- name: Set up php
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php-versions }}
coverage: none
- name: Install dependencies
run: composer i
- name: Run coding standards check
run: composer run cs:check

app-code-check:
runs-on: ubuntu-latest

strategy:
matrix:
php-versions: ['7.2', '7.3', '7.4']
nextcloud-versions: ['master']

name: Nextcloud AppCode check

steps:
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php-versions }}
extensions: ctype,curl,dom,gd,iconv,intl,json,mbstring,openssl,posix,sqlite,xml,zip
coverage: xdebug
- name: Checkout Nextcloud ${{ matrix.nextcloud-versions }}
run: git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b ${{ matrix.nextcloud-versions }} nextcloud
- name: Run tests
run: php -f nextcloud/occ maintenance:install --database-name oc_autotest --database-user oc_autotest --admin-user admin --admin-pass admin --database sqlite --database-pass=''
- name: Checkout
uses: actions/checkout@master
with:
path: nextcloud/apps/mail
- name: Run tests
run: php -f nextcloud/occ app:check-code mail

node:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x]
node-versions: [12.x]

name: eslint node ${{ matrix.node-versions }}
steps:
- uses: actions/checkout@v2
- name: Use node ${{ matrix.node-version }}
- name: Use node ${{ matrix.node-versions }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
node-version: ${{ matrix.node-versions }}
- name: Install dependencies
run: npm ci
- name: ESLint
Expand All @@ -33,14 +84,14 @@ jobs:
matrix:
node-versions: [12.x]

name: stylelint node${{ matrix.node-versions }}
name: stylelint node ${{ matrix.node-versions }}
steps:
- uses: actions/checkout@v2

- name: Set up node ${{ matrix.node-versions }}
uses: actions/setup-node@v1
with:
node-versions: ${{ matrix.node-versions }}
node-version: ${{ matrix.node-versions }}

- name: Install dependencies
run: npm ci
Expand Down
1 change: 1 addition & 0 deletions .php_cs.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"php":"7.4.0","version":"2.16.4:v2.16.4#1023c3458137ab052f6ff1e09621a721bfdeca13","indent":"\t","lineEnding":"\n","rules":{"encoding":true,"full_opening_tag":true,"blank_line_after_namespace":true,"braces":{"position_after_anonymous_constructs":"same","position_after_control_structures":"same","position_after_functions_and_oop_constructs":"same"},"class_definition":true,"constant_case":true,"elseif":true,"function_declaration":{"closure_function_spacing":"one"},"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"no_break_comment":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":true,"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":{"elements":["property","method","const"]},"align_multiline_comment":true,"array_indentation":true,"array_syntax":{"syntax":"short"},"blank_line_after_opening_tag":true,"no_unused_imports":true},"hashes":{"appinfo\\app.php":4283614092,"appinfo\\routes.php":3617738371,"lib\\AppInfo\\Application.php":411266802,"lib\\Controller\\CommentApiController.php":1838790110,"lib\\Controller\\CommentController.php":287678435,"lib\\Controller\\OptionApiController.php":2650695611,"lib\\Controller\\OptionController.php":2698193769,"lib\\Controller\\PageController.php":11149671,"lib\\Controller\\PollApiController.php":4095357940,"lib\\Controller\\PollController.php":1361836821,"lib\\Controller\\PreferencesController.php":1840456828,"lib\\Controller\\ShareApiController.php":2735054074,"lib\\Controller\\ShareController.php":233260947,"lib\\Controller\\SubscriptionApiController.php":3668344078,"lib\\Controller\\SubscriptionController.php":524411373,"lib\\Controller\\SystemController.php":3151042459,"lib\\Controller\\VoteApiController.php":1304499129,"lib\\Controller\\VoteController.php":184787363,"lib\\Cron\\NotificationCron.php":838078031,"lib\\Db\\Comment.php":959534501,"lib\\Db\\CommentMapper.php":488598168,"lib\\Db\\Log.php":467194659,"lib\\Db\\LogMapper.php":731748838,"lib\\Db\\Model.php":1330893510,"lib\\Db\\Option.php":2758206078,"lib\\Db\\OptionMapper.php":2284493626,"lib\\Db\\Poll.php":939114063,"lib\\Db\\PollMapper.php":2726539906,"lib\\Db\\Preferences.php":487756418,"lib\\Db\\PreferencesMapper.php":1210335778,"lib\\Db\\Share.php":557090163,"lib\\Db\\ShareMapper.php":1787427060,"lib\\Db\\Subscription.php":3070850601,"lib\\Db\\SubscriptionMapper.php":184823745,"lib\\Db\\Vote.php":3309199093,"lib\\Db\\VoteMapper.php":2790557761,"lib\\Exceptions\\BadRequestException.php":931432988,"lib\\Exceptions\\DuplicateEntryException.php":2830273467,"lib\\Exceptions\\EmptyTitleException.php":203360807,"lib\\Exceptions\\InvalidAccessException.php":4252219543,"lib\\Exceptions\\InvalidPollTypeException.php":3622042486,"lib\\Exceptions\\InvalidShareType.php":4082190273,"lib\\Exceptions\\InvalidShowResultsException.php":3964362423,"lib\\Exceptions\\InvalidUsername.php":1047919438,"lib\\Exceptions\\NotAuthorizedException.php":1965389984,"lib\\Exceptions\\TooShortException.php":2602737521,"lib\\Exceptions\\UsernameInvalidException.php":4100052390,"lib\\Migration\\Version0009Date20181125051900.php":2716070538,"lib\\Migration\\Version0009Date20181125061900.php":456303295,"lib\\Migration\\Version0009Date20181125062101.php":1154618823,"lib\\Migration\\Version0010Date20191227063812.php":3640377530,"lib\\Migration\\Version0010Date20200119101800.php":3182457632,"lib\\Migration\\Version0101Date20200122194300.php":53872911,"lib\\Migration\\Version0103Date20200130171244.php":1626697525,"lib\\Migration\\Version0104Date20200314074611.php":2104864045,"lib\\Migration\\Version0105Date20200508211943.php":1730649166,"lib\\Migration\\Version0105Date20200523142076.php":2138369535,"lib\\Migration\\Version0105Date20200704084037.php":2068223771,"lib\\Model\\Acl.php":531907010,"lib\\Service\\AnonymizeService.php":3550297122,"lib\\Service\\CalendarService.php":4272559832,"lib\\Service\\CommentService.php":2389208710,"lib\\Service\\LogService.php":2444693224,"lib\\Service\\MailService.php":2918803077,"lib\\Service\\OptionService.php":426529911,"lib\\Service\\PollService.php":655181538,"lib\\Service\\ShareService.php":1935252203,"lib\\Service\\SubscriptionService.php":2286544594,"lib\\Service\\SystemService.php":3406319590,"lib\\Service\\VoteService.php":1188112376,"templates\\no.acc.tmpl.php":1888867333,"templates\\no.create.tmpl.php":3752463492,"templates\\no.delete.tmpl.php":2661558614,"templates\\polls.tmpl.php":1217523484,"tests\\bootstrap.php":664542409,"tests\\Integration\\AppTest.php":612480562,"tests\\Unit\\Controller\\PageControllerTest.php":2027037139,"tests\\Unit\\Db\\CommentMapperTest.php":1274084391,"tests\\Unit\\Db\\OptionMapperTest.php":2678593446,"tests\\Unit\\Db\\PollMapperTest.php":477639475,"tests\\Unit\\Db\\SubscriptionMapperTest.php":3615283060,"tests\\Unit\\Db\\VoteMapperTest.php":4124754083,"tests\\Unit\\Factories\\CommentFactory.php":3727902913,"tests\\Unit\\Factories\\OptionFactory.php":2125760214,"tests\\Unit\\Factories\\PollFactory.php":3091987037,"tests\\Unit\\Factories\\SubscriptionFactory.php":2949916965,"tests\\Unit\\Factories\\VoteFactory.php":1537210955,"tests\\Unit\\FactoryMuffin.php":3610827030,"tests\\Unit\\UnitTestCase.php":604954648,"lib\\Migration\\Version0104Date20200205104800.php":952822163}}
20 changes: 20 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

require_once './vendor/autoload.php';

use Nextcloud\CodingStandard\Config;

$config = new Config();
$config
->getFinder()
->ignoreVCSIgnored(true)
->notPath('build')
->notPath('l10n')
->notPath('lib/Vendor')
->notPath('src')
->notPath('vendor')
->notPath('tests')
->in(__DIR__);
return $config;
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
"christophwurst/nextcloud": "^18.0",
"phpunit/phpunit": "^8.2",
"league/factory-muffin": "^3.0",
"league/factory-muffin-faker": "^2.0"
"league/factory-muffin-faker": "^2.0",
"nextcloud/coding-standard": "^0.3.0"
},
"scripts": {
"cs:check": "php-cs-fixer fix --dry-run --diff",
"cs:fix": "php-cs-fixer fix"
}
}
3 changes: 1 addition & 2 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
namespace OCA\Polls\AppInfo;

use OCP\AppFramework\App;
use OCP\IContainer;

class Application extends App {

Expand All @@ -41,7 +40,7 @@ public function __construct(array $urlParams = []) {
*/
public function registerNavigationEntry() {
$container = $this->getContainer();
$container->query('OCP\INavigationManager')->add(function() use ($container) {
$container->query('OCP\INavigationManager')->add(function () use ($container) {
$urlGenerator = $container->query('OCP\IURLGenerator');
$l10n = $container->query('OCP\IL10N');
return [
Expand Down
5 changes: 0 additions & 5 deletions lib/Controller/CommentApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,16 @@

namespace OCA\Polls\Controller;

use Exception;
use OCP\AppFramework\Db\DoesNotExistException;
use OCA\Polls\Exceptions\NotAuthorizedException;

use OCP\IRequest;
use OCP\IURLGenerator;
use OCP\AppFramework\ApiController;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;

use OCA\Polls\Service\CommentService;



class CommentApiController extends ApiController {

/** @var CommentService */
Expand Down Expand Up @@ -116,5 +112,4 @@ public function delete($commentId) {
return new DataResponse(['error' => $e->getMessage()], $e->getStatus());
}
}

}
4 changes: 0 additions & 4 deletions lib/Controller/CommentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@

use OCA\Polls\Service\CommentService;



class CommentController extends Controller {

/** @var CommentService */
Expand Down Expand Up @@ -101,7 +99,5 @@ public function delete($commentId, $token) {
} catch (DoesNotExistException $e) {
return new DataResponse($e, Http::STATUS_OK);
}

}

}
1 change: 0 additions & 1 deletion lib/Controller/OptionApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

namespace OCA\Polls\Controller;

use \Exception;
use \Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use OCP\AppFramework\Db\DoesNotExistException;
use OCA\Polls\Exceptions\NotAuthorizedException;
Expand Down
3 changes: 0 additions & 3 deletions lib/Controller/OptionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

use DateTime;
use DateInterval;
use Exception;
use OCA\Polls\Exceptions\DuplicateEntryException;

use OCP\IRequest;
Expand All @@ -36,7 +35,6 @@
use OCA\Polls\Service\OptionService;
use OCA\Polls\Service\CalendarService;


class OptionController extends Controller {

/** @var OptionService */
Expand Down Expand Up @@ -149,7 +147,6 @@ public function sequence($optionId, $step, $unit, $amount) {
* @return DataResponse
*/
public function findCalendarEvents($optionId) {

$searchFrom = new DateTime();
$searchFrom = $searchFrom->setTimestamp($this->optionService->get($optionId)->getTimestamp())->sub(new DateInterval('PT1H'));
$searchTo = clone $searchFrom;
Expand Down
6 changes: 0 additions & 6 deletions lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@
use OCP\IRequest;

use OCP\AppFramework\Controller;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Http\Template\PublicTemplateResponse;
use OCP\IURLGenerator;
Expand Down Expand Up @@ -79,7 +75,5 @@ public function votePublic() {
return new PublicTemplateResponse('polls', 'polls.tmpl', [
'urlGenerator' => $this->urlGenerator]);
}

}

}
Loading