Lucas Werkmeister (WMDE) has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363032 )

Change subject: Add constraint status for incorrect parameters
......................................................................

Add constraint status for incorrect parameters

A fifth constraint status is added, which marks constraints with missing
or invalid parameters. The gadget shows violations of this type, and
also adds a CSS class for the constraint status to the report.

Bug: T167397
Change-Id: I0f0ee0f508d8fc440536c883c5312e407c3023f3
---
M i18n/en.json
M i18n/qqq.json
M includes/ConstraintCheck/DelegatingConstraintChecker.php
M includes/ConstraintCheck/Result/CheckResult.php
M modules/SpecialConstraintReportPage.css
M modules/gadget.js
6 files changed, 13 insertions(+), 4 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints
 refs/changes/32/363032/1

diff --git a/i18n/en.json b/i18n/en.json
index f8f8156..3ae6ce2 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -21,6 +21,7 @@
        "wbqc-constraintreport-status-compliance": "Compliance",
        "wbqc-constraintreport-status-exception": "Exception",
        "wbqc-constraintreport-status-todo": "Todo",
+       "wbqc-constraintreport-status-bad-parameters": "Bad parameters",
        "wbqc-constraintreport-result-table-header-status": "Status",
        "wbqc-constraintreport-result-table-header-claim": "Claim",
        "wbqc-constraintreport-result-table-header-constraint": "Constraint",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index a37f040..51f6970 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -23,6 +23,7 @@
        "wbqc-constraintreport-status-compliance": "Status for claims that 
comply with a constraint",
        "wbqc-constraintreport-status-exception": "Status for claims that were 
marked as a exception",
        "wbqc-constraintreport-status-todo": "Status for constraints which 
cannot be checked yet.\n{{Identical|Todo}}",
+       "wbqc-constraintreport-status-bad-parameters": "Status for constraints 
that have missing or invalid constraint parameters.",
        "wbqc-constraintreport-result-table-header-status": "Header of the 
column that tells whether the check found a violation or something 
else.\n{{Identical|Status}}",
        "wbqc-constraintreport-result-table-header-claim": "Header of the 
column that displays a link to the claim, the used property and its 
value.\n{{Identical|Claim}}",
        "wbqc-constraintreport-result-table-header-constraint": "Header of the 
column that gives information about which constraint was 
checked.\n{{Identical|Constraint}}",
diff --git a/includes/ConstraintCheck/DelegatingConstraintChecker.php 
b/includes/ConstraintCheck/DelegatingConstraintChecker.php
index 34cfe68..79d7a80 100644
--- a/includes/ConstraintCheck/DelegatingConstraintChecker.php
+++ b/includes/ConstraintCheck/DelegatingConstraintChecker.php
@@ -240,7 +240,7 @@
                                        $statement,
                                        $constraint,
                                        [],
-                                       CheckResult::STATUS_VIOLATION,
+                                       CheckResult::STATUS_BAD_PARAMETERS,
                                        $e->getMessage()
                                );
                        } catch ( SparqlHelperException $e ) {
@@ -275,7 +275,7 @@
                }
 
                $sortFunction = function ( CheckResult $a, CheckResult $b ) {
-                       $order = [ 'other' => 4, 'compliance' => 3, 'exception' 
=> 2, 'violation' => 1 ];
+                       $order = [ 'other' => 4, 'compliance' => 3, 'exception' 
=> 2, 'violation' => 1, 'bad-parameters' => 0 ];
 
                        $statusA = $a->getStatus();
                        $statusB = $b->getStatus();
diff --git a/includes/ConstraintCheck/Result/CheckResult.php 
b/includes/ConstraintCheck/Result/CheckResult.php
index 03314d3..0b33e32 100644
--- a/includes/ConstraintCheck/Result/CheckResult.php
+++ b/includes/ConstraintCheck/Result/CheckResult.php
@@ -24,6 +24,7 @@
        const STATUS_VIOLATION = 'violation';
        const STATUS_EXCEPTION = 'exception';
        const STATUS_TODO = 'todo';
+       const STATUS_BAD_PARAMETERS = 'bad-parameters';
 
        /**
         * @var EntityId
diff --git a/modules/SpecialConstraintReportPage.css 
b/modules/SpecialConstraintReportPage.css
index 47a50ae..831949f 100644
--- a/modules/SpecialConstraintReportPage.css
+++ b/modules/SpecialConstraintReportPage.css
@@ -36,6 +36,10 @@
        color: #54595d; /* Base20 */
 }
 
+.wbqc-status-bad-parameters {
+       color: #b32424; /* Red30 */
+}
+
 /* Tooltip */
 .wbqc-indicator {
        color: #72777d; /* Base30 */
diff --git a/modules/gadget.js b/modules/gadget.js
index b6ac5e4..0c5d051 100644
--- a/modules/gadget.js
+++ b/modules/gadget.js
@@ -30,8 +30,10 @@
        function buildReport( result ) {
                var $report, $heading, $helpButton;
 
-               if ( result.status === 'violation' ) {
-                       $report = $( '<div>' ).addClass( 'wbqc-report' );
+               if ( result.status === 'violation' || result.status === 
'bad-parameters' ) {
+                       $report = $( '<div>' )
+                               .addClass( 'wbqc-report' )
+                               .addClass( 'wbqc-report-status-' + 
result.status );
                        $heading = $( '<h4>' ).append(
                                $( '<a>' )
                                        .text( result.constraint.typeLabel )

-- 
To view, visit https://gerrit.wikimedia.org/r/363032
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0f0ee0f508d8fc440536c883c5312e407c3023f3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints
Gerrit-Branch: master
Gerrit-Owner: Lucas Werkmeister (WMDE) <lucas.werkmeis...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to