From 47564c354c3199b923e729adc79fce2d23c3f1f2 Mon Sep 17 00:00:00 2001 From: KyleKatarn Date: Mon, 5 Aug 2019 17:50:30 +0200 Subject: [PATCH] Fix #650 Use pretty tables to handle multi-line --- src/site/rst/documentation/ant-task.rst | 41 +++++--- src/site/rst/rules/cleancode.rst | 10 +- src/site/rst/rules/codesize.rst | 119 ++++++++++++------------ src/site/rst/rules/controversial.rst | 26 +++--- src/site/rst/rules/design.rst | 40 ++++---- src/site/rst/rules/naming.rst | 46 ++++----- src/site/rst/rules/unusedcode.rst | 13 +-- 7 files changed, 158 insertions(+), 137 deletions(-) diff --git a/src/site/rst/documentation/ant-task.rst b/src/site/rst/documentation/ant-task.rst index a85c4f125..dee8f6edb 100644 --- a/src/site/rst/documentation/ant-task.rst +++ b/src/site/rst/documentation/ant-task.rst @@ -58,15 +58,25 @@ Parameters The following attributes can be defined on the PHPMD task xml-element. -===================== ========================================================================================================================= ================================================ - Attribute Description Required -===================== ========================================================================================================================= ================================================ - rulesetfiles A comma delimited list of ruleset files ('rulesets/basic.xml,rulesets/design.xml') or identifiers of build-in rulesets. Yes, unless the ruleset nested element is used - failonerror Whether or not to fail the build if any errors occur while processing the files No - failOnRuleViolation Whether or not to fail the build if PHPMD finds any problems No - minimumPriority The rule priority threshold; rules with lower priority than they will not be used No - maximumPriority The rule priority threshold; rules with higher priority than this will not be used No -===================== ========================================================================================================================= ================================================ ++---------------------+---------------------------------------------------+---------------------------------------------+ +| Attribute | Description | Required | ++=====================+===================================================+=============================================+ +| rulesetfiles | A comma delimited list of ruleset files | Yes, unless the ruleset nested element is | +| | ('rulesets/basic.xml,rulesets/design.xml') or | used | +| | identifiers of build-in rulesets. | | ++---------------------+---------------------------------------------------+---------------------------------------------+ +| failonerror | Whether or not to fail the build if any errors | No | +| | occur while processing the files | | ++---------------------+---------------------------------------------------+---------------------------------------------+ +| failOnRuleViolation | Whether or not to fail the build if PHPMD finds | No | +| | any problems | | ++---------------------+---------------------------------------------------+---------------------------------------------+ +| minimumPriority | The rule priority threshold; rules with lower | No | +| | priority than they will not be used | | ++---------------------+---------------------------------------------------+---------------------------------------------+ +| maximumPriority | The rule priority threshold; rules with higher | No | +| | priority than this will not be used | | ++---------------------+---------------------------------------------------+---------------------------------------------+ Nested xml elements =================== @@ -76,12 +86,13 @@ which the report is written. **Parameters** -=========== =================================================================== ========== - Attribute Description Required -=========== =================================================================== ========== - format The report output format. Supported formats are xml,html and text. Yes - toFile A filename into which the report is written Yes -=========== =================================================================== ========== ++------------+--------------------------------------------------------------------+----------+ +| Attribute | Description | Required | ++============+====================================================================+==========+ +| format | The report output format. Supported formats are xml,html and text. | Yes | ++------------+--------------------------------------------------------------------+----------+ +| toFile | A filename into which the report is written | Yes | ++------------+--------------------------------------------------------------------+----------+ The ```` xml element is another way to specify rulesets. Here is a modified version of the previous example: :: diff --git a/src/site/rst/rules/cleancode.rst b/src/site/rst/rules/cleancode.rst index e9b962eba..5d1786dc0 100644 --- a/src/site/rst/rules/cleancode.rst +++ b/src/site/rst/rules/cleancode.rst @@ -58,11 +58,11 @@ Example: :: This rule has the following properties: -=================================== =============== =============================================== - Name Default Value Description -=================================== =============== =============================================== - exceptions Comma-separated class name list of exceptions -=================================== =============== =============================================== ++-----------------------------------+---------------+------------------------------------------------------------+ +| Name | Default Value | Description | ++===================================+===============+============================================================+ +| exceptions | | Comma-separated class name list of exceptions | ++-----------------------------------+---------------+------------------------------------------------------------+ IfStatementAssignment ===================== diff --git a/src/site/rst/rules/codesize.rst b/src/site/rst/rules/codesize.rst index 0746b37c6..f6455de4d 100644 --- a/src/site/rst/rules/codesize.rst +++ b/src/site/rst/rules/codesize.rst @@ -53,13 +53,15 @@ Example: :: This rule has the following properties: -=================================== =============== =================================================================== - Name Default Value Description -=================================== =============== =================================================================== - reportLevel 10 The Cyclomatic Complexity reporting threshold - showClassesComplexity true Indicate if class average violation should be added to the report - showMethodsComplexity true Indicate if class average violation should be added to the report -=================================== =============== =================================================================== ++-----------------------------------+---------------+-------------------------------------------------------------------+ +| Name | Default Value | Description | ++===================================+===============+===================================================================+ +| reportLevel | 10 | The Cyclomatic Complexity reporting threshold | ++-----------------------------------+---------------+-------------------------------------------------------------------+ +| showClassesComplexity | true | Indicate if class average violation should be added to the report | ++-----------------------------------+---------------+-------------------------------------------------------------------+ +| showMethodsComplexity | true | Indicate if class average violation should be added to the report | ++-----------------------------------+---------------+-------------------------------------------------------------------+ NPathComplexity =============== @@ -78,11 +80,11 @@ Example: :: This rule has the following properties: -=================================== =============== =============================== - Name Default Value Description -=================================== =============== =============================== - minimum 200 The npath reporting threshold -=================================== =============== =============================== ++-----------------------------------+---------------+-------------------------------+ +| Name | Default Value | Description | ++===================================+===============+===============================+ +| minimum | 200 | The npath reporting threshold | ++-----------------------------------+---------------+-------------------------------+ ExcessiveMethodLength ===================== @@ -103,12 +105,13 @@ Example: :: This rule has the following properties: -=================================== =============== ========================================= - Name Default Value Description -=================================== =============== ========================================= - minimum 100 The method size reporting threshold - ignore-whitespace false Count whitespace in reporting threshold -=================================== =============== ========================================= ++-----------------------------------+---------------+-----------------------------------------+ +| Name | Default Value | Description | ++===================================+===============+=========================================+ +| minimum | 100 | The method size reporting threshold | ++-----------------------------------+---------------+-----------------------------------------+ +| ignore-whitespace | false | Count whitespace in reporting threshold | ++-----------------------------------+---------------+-----------------------------------------+ ExcessiveClassLength ==================== @@ -127,12 +130,13 @@ Example: :: This rule has the following properties: -=================================== =============== ========================================= - Name Default Value Description -=================================== =============== ========================================= - minimum 1000 The class size reporting threshold - ignore-whitespace false Count whitespace in reporting threshold -=================================== =============== ========================================= ++-----------------------------------+---------------+-----------------------------------------+ +| Name | Default Value | Description | ++===================================+===============+=========================================+ +| minimum | 1000 | The class size reporting threshold | ++-----------------------------------+---------------+-----------------------------------------+ +| ignore-whitespace | false | Count whitespace in reporting threshold | ++-----------------------------------+---------------+-----------------------------------------+ ExcessiveParameterList ====================== @@ -152,11 +156,11 @@ Example: :: This rule has the following properties: -=================================== =============== ========================================= - Name Default Value Description -=================================== =============== ========================================= - minimum 10 The parameter count reporting threshold -=================================== =============== ========================================= ++-----------------------------------+---------------+-----------------------------------------+ +| Name | Default Value | Description | ++===================================+===============+=========================================+ +| minimum | 10 | The parameter count reporting threshold | ++-----------------------------------+---------------+-----------------------------------------+ ExcessivePublicCount ==================== @@ -181,11 +185,11 @@ Example: :: This rule has the following properties: -=================================== =============== ===================================== - Name Default Value Description -=================================== =============== ===================================== - minimum 45 The public item reporting threshold -=================================== =============== ===================================== ++-----------------------------------+---------------+-----------------------------------------+ +| Name | Default Value | Description | ++===================================+===============+=========================================+ +| minimum | 45 | The public item reporting threshold | ++-----------------------------------+---------------+-----------------------------------------+ TooManyFields ============= @@ -205,11 +209,11 @@ Example: :: This rule has the following properties: -=================================== =============== ====================================== - Name Default Value Description -=================================== =============== ====================================== - maxfields 15 The field count reporting threshold -=================================== =============== ====================================== ++-----------------------------------+---------------+-----------------------------------------+ +| Name | Default Value | Description | ++===================================+===============+=========================================+ +| maxfields | 15 | The field count reporting threshold | ++-----------------------------------+---------------+-----------------------------------------+ TooManyMethods ============== @@ -220,12 +224,13 @@ A class with too many methods is probably a good suspect for refactoring, in ord This rule has the following properties: -=================================== =============== ====================================== - Name Default Value Description -=================================== =============== ====================================== - maxmethods 25 The method count reporting threshold - ignorepattern (^(set|get))i Ignore methods matching this regex -=================================== =============== ====================================== ++-----------------------------------+---------------+--------------------------------------+ +| Name | Default Value | Description | ++===================================+===============+======================================+ +| maxmethods | 25 | The method count reporting threshold | ++-----------------------------------+---------------+--------------------------------------+ +| ignorepattern | (^(set|get))i | Ignore methods matching this regex | ++-----------------------------------+---------------+--------------------------------------+ TooManyPublicMethods ==================== @@ -236,12 +241,13 @@ A class with too many public methods is probably a good suspect for refactoring, This rule has the following properties: -=================================== =============== ====================================== - Name Default Value Description -=================================== =============== ====================================== - maxmethods 10 The method count reporting threshold - ignorepattern (^(set|get))i Ignore methods matching this regex -=================================== =============== ====================================== ++-----------------------------------+---------------+-----------------------------------------+ +| Name | Default Value | Description | ++===================================+===============+=========================================+ +| maxmethods | 10 | The method count reporting threshold | ++-----------------------------------+---------------+-----------------------------------------+ +| ignorepattern | (^(set|get))i | Ignore methods matching this regex | ++-----------------------------------+---------------+-----------------------------------------+ ExcessiveClassComplexity ======================== @@ -278,11 +284,11 @@ Example: :: This rule has the following properties: -=================================== =============== ======================================== - Name Default Value Description -=================================== =============== ======================================== - maximum 50 The maximum WMC tolerable for a class. -=================================== =============== ======================================== ++-----------------------------------+---------------+-----------------------------------------+ +| Name | Default Value | Description | ++===================================+===============+=========================================+ +| maximum | 50 | The maximum WMC tolerable for a class. | ++-----------------------------------+---------------+-----------------------------------------+ Remark ====== @@ -290,4 +296,3 @@ Remark This document is based on a ruleset xml-file, that was taken from the original source of the `PMD`__ project. This means that most parts of the content on this page are the intellectual work of the PMD community and its contributors and not of the PHPMD project. __ http://pmd.sourceforge.net/ - \ No newline at end of file diff --git a/src/site/rst/rules/controversial.rst b/src/site/rst/rules/controversial.rst index a459f814e..5fd2208c9 100644 --- a/src/site/rst/rules/controversial.rst +++ b/src/site/rst/rules/controversial.rst @@ -46,12 +46,13 @@ Example: :: This rule has the following properties: -=================================== =============== ========================================================= - Name Default Value Description -=================================== =============== ========================================================= - allow-underscore false Allow an optional, single underscore at the beginning. - allow-underscore-test false Is it allowed to have underscores in test method names. -=================================== =============== ========================================================= ++-----------------------------------+---------------+---------------------------------------------------------+ +| Name | Default Value | Description | ++===================================+===============+=========================================================+ +| allow-underscore | false | Allow an optional, single underscore at the beginning. | ++-----------------------------------+---------------+---------------------------------------------------------+ +| allow-underscore-test | false | Is it allowed to have underscores in test method names. | ++-----------------------------------+---------------+---------------------------------------------------------+ CamelCaseMethodName =================== @@ -69,12 +70,13 @@ Example: :: This rule has the following properties: -=================================== =============== ========================================================= - Name Default Value Description -=================================== =============== ========================================================= - allow-underscore false Allow an optional, single underscore at the beginning. - allow-underscore-test false Is it allowed to have underscores in test method names. -=================================== =============== ========================================================= ++-----------------------------------+---------------+---------------------------------------------------------+ +| Name | Default Value | Description | ++===================================+===============+=========================================================+ +| allow-underscore | false | Allow an optional, single underscore at the beginning. | ++-----------------------------------+---------------+---------------------------------------------------------+ +| allow-underscore-test | false | Is it allowed to have underscores in test method names. | ++-----------------------------------+---------------+---------------------------------------------------------+ CamelCaseParameterName ====================== diff --git a/src/site/rst/rules/design.rst b/src/site/rst/rules/design.rst index 2cc83de80..37790c644 100644 --- a/src/site/rst/rules/design.rst +++ b/src/site/rst/rules/design.rst @@ -75,11 +75,11 @@ A class with an excessive number of children is an indicator for an unbalanced c This rule has the following properties: -=================================== =============== ============================================= - Name Default Value Description -=================================== =============== ============================================= - minimum 15 Maximum number of acceptable child classes. -=================================== =============== ============================================= ++-----------------------------------+---------------+---------------------------------------------+ +| Name | Default Value | Description | ++===================================+===============+=============================================+ +| minimum | 15 | Maximum number of acceptable child classes. | ++-----------------------------------+---------------+---------------------------------------------+ DepthOfInheritance ================== @@ -90,11 +90,11 @@ A class with many parents is an indicator for an unbalanced and wrong class hier This rule has the following properties: -=================================== =============== ============================================== - Name Default Value Description -=================================== =============== ============================================== - minimum 6 Maximum number of acceptable parent classes. -=================================== =============== ============================================== ++-----------------------------------+---------------+----------------------------------------------+ +| Name | Default Value | Description | ++===================================+===============+==============================================+ +| minimum | 6 | Maximum number of acceptable parent classes. | ++-----------------------------------+---------------+----------------------------------------------+ CouplingBetweenObjects ====================== @@ -138,11 +138,11 @@ Example: :: This rule has the following properties: -=================================== =============== ============================================ - Name Default Value Description -=================================== =============== ============================================ - maximum 13 Maximum number of acceptable dependencies. -=================================== =============== ============================================ ++-----------------------------------+---------------+----------------------------------------------+ +| Name | Default Value | Description | ++===================================+===============+==============================================+ +| maximum | 13 | Maximum number of acceptable dependencies. | ++-----------------------------------+---------------+----------------------------------------------+ DevelopmentCodeFragment ======================= @@ -169,11 +169,11 @@ Example: :: This rule has the following properties: -=================================== =============== ================================================== - Name Default Value Description -=================================== =============== ================================================== - unwanted-functions var_dump,print_r,debug_zval_dump,debug_print_backtrace Comma separated list of suspect function images. -=================================== =============== ================================================== ++-----------------------------------+-------------------------------------------------------+---------------------------------------------------------+ +| Name | Default Value | Description | ++===================================+=======================================================+=========================================================+ +| unwanted-functions |var_dump,print_r,debug_zval_dump,debug_print_backtrace | Comma separated list of suspect function images. | ++-----------------------------------+-------------------------------------------------------+---------------------------------------------------------+ EmptyCatchBlock =============== diff --git a/src/site/rst/rules/naming.rst b/src/site/rst/rules/naming.rst index 506e17e05..37e49f701 100644 --- a/src/site/rst/rules/naming.rst +++ b/src/site/rst/rules/naming.rst @@ -25,12 +25,13 @@ Example: :: This rule has the following properties: -=================================== =============== =========================================================== - Name Default Value Description -=================================== =============== =========================================================== - minimum 3 Minimum length for a variable, property or parameter name - exceptions Comma-separated list of exceptions -=================================== =============== =========================================================== ++-----------------------------------+---------------+------------------------------------------------------------+ +| Name | Default Value | Description | ++===================================+===============+============================================================+ +| minimum | 3 | Minimum length for a variable, property or parameter name. | ++-----------------------------------+---------------+------------------------------------------------------------+ +| exceptions | | Comma-separated list of exceptions | ++-----------------------------------+---------------+------------------------------------------------------------+ LongVariable ============ @@ -54,11 +55,11 @@ Example: :: This rule has the following properties: -=================================== =============== ========================================= - Name Default Value Description -=================================== =============== ========================================= - maximum 20 The variable length reporting threshold -=================================== =============== ========================================= ++-----------------------------------+---------------+-------------------------------------------+ +| Name | Default Value | Description | ++===================================+===============+===========================================+ +| maximum | 20 | The variable length reporting threshold | ++-----------------------------------+---------------+-------------------------------------------+ ShortMethodName =============== @@ -76,12 +77,13 @@ Example: :: This rule has the following properties: -=================================== =============== ============================================== - Name Default Value Description -=================================== =============== ============================================== - minimum 3 Minimum length for a method or function name - exceptions Comma-separated list of exceptions -=================================== =============== ============================================== ++-----------------------------------+---------------+------------------------------------------------------------+ +| Name | Default Value | Description | ++===================================+===============+============================================================+ +| minimum | 3 | Minimum length for a method or function name | ++-----------------------------------+---------------+------------------------------------------------------------+ +| exceptions | | Comma-separated list of exceptions | ++-----------------------------------+---------------+------------------------------------------------------------+ ConstructorWithNameAsEnclosingClass =================================== @@ -139,11 +141,11 @@ Example: :: This rule has the following properties: -=================================== =============== ============================================================ - Name Default Value Description -=================================== =============== ============================================================ - checkParameterizedMethods false Applies only to methods without parameter when set to true -=================================== =============== ============================================================ ++-----------------------------------+---------------+------------------------------------------------------------+ +| Name | Default Value | Description | ++===================================+===============+============================================================+ +| checkParameterizedMethods | false | Applies only to methods without parameter when set to true | ++-----------------------------------+---------------+------------------------------------------------------------+ Remark ====== diff --git a/src/site/rst/rules/unusedcode.rst b/src/site/rst/rules/unusedcode.rst index 5438545c5..66d651246 100644 --- a/src/site/rst/rules/unusedcode.rst +++ b/src/site/rst/rules/unusedcode.rst @@ -42,12 +42,13 @@ Example: :: This rule has the following properties: -=================================== =============== ======================================================== - Name Default Value Description -=================================== =============== ======================================================== - allow-unused-foreach-variables false Allow unused variables in foreach language constructs. - exceptions Comma-separated list of exceptions -=================================== =============== ======================================================== ++-----------------------------------+---------------+--------------------------------------------------------+ +| Name | Default Value | Description | ++===================================+===============+========================================================+ +| allow-unused-foreach-variables | false | Allow unused variables in foreach language constructs. | ++-----------------------------------+---------------+--------------------------------------------------------+ +| exceptions | | Comma-separated list of exceptions | ++-----------------------------------+---------------+--------------------------------------------------------+ UnusedPrivateMethod ===================