Skip to content

Commit 9db6d54

Browse files
add cs
1 parent bf9f419 commit 9db6d54

File tree

12 files changed

+214
-77
lines changed

12 files changed

+214
-77
lines changed

.github/workflows/lint-php-cs.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
6+
name: Lint php-cs
7+
8+
on: pull_request
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: lint-php-cs-${{ github.head_ref || github.run_id }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
lint:
19+
runs-on: self-hosted
20+
21+
name: php-cs
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
26+
27+
- name: Set up php
28+
uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d # v2
29+
with:
30+
php-version: 8.1
31+
coverage: none
32+
ini-file: development
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Install dependencies
37+
run: composer i
38+
39+
- name: Lint
40+
run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )

.php-cs-fixer.cache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"php":"8.3.2","version":"3.49.0","indent":"\t","lineEnding":"\n","rules":{"encoding":true,"full_opening_tag":true,"blank_line_after_namespace":true,"braces_position":true,"class_definition":true,"constant_case":true,"control_structure_braces":true,"control_structure_continuation_position":true,"elseif":true,"function_declaration":{"closure_function_spacing":"one"},"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ignore"},"no_break_comment":true,"no_closing_tag":true,"no_multiple_statements_per_line":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":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,"spaces_inside_parentheses":true,"statement_indentation":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":true,"binary_operator_spaces":{"default":"single_space"},"blank_line_after_opening_tag":true,"curly_braces_position":{"classes_opening_brace":"same_line","functions_opening_brace":"same_line"},"list_syntax":true,"no_leading_import_slash":true,"no_spaces_inside_parenthesis":true,"no_unused_imports":true,"nullable_type_declaration_for_default_null_value":true,"ordered_imports":{"imports_order":["class","function","const"],"sort_algorithm":"alpha"},"yoda_style":{"equal":false,"identical":false,"less_and_greater":false}},"hashes":{"appinfo\/routes.php":"79bcdccfabfe54c0df0baea844b48ee4","lib\/Controller\/GroceryListController.php":"def791ca24cf5f2e34af55826b1ed464","lib\/Db\/Category.php":"a5c68adfa19c127fbc9feef6b88cf895","lib\/Db\/CategoryMapper.php":"1cd303433beeab312720ef81d189ad4c","lib\/Db\/GroceryList.php":"7bd681e52f1e8282bb973d53f59dc966","lib\/Db\/GroceryListMapper.php":"65ee2eb3d72a15259c82fc3077fa6610","lib\/Db\/Item.php":"4469d2df5dd2b05b9227ec96c4210537","lib\/Db\/Sharee.php":"7654847c2162f0a6b3b951d5073a5e60","lib\/Db\/ItemMapper.php":"66cd13910ba9337251ed0096c95dbb62","lib\/Db\/ShareeGroceryListMapper.php":"e162ee885f07ce040ee5e68aa075cd3f","lib\/Migration\/Version000000Date20200604211400.php":"e39f6e7eff9ed0bcecfc7cbb137e196c","templates\/main.php":"245a35b8c13e475da18807c6caaf6475"}}

.php-cs-fixer.dist.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
require_once './vendor/autoload.php';
6+
7+
use Nextcloud\CodingStandard\Config;
8+
9+
$config = new Config();
10+
$config
11+
->getFinder()
12+
->ignoreVCSIgnored(true)
13+
->notPath('build')
14+
->notPath('l10n')
15+
->notPath('src')
16+
->notPath('lib/Vendor')
17+
->notPath('vendor')
18+
->notPath('vendor-bin')
19+
->in(__DIR__);
20+
return $config;

appinfo/routes.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
return [
34
'routes' => [
45
['name' => 'GroceryList#showGroceryList', 'url' => '/list/{id}', 'verb' => 'GET'],

composer.json

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
{
2-
"name": "tobiaskaminsky/grocery_list-0.1",
3-
"description": "Grocery list for Nextcloud",
4-
"type": "project",
5-
"license": "AGPL",
6-
"authors": [
7-
{
8-
"name": "Tobias Kaminsky"
9-
}
10-
],
11-
"require": {},
12-
"require-dev": {
2+
"name": "tobiaskaminsky/grocery_list-0.1",
3+
"description": "Grocery list for Nextcloud",
4+
"type": "project",
5+
"license": "AGPL",
6+
"authors": [
7+
{
8+
"name": "Tobias Kaminsky"
139
}
10+
],
11+
"require": {},
12+
"require-dev": {
13+
"nextcloud/coding-standard": "^1.1.1"
14+
},
15+
"scripts": {
16+
"lint": "find . -name \\*.php -not -path './vendor/*' -not -path './build/*' -print0 | xargs -0 -n1 php -l",
17+
"cs:fix": "php-cs-fixer fix",
18+
"cs:check": "php-cs-fixer fix --dry-run --diff"
19+
}
1420
}

composer.lock

Lines changed: 97 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)