Comments (7)
To further this goal across the ecosystem (and a deeper explanation on why a shared ruleset is important), I released this WPGraphQL Coding Standards, which should make it significantly easier to evaluate the impact and value on this codebase.
To test:
- run
composer require --dev axepress/wp-graphql-cs
locally to install the sniffs. - Copy the example
phpcs.xml.dist.example
file over to the root directory and rename it tophpcs.xml
. - Replace the included/excluded directories in
phpcs.xml
with those fromphpcs.xml.dist
- Run
vendor/bin/phpcs
and review the results (or even better runvendor/bin/phpcbf
, and then diff the branch).
from wp-graphql-content-blocks.
@justlevine Thanks. We do maintain a phpcs plugin
https://github.com/wpengine/wpengine-coding-standards
do you think we can include this ruleset there?
from wp-graphql-content-blocks.
@theodesp looking at the ruleset, the sniffs WPEngine-Strict has cherry-picked are already included in WPGraphQL-Minimum
, as are all the ones in the phpcs.xml.dist
of this repo.
The only conflict I see is the wp-core preference for long array()
syntax - WPGraphQL core (and the ruleset) enforces the short []
syntax.
The next level up, WPGraphQL-Strict
includes functional sniffs about PHP best practices, so that also should be fine.
The one that gives me pause is the optional WPGraphQL-Extra
that handles formatting, alignment, and some extra doc-block requirements, as it's opinionated and might go against what the Faust team uses internally (although unenforced by the WPEngine ruleset). I did my best to use this repo as a guide for that (e.g. the no-space before a method's : ReturnType
goes against my personal preference and what WPGraphQL core currently does), considering that afaik, WPEngine has the largest number of paid contributors to the ecosystem. I'm sure the team will have feedback, and I'm looking forward to incorporating it 😁
from wp-graphql-content-blocks.
Closing this ticket since #165 is merged.
from wp-graphql-content-blocks.
Hey @justlevine has #111 satisfied this issue? Thank you!
from wp-graphql-content-blocks.
@josephfusco when I reviewed it pre-merge, I noted that PR was actually justification in support of this issue, and as far as I can tell, the merged version didnt make any changes to the PHPCS ruleset.
A stricter (and ecosystem-shared) PHPCS ruleset would have prevented/autofixed many of those issues from leaking into the codebase. Further, it would catch additional smells missed by that PR (to be fair, last time I reviewed was pre-merge) , and most importantly it would keep future changes to the codebase clean so a housekeeping PR like #111 would be mostly unnecessary.
from wp-graphql-content-blocks.
@josephfusco take a look at the individual commits in #126 . Beyond switching to modern array syntax, it caught (and in many cases fixed), typing smells, memory consumption from nonstatic callables.
To get a feel for its future usefulness, you can cherry pick the first commit onto a branch from before my and/or @mindctrl 's series of housekeeping PRs, and see how many would have been autofixed or at least caught before merge.
from wp-graphql-content-blocks.
Related Issues (20)
- CorePostTerms doesn't expose any way to ask for the terms HOT 9
- Content Blocks: Add configuration for running tests locally HOT 1
- Reusable block isn't resolved inside columns HOT 3
- CoreImage give wrong caption when lightbox is enable HOT 2
- Feature: Add support for Xpath selectors HOT 1
- Can't retrieve Core Navigation data HOT 1
- Upload Schema Artifact workflow fails to upload schema HOT 1
- CircleCI deploy fails due to restricted context
- Switch to new PHPCSStandards/PHP_CodeSniffer package HOT 1
- Submit plugin to WordPress.org
- Failure running getIntrospectionQuery - GraphiQL IDE Schema not loading HOT 3
- When activation plugin, got Fatal error: Uncaught Error: Class "EnforceSemVer\EnforceSemVer" not found
- Support nested properties inside block.json attributes
- Missing fields in GraphQL query HOT 6
- Add WordPress "nightly" support to testing matrix
- CoreImage / CoreGallery how get MediaItem data?
- Critical error when installing plugin HOT 4
- ApolloError: Internal server error when querying "dropCap" attribute on core/paragraph block HOT 8
- CoreTable column alignment returns null HOT 1
- Interface field argument error in GraphQL IDE after update to WPGraphQL 1.26
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wp-graphql-content-blocks.