Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sniff documentation #226

Open
dingo-d opened this issue Jul 17, 2019 · 1 comment
Open

Add sniff documentation #226

dingo-d opened this issue Jul 17, 2019 · 1 comment

Comments

@dingo-d
Copy link
Member

dingo-d commented Jul 17, 2019

Like in the WPCS a documentation should be added for every sniff, so that the --generator can be used to generate documentation.

The TRT can benefit from this as well, because we can use this in our handbook as well (the examples).

The documentation looks something like this.

You can test what it looks like in the terminal by running

vendor/squizlabs/php_codesniffer/bin/phpcs --generator=Text

In the terminal.

-------------------------------------------------------------
| WORDPRESS CODING STANDARDS CODING STANDARD: SAFE REDIRECT |
-------------------------------------------------------------

wp_safe_redirect() should be used whenever possible to prevent open redirect vulnerabilities. One of
the main uses of an open redirect vulnerability is to make phishing attacks more credible. In this
case the user sees your (trusted) domain and might get redirected to an attacker controlled website
aimed at stealing private information.

----------------------------------------- CODE COMPARISON ------------------------------------------
| Valid: Redirect can only go to allowed         | Invalid: Unsafe redirect, can be abused.        |
| domains.                                       |                                                 |
----------------------------------------------------------------------------------------------------
| wp_safe_redirect( $location );                 | wp_redirect( $location );                       |
----------------------------------------------------------------------------------------------------
@jrfnl
Copy link

jrfnl commented Nov 17, 2019

For anyone who wants to contribute to this, but isn't that familiar with the tooling:
For in-depth step-by-step instructions on how to get started creating these docs, have a look at the sister-issue in WPCS for this: WordPress/WordPress-Coding-Standards#1722

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants