This repository has been archived by the owner on Sep 30, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
gab
authored and
gab
committed
Dec 4, 2016
1 parent
7dcca65
commit 9c01b38
Showing
13 changed files
with
331 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tools/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>BuildMachineOSBuild</key> | ||
<string>13F34</string> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>English</string> | ||
<key>CFBundleExecutable</key> | ||
<string>CodaScriptPlugIn</string> | ||
<key>CFBundleIconFile</key> | ||
<string>plug-in</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.gablc.php-psr-2-fixer</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundlePackageType</key> | ||
<string>BNDL</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>1.1</string> | ||
<key>CodaAuthorString</key> | ||
<string>Gabriel Bordeaux</string> | ||
<key>CodaDescriptionString</key> | ||
<string>Uses PHP-CS-Fixer to automatically fix PHP coding standards issues</string> | ||
<key>CodaPlugInMinimumAPIVersion</key> | ||
<string>5</string> | ||
<key>CodaPlugInSupportedAPIVersion</key> | ||
<integer>6</integer> | ||
<key>DTCompiler</key> | ||
<string>com.apple.compilers.llvm.clang.1_0</string> | ||
<key>DTPlatformBuild</key> | ||
<string>6A317</string> | ||
<key>DTPlatformVersion</key> | ||
<string>GM</string> | ||
<key>DTSDKBuild</key> | ||
<string>11D50a</string> | ||
<key>DTSDKName</key> | ||
<string>macosx10.7</string> | ||
<key>DTXcode</key> | ||
<string>0600</string> | ||
<key>DTXcodeBuild</key> | ||
<string>6A317</string> | ||
<key>NSPrincipalClass</key> | ||
<string>CodaScriptPlugIn</string> | ||
<key>commands</key> | ||
<array> | ||
<dict> | ||
<key>fallbackInput</key> | ||
<string>none</string> | ||
<key>input</key> | ||
<string>document</string> | ||
<key>keyEquivalent</key> | ||
<string>^$f</string> | ||
<key>keyEquivalentConflict</key> | ||
<false/> | ||
<key>name</key> | ||
<string>PHP PSR-2 Fixer</string> | ||
<key>output</key> | ||
<string>replaceDocument</string> | ||
<key>postprocess</key> | ||
<string>none</string> | ||
<key>preprocess</key> | ||
<string>none</string> | ||
<key>script</key> | ||
<string>fixer.sh</string> | ||
<key>uuid</key> | ||
<string>052BF6D4-518B-4210-B10D-EAF406F1473B</string> | ||
</dict> | ||
</array> | ||
</dict> | ||
</plist> |
Binary file not shown.
1 change: 1 addition & 0 deletions
1
...-2 Fixer.codaplugin/Contents/Resources/052BF6D4-518B-4210-B10D-EAF406F1473B/.php_cs.cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"php":"5.6.25","version":"2.0.0","rules":{"encoding":true,"full_opening_tag":true,"blank_line_after_namespace":true,"braces":true,"class_definition":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_constants":true,"lowercase_keywords":true,"method_argument_space":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":["property"],"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":true,"no_whitespace_in_blank_line":true,"no_extra_consecutive_blank_lines":true},"hashes":{"private\/tmp\/psr2-fix-10af106f24ac5c6fa9a35092ffe1a9b2":693523182,"\/private\/tmp\/psr2-fix-e18f7423ec8693f72186419bb86c65ba":912974484}} |
Binary file added
BIN
+2.9 MB
...n/Contents/Resources/052BF6D4-518B-4210-B10D-EAF406F1473B/Support Files/php-cs-fixer.phar
Binary file not shown.
26 changes: 26 additions & 0 deletions
26
PHP PSR-2 Fixer.codaplugin/Contents/Resources/052BF6D4-518B-4210-B10D-EAF406F1473B/fixer.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# Get vars | ||
IN=`cat /dev/stdin` | ||
TMP_FILE="psr2-fix-"`date | md5` | ||
TMP_LOCATION="/tmp/" | ||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
if [ ${#IN} -eq 0 ]; then | ||
exit 0 | ||
else | ||
# Save stdin to temporary file | ||
echo "$IN" > $TMP_LOCATION$TMP_FILE; | ||
# echo $TMP_LOCATION"$TMP_FILE" | ||
|
||
# Fix psr-2 in temporary file | ||
php "$CURRENT_DIR""/Support Files/php-cs-fixer.phar" fix $TMP_LOCATION"$TMP_FILE" --rules=@PSR2,no_whitespace_in_blank_line,no_extra_consecutive_blank_lines --using-cache=no >> /dev/null | ||
|
||
# Return fixed file to stdout | ||
cat $TMP_LOCATION"$TMP_FILE" | ||
|
||
# Delete temporary file | ||
rm $TMP_LOCATION"$TMP_FILE" | ||
fi |
Binary file added
BIN
+76 Bytes
PHP PSR-2 Fixer.codaplugin/Contents/Resources/English.lproj/Localizable.strings
Binary file not shown.
Binary file added
BIN
+76 Bytes
PHP PSR-2 Fixer.codaplugin/Contents/Resources/Japanese.lproj/Localizable.strings
Binary file not shown.
143 changes: 143 additions & 0 deletions
143
PHP PSR-2 Fixer.codaplugin/Contents/_CodeSignature/CodeResources
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>files</key> | ||
<dict> | ||
<key>Resources/English.lproj/Localizable.strings</key> | ||
<dict> | ||
<key>hash</key> | ||
<data> | ||
YRYxNHVNDinoLyOc6wi/DDgeE+k= | ||
</data> | ||
<key>optional</key> | ||
<true/> | ||
</dict> | ||
<key>Resources/Japanese.lproj/Localizable.strings</key> | ||
<dict> | ||
<key>hash</key> | ||
<data> | ||
YRYxNHVNDinoLyOc6wi/DDgeE+k= | ||
</data> | ||
<key>optional</key> | ||
<true/> | ||
</dict> | ||
</dict> | ||
<key>files2</key> | ||
<dict> | ||
<key>Resources/English.lproj/Localizable.strings</key> | ||
<dict> | ||
<key>hash</key> | ||
<data> | ||
YRYxNHVNDinoLyOc6wi/DDgeE+k= | ||
</data> | ||
<key>optional</key> | ||
<true/> | ||
</dict> | ||
<key>Resources/Japanese.lproj/Localizable.strings</key> | ||
<dict> | ||
<key>hash</key> | ||
<data> | ||
YRYxNHVNDinoLyOc6wi/DDgeE+k= | ||
</data> | ||
<key>optional</key> | ||
<true/> | ||
</dict> | ||
</dict> | ||
<key>rules</key> | ||
<dict> | ||
<key>^Resources/</key> | ||
<true/> | ||
<key>^Resources/.*\.lproj/</key> | ||
<dict> | ||
<key>optional</key> | ||
<true/> | ||
<key>weight</key> | ||
<real>1000</real> | ||
</dict> | ||
<key>^Resources/.*\.lproj/locversion.plist$</key> | ||
<dict> | ||
<key>omit</key> | ||
<true/> | ||
<key>weight</key> | ||
<real>1100</real> | ||
</dict> | ||
<key>^version.plist$</key> | ||
<true/> | ||
</dict> | ||
<key>rules2</key> | ||
<dict> | ||
<key>.*\.dSYM($|/)</key> | ||
<dict> | ||
<key>weight</key> | ||
<real>11</real> | ||
</dict> | ||
<key>^(.*/)?\.DS_Store$</key> | ||
<dict> | ||
<key>omit</key> | ||
<true/> | ||
<key>weight</key> | ||
<real>2000</real> | ||
</dict> | ||
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key> | ||
<dict> | ||
<key>nested</key> | ||
<true/> | ||
<key>weight</key> | ||
<real>10</real> | ||
</dict> | ||
<key>^.*</key> | ||
<true/> | ||
<key>^Info\.plist$</key> | ||
<dict> | ||
<key>omit</key> | ||
<true/> | ||
<key>weight</key> | ||
<real>20</real> | ||
</dict> | ||
<key>^PkgInfo$</key> | ||
<dict> | ||
<key>omit</key> | ||
<true/> | ||
<key>weight</key> | ||
<real>20</real> | ||
</dict> | ||
<key>^Resources/</key> | ||
<dict> | ||
<key>weight</key> | ||
<real>20</real> | ||
</dict> | ||
<key>^Resources/.*\.lproj/</key> | ||
<dict> | ||
<key>optional</key> | ||
<true/> | ||
<key>weight</key> | ||
<real>1000</real> | ||
</dict> | ||
<key>^Resources/.*\.lproj/locversion.plist$</key> | ||
<dict> | ||
<key>omit</key> | ||
<true/> | ||
<key>weight</key> | ||
<real>1100</real> | ||
</dict> | ||
<key>^[^/]+$</key> | ||
<dict> | ||
<key>nested</key> | ||
<true/> | ||
<key>weight</key> | ||
<real>10</real> | ||
</dict> | ||
<key>^embedded\.provisionprofile$</key> | ||
<dict> | ||
<key>weight</key> | ||
<real>20</real> | ||
</dict> | ||
<key>^version\.plist$</key> | ||
<dict> | ||
<key>weight</key> | ||
<real>20</real> | ||
</dict> | ||
</dict> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,39 @@ | ||
# PHP-PSR-2-Fixer-Coda-Plugin | ||
Uses PHP-CS-Fixer to automatically fix PHP coding standards issues | ||
# PHP-PSR-2-Fixer Coda Plugin | ||
|
||
## Description | ||
|
||
PHP PSR-2 Fixer is a coda plugin created to provide a simple interface to automatically fix PHP coding standards issues using [PHP-CS-Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) | ||
|
||
## Installation | ||
|
||
- Download "PHP PSR-2 Fixer.codaplugin" | ||
- Double click on the downloaded file | ||
|
||
## Usage | ||
|
||
When editing a PHP file, you can: | ||
|
||
- Use the shortcut ^⇧F (control + shift + "F") | ||
- Make a right click → "Plug-ins" → "PHP PSR-2 Fixer" | ||
|
||
## Rules applied | ||
|
||
When using the plugin, the following rules are applied: | ||
|
||
- Code conversion to PSR-2 standard | ||
- no\_whitespace\_in\_blank\_line: Remove trailing whitespace at the end of blank lines. | ||
- no\_extra\_consecutive\_blank\_lines: Removes extra blank lines and/or blank lines following configuration. | ||
|
||
## Requirements | ||
|
||
- Coda >= 2.5 | ||
- PHP 5.6 (bundled in MacOS) | ||
|
||
## License | ||
|
||
This plug-in is under MIT license. | ||
PHP-CS-Fixer license is available [here](https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/LICENSE). | ||
|
||
## Credits | ||
|
||
[PHP-CS-Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) is bundled in this plug-in |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# Get vars | ||
IN=`cat /dev/stdin` | ||
TMP_FILE="psr2-fix-"`date | md5` | ||
TMP_LOCATION="/tmp/" | ||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
if [ ${#IN} -eq 0 ]; then | ||
exit 0 | ||
else | ||
# Save stdin to temporary file | ||
echo "$IN" > $TMP_LOCATION$TMP_FILE; | ||
# echo $TMP_LOCATION"$TMP_FILE" | ||
|
||
# Fix psr-2 in temporary file | ||
php "$CURRENT_DIR""/Support Files/php-cs-fixer.phar" fix $TMP_LOCATION"$TMP_FILE" --rules=@PSR2,no_whitespace_in_blank_line,no_extra_consecutive_blank_lines --using-cache=no >> /dev/null | ||
|
||
# Return fixed file to stdout | ||
cat $TMP_LOCATION"$TMP_FILE" | ||
|
||
# Delete temporary file | ||
rm $TMP_LOCATION"$TMP_FILE" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
// Bracket should be moved to the next line | ||
class thisIsATest{ | ||
|
||
// Bracket should be moved to the next line | ||
function myFunction($arg="test"){ | ||
// There should be a space after `if` and before the bracket, extra lines should be removed | ||
if($arg){ | ||
|
||
|
||
echo "This code is not psr-2"; | ||
|
||
} | ||
|
||
|
||
|
||
// extra blank lines should be removed, remaining one should be trimmed from extra whitespaces | ||
return false; | ||
} | ||
|
||
} |