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

v1.0.0 2022-03-06 19:08 UTC

This package is auto-updated.

Last update: 2024-04-07 09:52:02 UTC


README

Tests

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.

SWUbanner

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.