Skip to content
This repository was archived by the owner on Dec 15, 2024. It is now read-only.

Commit 1cc47bf

Browse files
committed
Initial commit
0 parents  commit 1cc47bf

File tree

9 files changed

+279
-0
lines changed

9 files changed

+279
-0
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
indent_style = space
8+
indent_size = 4
9+
end_of_line = lf
10+
charset = utf-8
11+
trim_trailing_whitespace = true
12+
insert_final_newline = false

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/vendor/
2+
/composer.phar
3+
/composer.lock

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and
7+
[Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
8+
9+
## [Unreleased]
10+
11+
## [1.0.0] - 2021-08-13
12+
13+
### Added
14+
15+
- `SCS1` SPIP Coding Standard Ruleset
16+
- `SPIP40` PHP Compatibility Ruleset, including SCS1, for SPIP 4.0

CONTRIBUTING.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Contributing
2+
3+
When contributing to this repository, please first discuss the change you wish to make via issue,
4+
email, or any other method with the owners of this repository before making a change.
5+
6+
Please note we have a code of conduct, please follow it in all your interactions with the project.
7+
8+
## Pull Request Process
9+
10+
1. Update the CHANGELOG.md and README.md with details of changes to the interface, this includes new filters, models, etc.
11+
2. Increase the version numbers in any examples files and the CHANGELOG to the new version that this
12+
Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
13+
3. You may merge the Pull Request in once you have the sign-off of at least one other developer, or if you
14+
do not have permission to do that, you may request a second reviewer to merge it for you.
15+
16+
## Contributor Covenant Code of Conduct
17+
18+
### Our Pledge
19+
20+
We as members, contributors, and leaders pledge to make participation in our
21+
community a harassment-free experience for everyone, regardless of age, body
22+
size, visible or invisible disability, ethnicity, sex characteristics, gender
23+
identity and expression, level of experience, education, socio-economic status,
24+
nationality, personal appearance, race, caste, color, religion, or sexual identity
25+
and orientation.
26+
27+
We pledge to act and interact in ways that contribute to an open, welcoming,
28+
diverse, inclusive, and healthy community.
29+
30+
### Our Standards
31+
32+
Examples of behavior that contributes to a positive environment for our
33+
community include:
34+
35+
* Demonstrating empathy and kindness toward other people
36+
* Being respectful of differing opinions, viewpoints, and experiences
37+
* Giving and gracefully accepting constructive feedback
38+
* Accepting responsibility and apologizing to those affected by our mistakes,
39+
and learning from the experience
40+
* Focusing on what is best not just for us as individuals, but for the
41+
overall community
42+
43+
Examples of unacceptable behavior include:
44+
45+
* The use of sexualized language or imagery, and sexual attention or
46+
advances of any kind
47+
* Trolling, insulting or derogatory comments, and personal or political attacks
48+
* Public or private harassment
49+
* Publishing others' private information, such as a physical or email
50+
address, without their explicit permission
51+
* Other conduct which could reasonably be considered inappropriate in a
52+
professional setting
53+
54+
### Enforcement Responsibilities
55+
56+
Community leaders are responsible for clarifying and enforcing our standards of
57+
acceptable behavior and will take appropriate and fair corrective action in
58+
response to any behavior that they deem inappropriate, threatening, offensive,
59+
or harmful.
60+
61+
Community leaders have the right and responsibility to remove, edit, or reject
62+
comments, commits, code, wiki edits, issues, and other contributions that are
63+
not aligned to this Code of Conduct, and will communicate reasons for moderation
64+
decisions when appropriate.
65+
66+
### Scope
67+
68+
This Code of Conduct applies within all community spaces, and also applies when
69+
an individual is officially representing the community in public spaces.
70+
Examples of representing our community include using an official e-mail address,
71+
posting via an official social media account, or acting as an appointed
72+
representative at an online or offline event.
73+
74+
### Attribution
75+
76+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
77+
version 2.0, available at
78+
[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
79+
80+
Community Impact Guidelines were inspired by
81+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
82+
83+
For answers to common questions about this code of conduct, see the FAQ at
84+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available
85+
at [https://www.contributor-covenant.org/translations][translations].
86+
87+
[homepage]: https://www.contributor-covenant.org
88+
[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
89+
[Mozilla CoC]: https://github.com/mozilla/diversity
90+
[FAQ]: https://www.contributor-covenant.org/faq
91+
[translations]: https://www.contributor-covenant.org/translations

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 JamesRezo
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# SPIP Standard Coding Rules for PHP_CodeSniffer
2+
3+
This is a set of rules for [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) that checks for SPIP Coding Standard and PHP Compatibility for SPIP v4.0.
4+
5+
## Installation
6+
7+
```bash
8+
composer require --dev dealerdirect/phpcodesniffer-composer-installer spip/coding-standards
9+
```
10+
11+
## Usage
12+
13+
```bash
14+
vendor/bin/phpcs --standard=SCS1 /path/to/file
15+
```
16+
17+
or create a `phpcs.xml` file containing this:
18+
19+
```xml
20+
<?xml version="1.0"?>
21+
<ruleset>
22+
<file>/path/to/file</file>
23+
<rule ref="SCS1" />
24+
</ruleset>
25+
```
26+
27+
and run :
28+
29+
```bash
30+
vendor/bin/phpcs
31+
```

composer.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "spip/coding-standards",
3+
"description": "SPIP Coding Standards",
4+
"type": "phpcodesniffer-standard",
5+
"keywords": ["spip", "phpcs"],
6+
"license": "MIT",
7+
"authors": [
8+
{
9+
"name": "JamesRezo",
10+
"email": "[email protected]"
11+
}
12+
],
13+
"require": {
14+
"squizlabs/php_codesniffer": "^3.6",
15+
"phpcompatibility/php-compatibility": "^9.3"
16+
},
17+
"suggest" : {
18+
"dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically."
19+
},
20+
"extra": {
21+
"branch-alias": {
22+
"dev-main": "1.0.x-dev"
23+
}
24+
}
25+
}

src/SCS1/ruleset.xml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="SCS1">
3+
<description>SPIP Coding Standard</description>
4+
5+
<rule ref="PSR1" >
6+
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace" />
7+
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols" />
8+
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps" />
9+
<exclude name="PSR1.Classes.ClassDeclaration.MultipleClasses" />
10+
</rule>
11+
12+
<!-- Appliquer PSR-2 moins nos exceptions -->
13+
<rule ref="PSR2" >
14+
<!-- Désactiver la vérification sur les noms de classes/fonctions -->
15+
<exclude name="Squiz.Classes.ValidClassName" />
16+
<!-- Désactiver la vérification sur l'indentation -->
17+
<exclude name="Generic.WhiteSpace.ScopeIndent" />
18+
<exclude name="Generic.WhiteSpace.DisallowTabIndent" />
19+
<!-- Désactiver la vérification sur les accolades -->
20+
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine" />
21+
<exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine" />
22+
<exclude name="PSR2.Classes.PropertyDeclaration" />
23+
<exclude name="Generic.NamingConventions.UpperCaseConstantName" />
24+
<exclude name="PSR2.ControlStructures.SwitchDeclaration.TerminatingComment" />
25+
</rule>
26+
27+
<rule ref="PSR2.Methods.MethodDeclaration.Underscore" >
28+
<severity>0</severity>
29+
</rule>
30+
31+
<!-- Tabulations pour l'indentation -->
32+
<arg name="tab-width" value="4"/>
33+
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>
34+
<rule ref="Generic.WhiteSpace.ScopeIndent">
35+
<properties>
36+
<property name="indent" value="4"/>
37+
<property name="tabIndent" value="true"/>
38+
</properties>
39+
</rule>
40+
41+
<rule ref="Generic.Files.LineLength">
42+
<properties>
43+
<property name="lineLimit" value="120"/>
44+
<property name="absoluteLineLimit" value="0"/>
45+
</properties>
46+
<severity>0</severity>
47+
</rule>
48+
49+
<rule ref="Internal.NoCodeFound">
50+
<severity>0</severity>
51+
</rule>
52+
53+
<!-- Accolades -->
54+
<rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie"/>
55+
<rule ref="Generic.ControlStructures.InlineControlStructure" />
56+
<rule ref="Squiz.ControlStructures.ControlSignature" />
57+
<rule ref="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace">
58+
<severity>0</severity>
59+
</rule>
60+
<rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace">
61+
<severity>0</severity>
62+
</rule>
63+
64+
<!-- Guillemets doubles -->
65+
<rule ref="Squiz.Strings.DoubleQuoteUsage"/>
66+
<rule ref="Squiz.Strings.DoubleQuoteUsage.ContainsVar">
67+
<severity>0</severity>
68+
</rule>
69+
70+
<arg name="extensions" value="php"/>
71+
</ruleset>

src/SPIP40/ruleset.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" ?>
2+
<ruleset name="SPIP40">
3+
<description>Coding rules for SPIP 4.0</description>
4+
5+
<rule ref="SCS1"/>
6+
7+
<rule ref="PHPCompatibility"/>
8+
<config name="testVersion" value="7.3-8.0"/>
9+
</ruleset>

0 commit comments

Comments
 (0)