-
-
Notifications
You must be signed in to change notification settings - Fork 490
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
Enforce @since tags in DocBlocks #2446
Enforce @since tags in DocBlocks #2446
Conversation
Question: should this sniff be disabled for files in this repository that expectedly cause the |
@anton-vlasenko I have a feeling we will not be able to accept this PR as:
|
@jrfnl Yes, you're right that generally GPL licensed code cannot be added (copied, forked, etc.) to a MIT licensed project. The opposite seems possible. However thinking this is quite more complicated :) Also, afaik, in general one open source project can contribute code (usually bug-fixes?) to another open source project. Since both Gutenberg and WPCS are under the WordPress "umbrella" and are to benefit the WP community as a whole, thinking that such contributions would probably be welcome. |
If I recall correctly, we (and by we I mean Juliette because she is realistically the only one writing sniffs atm) deliberately decided not to write docs-specific sniffs because WP docs are even more different than the proposed PSR-5 and PSR-19 (still in draft). Because of how WP doc blocks are parsed for documentation generation, how we write the Writing sniffs only to fix and modify them later would be a waste of time. Plus, if we were to start writing sniffs specifically for doc-blocs, and its structure, I'd expect them to be in a separate namespace from |
@azaozz Where it was contributed first is exactly the problem. If the code had been pulled to both projects around the same time, there wouldn't be a problem. However, the code/the PR has been accepted and merged into the GB repo before it was pulled here. This makes it effectively GPL code, which we cannot accept into an MIT licensed repo. We've had discussions like this before regarding code I wrote to be used by both WPCS as well as PHPCompatibility, with PHPCompatibility being licensed under the lGPL license (this was before PHPCSUtils existed). |
Closing as something we cannot even consider due to the licensing issues. |
Sorry for the late reply.
My previous comment here missed to mention that all contributions to Gutenberg made after April 15, 2021 are dual-licensed under GPL and MPL. See: https://github.com/WordPress/gutenberg/blob/trunk/LICENSE.md. Not sure if adding of GPL licensed code to a MIT licensed package (software/library) is acceptable here (the software/library doesn't seem to be distributed directly to users, rather it is used as part of the build process for other software). However adding MPL licensed code seems acceptable as MPL and MIT seem compatible in both directions? |
Thank you for the feedback. The third-party code has been removed from the sniff.
Sure. It's a pity that my PR cannot be accepted despite all the efforts. |
What?
This PR enhances support for checking
@since
tags within various code elements such as class, trait, interface, enum declarations, properties, and method declarations. Additionally, it extends support to check@since
tags for WordPress functions that invoke hooks like'do_action'
,'do_action_ref_array'
,'apply_filters'
, and'apply_filters_ref_array'
.The sniff only checks
/**
style comments.The sniffs supports multiple
@since
tags per token.Fixes #1994
Note: this PR is a backport of WordPress/gutenberg#60007 to WPCS.
Why?
This PR improves the overall code adherence to WordPress coding standards. By enforcing
@since
tags, it ensures better documentation and version tracking, making it easier for developers to understand the evolution of the codebase over time.How?
@since
tags for class, trait, interface, and enum declarations.@since
tags for class and trait properties;@since
tags for class, interface, and trait method declarations;@since
tags for WordPress functions that invoke hooks:do_action()
,do_action_ref_array()
,apply_filters()
,apply_filters_ref_array()
.Testing Instructions
@since
tag and ensure that the linter checks fail.@since
tag and ensure that the linter checks fail. Ensure that the sniff skips checking private methods.do_action()
,do_action_ref_array()
,apply_filters()
,apply_filters_ref_array()
without specifying a@since
tag. Confirm that the linter checks fail.@since
tag and ensure that the linter checks fail.Testing Instructions for Keyboard
Screenshots or screencast