Skip to content
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ RUN apk --update add git php-common php-ctype php-iconv php-json php-phar php-pc
/usr/src/app/composer.phar install && \
apk del build-base && rm -fr /usr/share/ri

RUN /usr/src/app/vendor/bin/phpcs --config-set installed_paths /usr/src/app/vendor/drupal/coder/coder_sniffer

RUN adduser -u 9000 -D app
USER app
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ PHP_CodeSniffer helps you detect violations of a defined coding standard.
Format the values for these config options per the [PHP_CodeSniffer documentation](https://github.com/squizlabs/PHP_CodeSniffer).

* file_extensions - This is where you can configure the file extensions for the files that you want PHP_CodeSniffer to analyze.
* standard - This is the list of standards that you want PHP_CodeSniffer to use while analyzing your files.
* standard - This is the list of standards that you want PHP_CodeSniffer to use while analyzing your files. The [Drupal Coding Standards](https://github.com/klausi/coder) are supported.
* ignore_warnings - You can hide warnings, and only report errors with this option.
* encoding - By default, PHPCS uses ISO-8859-1. Use this to change it to your encoding, e.g. UTF-8.

Expand Down
58 changes: 58 additions & 0 deletions Sniffs.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,64 @@ class Sniffs
);

public static $sniffs = array(
"Drupal.Array.Array" => 60000,
"Drupal.CSS.ClassDefinitionNameSpacing" => 50000,
"Drupal.CSS.ColourDefinition" => 50000,
"Drupal.Classes.ClassCreateInstance" => 60000,
"Drupal.Classes.ClassDeclaration" => 60000,
"Drupal.Classes.FullyQualifiedNamespace" => 50000,
"Drupal.Classes.InterfaceName" => 50000,
"Drupal.Classes.UnusedUseStatement" => 50000,
"Drupal.Commenting.ClassComment" => 50000,
"Drupal.Commenting.DocComment" => 60000,
"Drupal.Commenting.DocCommentStar" => 50000,
"Drupal.Commenting.FileComment" => 60000,
"Drupal.Commenting.FunctionComment" => 60000,
"Drupal.Commenting.HookComment" => 50000,
"Drupal.Commenting.InlineComment" => 60000,
"Drupal.Commenting.PostStatementComment" => 50000,
"Drupal.ControlStructures.ControlSignature" => 50000,
"Drupal.ControlStructures.ElseIf" => 50000,
"Drupal.ControlStructures.InlineControlStructure" => 50000,
"Drupal.Files.EndFileNewline" => 50000,
"Drupal.Files.FileEncoding" => 50000,
"Drupal.Files.LineLength" => 50000,
"Drupal.Files.TxtFileLineLength" => 50000,
"Drupal.Formatting.MultiLineAssignment" => 60000,
"Drupal.Formatting.SpaceInlineIf" => 60000,
"Drupal.Formatting.SpaceUnaryOperator" => 50000,
"Drupal.Functions.DiscouragedFunctions" => 50000,
"Drupal.Functions.FunctionDeclaration" => 60000,
"Drupal.InfoFiles.AutoAddedKeys" => 50000,
"Drupal.InfoFiles.ClassFiles" => 60000,
"Drupal.InfoFiles.DuplicateEntry" => 60000,
"Drupal.InfoFiles.Required" => 60000,
"Drupal.NamingConventions.ValidClassName" => 60000,
"Drupal.NamingConventions.ValidFunctionName" => 60000,
"Drupal.NamingConventions.ValidGlobal" => 60000,
"Drupal.NamingConventions.ValidVariableName" => 60000,
"Drupal.Semantics.ConstantName" => 50000,
"Drupal.Semantics.EmptyInstall" => 60000,
"Drupal.Semantics.FunctionAlias" => 60000,
"Drupal.Semantics.FunctionT" => 50000,
"Drupal.Semantics.FunctionWatchdog" => 60000,
"Drupal.Semantics.InstallHooks" => 60000,
"Drupal.Semantics.LStringTranslatable" => 60000,
"Drupal.Semantics.PregSecurity" => 60000,
"Drupal.Semantics.RemoteAddress" => 60000,
"Drupal.Semantics.TInHookMenu" => 60000,
"Drupal.Semantics.TInHookSchema" => 60000,
"Drupal.Strings.UnnecessaryStringConcat" => 60000,
"Drupal.WhiteSpace.CloseBracketSpacing" => 50000,
"Drupal.WhiteSpace.Comma" => 50000,
"Drupal.WhiteSpace.EmptyLines" => 60000,
"Drupal.WhiteSpace.Namespace" => 50000,
"Drupal.WhiteSpace.ObjectOperatorIndent" => 60000,
"Drupal.WhiteSpace.ObjectOperatorSpacing" => 50000,
"Drupal.WhiteSpace.OpenBracketSpacing" => 50000,
"Drupal.WhiteSpace.OperatorSpacing" => 50000,
"Drupal.WhiteSpace.ScopeClosingBrace" => 50000,
"Drupal.WhiteSpace.ScopeIndent" => 50000,
"Generic.ControlStructures.InlineControlStructure.NotAllowed" => 60000,
"Generic.Files.LineEndings.InvalidEOLChar" => 60000,
"Generic.Files.LineLength.TooLong" => 60000,
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"require": {
"squizlabs/php_codesniffer": "^2.5",
"barracudanetworks/forkdaemon-php": "1.0.*",
"danielstjules/stringy": "~2.0"
"danielstjules/stringy": "~2.0",
"drupal/coder": "^8.2"
}
}
39 changes: 37 additions & 2 deletions composer.lock

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