Skip to content

Commit

Permalink
CS fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
palmiak committed Jun 4, 2019
1 parent 2ba6be1 commit 06ebc63
Show file tree
Hide file tree
Showing 5 changed files with 374 additions and 99 deletions.
24 changes: 24 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

# WordPress Coding Standards
# http://make.wordpress.org/core/handbook/coding-standards/

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab

[*.json]
indent_style = space
indent_size = 2

[*.md]
indent_style = space

[*.txt,wp-config-sample.php]
end_of_line = crlf
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "palmiak/timber_acf_wp_blocks",
"name": "palmiak/timber-acf-wp-blocks",
"description": "Create Gutenberg blocks from Twig templates and ACF fields.",
"keywords": ["wordpress", "gutenberg", "advanced custom fields"],
"require": {
Expand All @@ -21,5 +21,9 @@
],
"autoload": {
"files": ["timber-acf-wp-blocks.php"]
},
"require-dev": {
"wp-coding-standards/wpcs": "2.0",
"dealerdirect/phpcodesniffer-composer-installer": "0.5.0"
}
}
167 changes: 165 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 75 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0"?>
<ruleset name="WordPress-Timber">
<description>A custom set of rules to check coding standards for Timber.</description>

<!--
Default settings for command line usage
-->

<!-- Exclude folders and files from being checked. -->
<exclude-pattern>*/tests/*</exclude-pattern>
<exclude-pattern>*.twig</exclude-pattern>

<!-- If no files or directories are specified on the command line, check all relevant files. -->
<file>./lib</file>

<!-- Use colors in output. -->
<arg name="colors"/>

<!-- Show sniff names and progress. -->
<arg value="sp"/>

<!--
WordPress-Extra
Best practices beyond core WordPress Coding Standards.
The WordPress-Core standard doesn’t have to be included here,
because WordPress-Extra already includes it.
-->
<rule ref="WordPress-Extra">
<!-- Do not check for proper WordPress file names. -->
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" />
</rule>

<!--
WordPress-Docs
WordPress Coding Standards for Inline Documentation and Comments.
-->
<rule ref="WordPress-Docs" />

<!--
File Names
The WordPress Coding Standards state that all class files should start with 'class-'. Timber
follows the PSR-0 standard for naming class files, because it uses autoloading via Composer.
@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#disregard-class-file-name-rules
-->
<rule ref="WordPress.Files.FileName">
<properties>
<property name="strict_class_file_names" value="false" />
</properties>
</rule>

<!--
Line length
Lines should be 100 chars long at max (triggers warning),
and should in no case exceed 120 characters (triggers error).
-->
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="100"/>
<property name="absoluteLineLimit" value="120"/>
</properties>
</rule>

<!--
Hook Names
While the WordPress Coding Standards state that hook names should be separated by
underscores, an optionated approach used by plugins like Advanced Custom Fields is to use
'/' to namespace hooks.
@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#custom-word-delimiters-in-hook-names
-->
<rule ref="WordPress.NamingConventions.ValidHookName">
<properties>
<property name="additionalWordDelimiters" value="/"/>
</properties>
</rule>
</ruleset>
Loading

0 comments on commit 06ebc63

Please sign in to comment.