From d97a40de1e725127b650fb3deba4556b8f63504a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Poussard?= <tpoussard@neogeo.fr>
Date: Tue, 29 Aug 2023 16:16:56 +0200
Subject: [PATCH] clean code to comply to sonarQube

---
 src/service-worker.js                        |  1 -
 src/services/map-service.js                  |  1 -
 src/views/FeatureType/FeatureTypeDetail.vue  |  2 --
 src/views/FeatureType/FeatureTypeDisplay.vue | 29 +++++++++++++++-----
 src/views/Project/FeaturesListAndMap.vue     |  4 ---
 5 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/src/service-worker.js b/src/service-worker.js
index 20f36c2c..755d00f9 100644
--- a/src/service-worker.js
+++ b/src/service-worker.js
@@ -74,7 +74,6 @@ self.addEventListener('message', (e) => {
   if (!e.data) {
     return;
   }
-  //console.log(e.data);
   switch (e.data.type) {
   case 'SKIP_WAITING':
     self.skipWaiting();
diff --git a/src/services/map-service.js b/src/services/map-service.js
index 53861be5..2b62f53e 100644
--- a/src/services/map-service.js
+++ b/src/services/map-service.js
@@ -522,7 +522,6 @@ const mapService = {
 
     if (featureType) {
       const { color, opacity } = this.retrieveFeatureStyle(featureType, properties);
-      //console.log(color, opacity, featureType, properties);
       const colorValue =
         color && color.value && color.value.length ?
           color.value : typeof color === 'string' && color.length ?
diff --git a/src/views/FeatureType/FeatureTypeDetail.vue b/src/views/FeatureType/FeatureTypeDetail.vue
index 80facaf3..5f4ec563 100644
--- a/src/views/FeatureType/FeatureTypeDetail.vue
+++ b/src/views/FeatureType/FeatureTypeDetail.vue
@@ -568,9 +568,7 @@ export default {
                 }
               } else if (field_type === 'multi_choices_list') {
                 //*then check if the values in the value array are available options
-                //const unvalidValues = fieldInFeature.some((el) => !options.includes(el));
                 const unvalidValues = fieldInFeature.filter((el) => !options.includes(el));
-                console.log(customType, field_type, options, fieldInFeature, unvalidValues);
                 if (unvalidValues.length > 0) {
                   const plural = unvalidValues.length > 1;
                   this.importError = `Le fichier est invalide: ${plural ? 'les valeurs' : 'la valeur'} [ ${unvalidValues.join(', ')} ] ${plural ? 'ne sont pas des options valides' : 'n\'est pas une option valide'}
diff --git a/src/views/FeatureType/FeatureTypeDisplay.vue b/src/views/FeatureType/FeatureTypeDisplay.vue
index 19076932..5fde6cc4 100644
--- a/src/views/FeatureType/FeatureTypeDisplay.vue
+++ b/src/views/FeatureType/FeatureTypeDisplay.vue
@@ -85,12 +85,20 @@
       id="popupDisplay"
     >
       <h3>Prévisualisation des champs personnalisés de l'info-bulle</h3>
-      <table class="ui definition single line compact table">
+      <table
+        id="table-fields-to-display"
+        class="ui definition single line compact table"
+        aria-describedby="Liste des champs à afficher"
+      >
         <thead>
           <tr>
-            <th><!-- Sélection --></th>
-            <th>Champ</th>
-            <th>Type</th>
+            <th scope="col" />
+            <th scope="col">
+              Champ
+            </th>
+            <th scope="col">
+              Type
+            </th>
           </tr>
         </thead>
         <tbody>
@@ -98,7 +106,10 @@
             v-for="field in featureAnyFields"
             :key="field.name"
           >
-            <td class="collapsing">
+            <td
+              scope="row" 
+              class="collapsing"
+            >
               <div class="ui toggle checkbox">
                 <input
                   :checked="form.displayed_fields.includes(field.name)"
@@ -108,8 +119,12 @@
                 <label />
               </div>
             </td>
-            <td>{{ field.label }}</td>
-            <td>{{ field.field_type || getCustomFieldType(field.field_type) }}</td>
+            <td scope="row">
+              {{ field.label }}
+            </td>
+            <td scope="row">
+              {{ field.field_type || getCustomFieldType(field.field_type) }}
+            </td>
           </tr>
         </tbody>
       </table>
diff --git a/src/views/Project/FeaturesListAndMap.vue b/src/views/Project/FeaturesListAndMap.vue
index 0240d950..099eb291 100644
--- a/src/views/Project/FeaturesListAndMap.vue
+++ b/src/views/Project/FeaturesListAndMap.vue
@@ -307,10 +307,6 @@ export default {
       this.toggleDeleteModal();
     },
 
-    modifyFeaturesAttributes() {
-      console.log('modifyFeaturesAttributes');
-    },
-
     onFilterChange() {
       if (mapService.getMap() && mapService.mvtLayer) {
         mapService.mvtLayer.changed();
-- 
GitLab