bourahima commited on
Commit
d3990f4
·
verified ·
1 Parent(s): 72b8cf1

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +305 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Code Quality
3
- emoji: 😻
4
- colorFrom: purple
5
- colorTo: indigo
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: code-quality
3
+ emoji: 🐳
4
+ colorFrom: gray
5
+ colorTo: yellow
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,305 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="fr">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Amélioration de la Qualité du Code</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ /* Custom CSS for elements that can't be done with Tailwind */
11
+ .code-block {
12
+ font-family: 'Courier New', monospace;
13
+ tab-size: 2;
14
+ }
15
+
16
+ .gradient-bg {
17
+ background: linear-gradient(135deg, #6b21a8 0%, #1e40af 100%);
18
+ }
19
+
20
+ .card-hover {
21
+ transition: all 0.3s ease;
22
+ }
23
+
24
+ .card-hover:hover {
25
+ transform: translateY(-5px);
26
+ box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
27
+ }
28
+
29
+ /* Animation for checklist items */
30
+ @keyframes fadeIn {
31
+ from { opacity: 0; transform: translateY(10px); }
32
+ to { opacity: 1; transform: translateY(0); }
33
+ }
34
+
35
+ .animate-checklist li {
36
+ animation: fadeIn 0.3s ease forwards;
37
+ }
38
+
39
+ .animate-checklist li:nth-child(1) { animation-delay: 0.1s; }
40
+ .animate-checklist li:nth-child(2) { animation-delay: 0.2s; }
41
+ .animate-checklist li:nth-child(3) { animation-delay: 0.3s; }
42
+ .animate-checklist li:nth-child(4) { animation-delay: 0.4s; }
43
+ .animate-checklist li:nth-child(5) { animation-delay: 0.5s; }
44
+ </style>
45
+ </head>
46
+ <body class="bg-gray-50 min-h-screen">
47
+ <!-- Header Section -->
48
+ <header class="gradient-bg text-white shadow-lg">
49
+ <div class="container mx-auto px-6 py-12">
50
+ <div class="flex flex-col md:flex-row items-center justify-between">
51
+ <div class="mb-8 md:mb-0">
52
+ <h1 class="text-4xl font-bold mb-2">Qualité du Code</h1>
53
+ <p class="text-xl text-purple-200">Bonnes pratiques et améliorations</p>
54
+ </div>
55
+ <div class="flex space-x-4">
56
+ <button id="themeToggle" class="bg-white text-purple-800 px-4 py-2 rounded-full font-semibold hover:bg-purple-100 transition">
57
+ <i class="fas fa-moon mr-2"></i>Mode Sombre
58
+ </button>
59
+ </div>
60
+ </div>
61
+ </div>
62
+ </header>
63
+
64
+ <!-- Main Content -->
65
+ <main class="container mx-auto px-6 py-12">
66
+ <!-- Introduction Section -->
67
+ <section class="mb-16">
68
+ <div class="bg-white rounded-xl shadow-md p-8">
69
+ <h2 class="text-3xl font-bold text-purple-900 mb-6">
70
+ <i class="fas fa-star text-yellow-400 mr-3"></i>Pourquoi améliorer la qualité du code?
71
+ </h2>
72
+ <div class="grid md:grid-cols-2 gap-8">
73
+ <div>
74
+ <p class="text-gray-700 mb-6 leading-relaxed">
75
+ Un code de qualité est essentiel pour maintenir un projet durable, évolutif et facile à comprendre.
76
+ Cela réduit les bugs, facilite la collaboration et diminue les coûts de maintenance à long terme.
77
+ </p>
78
+ <div class="bg-purple-50 p-6 rounded-lg border-l-4 border-purple-500">
79
+ <h3 class="font-bold text-purple-800 mb-3">Citation importante</h3>
80
+ <p class="text-purple-700 italic">
81
+ "Tout codeur peut écrire du code que l'ordinateur peut comprendre. Les bons programmeurs écrivent du code que les humains peuvent comprendre."
82
+ <span class="block mt-2 text-right">- Martin Fowler</span>
83
+ </p>
84
+ </div>
85
+ </div>
86
+ <div>
87
+ <img src="https://images.unsplash.com/photo-1555066931-43605d967585?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80"
88
+ alt="Code quality illustration"
89
+ class="w-full h-auto rounded-lg shadow">
90
+ </div>
91
+ </div>
92
+ </div>
93
+ </section>
94
+
95
+ <!-- Checklist Section -->
96
+ <section class="mb-16">
97
+ <h2 class="text-3xl font-bold text-purple-900 mb-8 text-center">
98
+ <i class="fas fa-check-circle text-green-500 mr-3"></i>Checklist d'Amélioration
99
+ </h2>
100
+
101
+ <div class="grid md:grid-cols-2 lg:grid-cols-3 gap-6">
102
+ <!-- Card 1 -->
103
+ <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
104
+ <div class="p-6">
105
+ <div class="flex items-center mb-4">
106
+ <div class="bg-purple-100 p-3 rounded-full mr-4">
107
+ <i class="fas fa-code text-purple-600 text-xl"></i>
108
+ </div>
109
+ <h3 class="text-xl font-bold text-gray-800">Lisibilité</h3>
110
+ </div>
111
+ <ul class="space-y-3 animate-checklist">
112
+ <li class="flex items-start">
113
+ <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
114
+ <span>Noms de variables explicites</span>
115
+ </li>
116
+ <li class="flex items-start">
117
+ <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
118
+ <span>Indentation cohérente</span>
119
+ </li>
120
+ <li class="flex items-start">
121
+ <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
122
+ <span>Commentaires pertinents</span>
123
+ </li>
124
+ </ul>
125
+ </div>
126
+ </div>
127
+
128
+ <!-- Card 2 -->
129
+ <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
130
+ <div class="p-6">
131
+ <div class="flex items-center mb-4">
132
+ <div class="bg-blue-100 p-3 rounded-full mr-4">
133
+ <i class="fas fa-cubes text-blue-600 text-xl"></i>
134
+ </div>
135
+ <h3 class="text-xl font-bold text-gray-800">Structure</h3>
136
+ </div>
137
+ <ul class="space-y-3 animate-checklist">
138
+ <li class="flex items-start">
139
+ <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
140
+ <span>Découpage en petites fonctions</span>
141
+ </li>
142
+ <li class="flex items-start">
143
+ <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
144
+ <span>Éviter la duplication (DRY)</span>
145
+ </li>
146
+ <li class="flex items-start">
147
+ <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
148
+ <span>Architecture modulaire</span>
149
+ </li>
150
+ </ul>
151
+ </div>
152
+ </div>
153
+
154
+ <!-- Card 3 -->
155
+ <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
156
+ <div class="p-6">
157
+ <div class="flex items-center mb-4">
158
+ <div class="bg-green-100 p-3 rounded-full mr-4">
159
+ <i class="fas fa-shield-alt text-green-600 text-xl"></i>
160
+ </div>
161
+ <h3 class="text-xl font-bold text-gray-800">Robustesse</h3>
162
+ </div>
163
+ <ul class="space-y-3 animate-checklist">
164
+ <li class="flex items-start">
165
+ <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
166
+ <span>Gestion des erreurs</span>
167
+ </li>
168
+ <li class="flex items-start">
169
+ <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
170
+ <span>Validation des entrées</span>
171
+ </li>
172
+ <li class="flex items-start">
173
+ <i class="fas fa-check text-green-500 mt-1 mr-2"></i>
174
+ <span>Tests unitaires</span>
175
+ </li>
176
+ </ul>
177
+ </div>
178
+ </div>
179
+ </div>
180
+ </section>
181
+
182
+ <!-- Code Examples Section -->
183
+ <section class="mb-16">
184
+ <h2 class="text-3xl font-bold text-purple-900 mb-8 text-center">
185
+ <i class="fas fa-laptop-code text-blue-500 mr-3"></i>Exemples Concrets
186
+ </h2>
187
+
188
+ <div class="bg-white rounded-xl shadow-lg overflow-hidden">
189
+ <div class="grid md:grid-cols-2 gap-0">
190
+ <!-- Bad Code Example -->
191
+ <div class="p-6 border-b md:border-b-0 md:border-r border-gray-200">
192
+ <div class="flex items-center mb-4">
193
+ <div class="bg-red-100 p-2 rounded-full mr-3">
194
+ <i class="fas fa-times-circle text-red-500"></i>
195
+ </div>
196
+ <h3 class="text-xl font-bold text-gray-800">À éviter</h3>
197
+ </div>
198
+ <div class="bg-gray-800 text-gray-100 p-4 rounded-lg code-block text-sm overflow-x-auto">
199
+ <pre><code>function p(d) {
200
+ let r=0;
201
+ for(let i=0;i&lt;d.length;i++) {
202
+ r+=d[i].p;
203
+ }
204
+ return r/d.length;
205
+ }</code></pre>
206
+ </div>
207
+ <div class="mt-4 text-red-600">
208
+ <p class="font-semibold">Problèmes :</p>
209
+ <ul class="list-disc pl-5 mt-2 space-y-1">
210
+ <li>Noms de variables obscurs</li>
211
+ <li>Pas de gestion d'erreur</li>
212
+ <li>Fonction fait plusieurs choses</li>
213
+ </ul>
214
+ </div>
215
+ </div>
216
+
217
+ <!-- Good Code Example -->
218
+ <div class="p-6">
219
+ <div class="flex items-center mb-4">
220
+ <div class="bg-green-100 p-2 rounded-full mr-3">
221
+ <i class="fas fa-check-circle text-green-500"></i>
222
+ </div>
223
+ <h3 class="text-xl font-bold text-gray-800">À privilégier</h3>
224
+ </div>
225
+ <div class="bg-gray-800 text-gray-100 p-4 rounded-lg code-block text-sm overflow-x-auto">
226
+ <pre><code>/**
227
+ * Calcule la moyenne des prix d'un tableau de produits
228
+ * @param {Array&lt;Product&gt;} products - Tableau d'objets produits
229
+ * @returns {number} La moyenne des prix
230
+ * @throws {Error} Si le tableau est vide ou invalide
231
+ */
232
+ function calculateAveragePrice(products) {
233
+ if (!Array.isArray(products) || products.length === 0) {
234
+ throw new Error('Le tableau de produits doit contenir au moins un élément');
235
+ }
236
+
237
+ const total = products.reduce((sum, product) => {
238
+ return sum + (product.price || 0);
239
+ }, 0);
240
+
241
+ return total / products.length;
242
+ }</code></pre>
243
+ </div>
244
+ <div class="mt-4 text-green-700">
245
+ <p class="font-semibold">Améliorations :</p>
246
+ <ul class="list-disc pl-5 mt-2 space-y-1">
247
+ <li>Noms explicites</li>
248
+ <li>Documentation</li>
249
+ <li>Gestion des erreurs</li>
250
+ <li>Fonction pure</li>
251
+ </ul>
252
+ </div>
253
+ </div>
254
+ </div>
255
+ </div>
256
+ </section>
257
+
258
+ <!-- Tools Section -->
259
+ <section class="mb-16">
260
+ <h2 class="text-3xl font-bold text-purple-900 mb-8 text-center">
261
+ <i class="fas fa-tools text-orange-500 mr-3"></i>Outils Utiles
262
+ </h2>
263
+
264
+ <div class="grid sm:grid-cols-2 lg:grid-cols-4 gap-6">
265
+ <!-- ESLint -->
266
+ <div class="bg-white p-6 rounded-xl shadow-md flex flex-col items-center text-center card-hover">
267
+ <div class="bg-purple-100 p-4 rounded-full mb-4">
268
+ <i class="fas fa-broom text-purple-600 text-2xl"></i>
269
+ </div>
270
+ <h3 class="text-xl font-bold mb-2">ESLint</h3>
271
+ <p class="text-gray-600 mb-4">Analyse statique pour JavaScript</p>
272
+ <button class="mt-auto bg-purple-600 text-white px-4 py-2 rounded-full text-sm font-medium hover:bg-purple-700 transition">
273
+ <i class="fab fa-github mr-2"></i>Voir sur GitHub
274
+ </button>
275
+ </div>
276
+
277
+ <!-- Prettier -->
278
+ <div class="bg-white p-6 rounded-xl shadow-md flex flex-col items-center text-center card-hover">
279
+ <div class="bg-blue-100 p-4 rounded-full mb-4">
280
+ <i class="fas fa-code text-blue-600 text-2xl"></i>
281
+ </div>
282
+ <h3 class="text-xl font-bold mb-2">Prettier</h3>
283
+ <p class="text-gray-600 mb-4">Formateur de code automatique</p>
284
+ <button class="mt-auto bg-blue-600 text-white px-4 py-2 rounded-full text-sm font-medium hover:bg-blue-700 transition">
285
+ <i class="fab fa-github mr-2"></i>Voir sur GitHub
286
+ </button>
287
+ </div>
288
+
289
+ <!-- SonarQube -->
290
+ <div class="bg-white p-6 rounded-xl shadow-md flex flex-col items-center text-center card-hover">
291
+ <div class="bg-green-100 p-4 rounded-full mb-4">
292
+ <i class="fas fa-chart-line text-green-600 text-2xl"></i>
293
+ </div>
294
+ <h3 class="text-xl font-bold mb-2">SonarQube</h3>
295
+ <p class="text-gray-600 mb-4">Analyse de qualité complète</p>
296
+ <button class="mt-auto bg-green-600 text-white px-4 py-2 rounded-full text-sm font-medium hover:bg-green-700 transition">
297
+ <i class="fas fa-external-link-alt mr-2"></i>Visiter le site
298
+ </button>
299
+ </div>
300
+
301
+ <!-- Jest -->
302
+ <div class="bg-white p-6 rounded-xl shadow-md flex flex-col items-center text-center card-hover">
303
+ <div class="bg-red-100 p-4 rounded-full mb-4">
304
+ <i class="fas fa-vial text-red-600 text-2xl"></i
305
+ </html>