brzuchal / stop-the-war
PHP_CodeSniffer rule adding non-collapsable comment calling out to stop wars
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 0
Type:phpcodesniffer-standard
Requires
- php: ^7.4 || ^8.0
- dealerdirect/phpcodesniffer-composer-installer: ^0.6.2 || ^0.7
- squizlabs/php_codesniffer: ^3.5.6
Requires (Dev)
- doctrine/coding-standard: ^9.0
- phing/phing: 2.16.3
- phpunit/phpunit: 9.4.0
- slevomat/coding-standard: ^7.0
README
A message to Russian ๐ท๐บ people
If you currently live in Russia, please read this message.
Purpose
A Stop The War sniff adding non-collapsable comment calling to stop the wars in source code files.
Install
composer require brzuchal/stop-the-war
Usage
Basic usage just adds general #StopTheWar
comment, a minimum setup requirement is to include StopTheWar
rule, as follows:
<?xml version="1.0"?> <!-- phpcs.xml.dist --> <ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"> <rule ref="StopTheWar"/> </ruleset>
Results in adding stop war comment with no additional text, as follows:
// Do not be silent! #StopWar class MyService { }
However, if you'd like to promote any kind of extended comment define rule property called commentExtension
, as for eg.:
<?xml version="1.0"?> <!-- phpcs.xml.dist --> <ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"> <rule ref="StopTheWar"> <properties> <property name="commentExtension" value="๐บ๐ฆ #StandWithUkraine #StopPutin"/> </properties> </rule> </ruleset>
Results in adding comment in front of every class, interface, trait, enum as follows:
// Do not be silent! #StopWar ๐บ๐ฆ #StandWithUkraine #StopPutin class MyService { }
License
MIT License
Copyright (c) 2022 Michaล Marcin Brzuchalski
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.