File tree Expand file tree Collapse file tree 5 files changed +219
-4
lines changed Expand file tree Collapse file tree 5 files changed +219
-4
lines changed Original file line number Diff line number Diff line change
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
+ # SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
7
+ # SPDX-License-Identifier: MIT
8
+
9
+ name : Lint php-cs
10
+
11
+ on :
12
+ pull_request :
13
+ paths :
14
+ - ' php/**'
15
+ push :
16
+ branches :
17
+ - main
18
+ paths :
19
+ - ' php/**'
20
+
21
+ permissions :
22
+ contents : read
23
+
24
+ concurrency :
25
+ group : lint-php-cs-${{ github.head_ref || github.run_id }}
26
+ cancel-in-progress : true
27
+
28
+ jobs :
29
+ lint :
30
+ runs-on : ubuntu-latest
31
+ strategy :
32
+ matrix :
33
+ php-versions : [ "8.3" ]
34
+
35
+ name : php-cs
36
+
37
+ steps :
38
+ - name : Checkout
39
+ uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
40
+
41
+ - name : Set up php ${{ matrix.php-versions }}
42
+ uses : shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2
43
+ with :
44
+ php-version : ${{ matrix.php-versions }}
45
+ coverage : none
46
+ ini-file : development
47
+
48
+ - name : Install dependencies
49
+ run : cd php && composer i
50
+
51
+ - name : Lint
52
+ run : cd php && composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )
Original file line number Diff line number Diff line change 6
6
/php /session /*
7
7
! /php /data /.gitkeep
8
8
! /php /session /.gitkeep
9
- /php /vendor
9
+ /php /vendor /
10
+ /php /.php-cs-fixer.cache
10
11
11
12
/manual-install /* .conf
12
13
! /manual-install /sample.conf
Original file line number Diff line number Diff line change
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 ('data ' )
14
+ ->notPath ('session ' )
15
+ ->notPath ('public ' )
16
+ ->notPath ('vendor ' )
17
+ ->in (__DIR__ );
18
+ return $ config ;
Original file line number Diff line number Diff line change 21
21
"require-dev" : {
22
22
"sserbin/twig-linter" : " @dev" ,
23
23
"vimeo/psalm" : " ^5.25" ,
24
- "wapmorgan/php-deprecation-detector" : " dev-master"
24
+ "wapmorgan/php-deprecation-detector" : " dev-master" ,
25
+ "nextcloud/coding-standard" : " ^1.3" ,
26
+ "friendsofphp/php-cs-fixer" : " ^3"
25
27
},
26
28
"scripts" : {
27
- "dev" : [
29
+ "dev" : [
28
30
" Composer\\ Config::disableProcessTimeout" ,
29
31
" php -S localhost:8080 -t public"
30
32
],
33
35
"psalm:strict" : " psalm --threads=1 --show-info=true" ,
34
36
"lint" : " php -l src/*.php src/**/*.php public/index.php" ,
35
37
"lint:twig" : " twig-linter lint ./templates" ,
38
+ "cs:check" : " php-cs-fixer fix --dry-run --diff" ,
39
+ "cs:fix" : " php-cs-fixer fix" ,
36
40
"php-deprecation-detector" : " phpdd scan -n -t 8.3 src/*.php src/**/*.php public/index.php"
37
41
}
38
42
}
You can’t perform that action at this time.
0 commit comments