-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial version of the GEWISPHP Coding Standards
These are heavily based on the Doctrine and Slevomat Coding Standards. Also includes a GitHub Action that can be re-used across projects.
- Loading branch information
0 parents
commit d687ca8
Showing
9 changed files
with
1,163 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* text=auto eol=lf | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: PHP Coding Standards | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
php-version: | ||
description: 'The PHP version to use when running the job' | ||
default: '8.2' | ||
required: false | ||
type: 'string' | ||
|
||
jobs: | ||
php-codesniffer: | ||
name: PHP_CodeSniffer | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
php-version: | ||
- '${{ inputs.php-version }}' | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '${{ matrix.php-version }}' | ||
tools: cs2pr | ||
|
||
- name: Install dependencies with Composer | ||
uses: ramsey/composer-install@v2 | ||
|
||
- name: Run PHP_CS | ||
run: vendor/bin/phpcs --no-colors --report=checkstyle -q | cs2pr --graceful-warnings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
vendor/ | ||
phpcs.log | ||
phpcs.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2013 Steve Müller | ||
Copyright (c) 2023 Gemeenschap van Wiskunde en Informatica Studenten | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# GEWISPHP Coding Standards | ||
|
||
The GEWISPHP Coding Standard is a set of [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) rules that are applied to all PHP projects of Study Association GEWIS. These standards are heavily based on the [Doctrine Coding Standard](https://github.com/doctrine/coding-standard) and the [Slevomat Coding Standard](https://github.com/slevomat/coding-standard). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "gewis/gewisphp-coding-standards", | ||
"type": "phpcodesniffer-standard", | ||
"description": "The GEWISPHP Coding Standard is a set of PHP_CS rules that are applied to PHP projects of Study Association GEWIS.", | ||
"keywords": [ | ||
"gewis", | ||
"coding", | ||
"standard" | ||
], | ||
"homepage": "https://github.com/GEWIS/gewisphp-coding-standards", | ||
"license": "MIT", | ||
"require": { | ||
"php": "^8.2", | ||
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0", | ||
"slevomat/coding-standard": "^8.11", | ||
"squizlabs/php_codesniffer": "^3.7.0" | ||
}, | ||
"config": { | ||
"allow-plugins": { | ||
"dealerdirect/phpcodesniffer-composer-installer": true | ||
}, | ||
"sort-packages": true | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"GEWISPHPCodingStandards\\": "src/GEWISPHPCodingStandards/" | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ruleset | ||
name="PHP_CS Coding Standards for gewis/gewisphp-coding-standards" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd" | ||
> | ||
<description>The PHP_CS standard for gewis/gewisphp-coding-standards itself.</description> | ||
|
||
<arg name="basepath" value="." /> | ||
<arg name="colors" /> | ||
<arg name="error-severity" value="1" /> | ||
<arg name="extensions" value="php" /> | ||
<arg name="parallel" value="8" /> | ||
<arg name="warning-severity" value="1" /> | ||
|
||
<arg value="nps" /> | ||
|
||
<file>src</file> | ||
|
||
<rule ref="GEWISPHPCodingStandards" /> | ||
</ruleset> |
Oops, something went wrong.