Skip to content

Commit

Permalink
add cs
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasKaminsky committed Sep 19, 2024
1 parent 78f5563 commit e1317e2
Show file tree
Hide file tree
Showing 12 changed files with 212 additions and 74 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/lint-php-cs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization

name: Lint php-cs

on: pull_request

permissions:
contents: read

concurrency:
group: lint-php-cs-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
lint:
runs-on: self-hosted

name: php-cs

steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2

- name: Set up php
uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d # v2
with:
php-version: 8.1
coverage: none
ini-file: development
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies
run: composer i

- name: Lint
run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )
1 change: 1 addition & 0 deletions .php-cs-fixer.cache
Original file line number Diff line number Diff line change
@@ -0,0 +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"}}
20 changes: 20 additions & 0 deletions .php-cs-fixer.dist.php
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('src')
->notPath('lib/Vendor')
->notPath('vendor')
->notPath('vendor-bin')
->in(__DIR__);
return $config;
1 change: 1 addition & 0 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

return [
'routes' => [
['name' => 'GroceryList#showGroceryList', 'url' => '/list/{id}', 'verb' => 'GET'],
Expand Down
28 changes: 17 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
{
"name": "tobiaskaminsky/grocery_list-0.1",
"description": "Grocery list for Nextcloud",
"type": "project",
"license": "AGPL",
"authors": [
{
"name": "Tobias Kaminsky"
}
],
"require": {},
"require-dev": {
"name": "tobiaskaminsky/grocery_list-0.1",
"description": "Grocery list for Nextcloud",
"type": "project",
"license": "AGPL",
"authors": [
{
"name": "Tobias Kaminsky"
}
],
"require": {},
"require-dev": {
"nextcloud/coding-standard": "^1.1.1"
},
"scripts": {
"lint": "find . -name \\*.php -not -path './vendor/*' -not -path './build/*' -print0 | xargs -0 -n1 php -l",
"cs:fix": "php-cs-fixer fix",
"cs:check": "php-cs-fixer fix --dry-run --diff"
}
}
98 changes: 96 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e1317e2

Please sign in to comment.