Failed Conditions
Pull Request — master (#2825)
by Sébastien
05:15
created

testNullColumnDefaultWithTable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 50
Code Lines 30

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 1 Features 0
Metric Value
c 4
b 1
f 0
dl 0
loc 50
rs 9.3333
cc 1
eloc 30
nc 1
nop 0
1
<?php
2
3
namespace Doctrine\Tests\DBAL\Functional\Schema;
4
5
use Doctrine\DBAL\Platforms\MySqlPlatform;
6
use Doctrine\DBAL\Schema\Comparator;
7
use Doctrine\DBAL\Schema\Schema;
8
use Doctrine\DBAL\Schema\Table;
9
use Doctrine\DBAL\Types\Type;
10
11
class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
12
{
13
    protected function setUp()
14
    {
15
        parent::setUp();
16
17
        if (!Type::hasType('point')) {
18
            Type::addType('point', 'Doctrine\Tests\Types\MySqlPointType');
19
        }
20
    }
21
22
    public function testSwitchPrimaryKeyColumns()
23
    {
24
        $tableOld = new Table("switch_primary_key_columns");
25
        $tableOld->addColumn('foo_id', 'integer');
26
        $tableOld->addColumn('bar_id', 'integer');
27
        $tableNew = clone $tableOld;
0 ignored issues
show
Unused Code introduced by
$tableNew is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
28
29
        $this->_sm->createTable($tableOld);
30
        $tableFetched = $this->_sm->listTableDetails("switch_primary_key_columns");
31
        $tableNew = clone $tableFetched;
32
        $tableNew->setPrimaryKey(array('bar_id', 'foo_id'));
33
34
        $comparator = new Comparator;
35
        $this->_sm->alterTable($comparator->diffTable($tableFetched, $tableNew));
0 ignored issues
show
Security Bug introduced by
It seems like $comparator->diffTable($tableFetched, $tableNew) targeting Doctrine\DBAL\Schema\Comparator::diffTable() can also be of type false; however, Doctrine\DBAL\Schema\Abs...maManager::alterTable() does only seem to accept object<Doctrine\DBAL\Schema\TableDiff>, did you maybe forget to handle an error condition?
Loading history...
36
    }
37
38
    public function testDiffTableBug()
39
    {
40
        $schema = new Schema();
41
        $table = $schema->createTable('diffbug_routing_translations');
42
        $table->addColumn('id', 'integer');
43
        $table->addColumn('route', 'string');
44
        $table->addColumn('locale', 'string');
45
        $table->addColumn('attribute', 'string');
46
        $table->addColumn('localized_value', 'string');
47
        $table->addColumn('original_value', 'string');
48
        $table->setPrimaryKey(array('id'));
49
        $table->addUniqueIndex(array('route', 'locale', 'attribute'));
50
        $table->addIndex(array('localized_value')); // this is much more selective than the unique index
51
52
        $this->_sm->createTable($table);
53
        $tableFetched = $this->_sm->listTableDetails("diffbug_routing_translations");
54
55
        $comparator = new Comparator;
56
        $diff = $comparator->diffTable($tableFetched, $table);
57
58
        $this->assertFalse($diff, "no changes expected.");
59
    }
60
61 View Code Duplication
    public function testFulltextIndex()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
62
    {
63
        $table = new Table('fulltext_index');
64
        $table->addColumn('text', 'text');
65
        $table->addIndex(array('text'), 'f_index');
66
        $table->addOption('engine', 'MyISAM');
67
68
        $index = $table->getIndex('f_index');
69
        $index->addFlag('fulltext');
70
71
        $this->_sm->dropAndCreateTable($table);
72
73
        $indexes = $this->_sm->listTableIndexes('fulltext_index');
74
        $this->assertArrayHasKey('f_index', $indexes);
75
        $this->assertTrue($indexes['f_index']->hasFlag('fulltext'));
76
    }
77
78 View Code Duplication
    public function testSpatialIndex()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
79
    {
80
        $table = new Table('spatial_index');
81
        $table->addColumn('point', 'point');
82
        $table->addIndex(array('point'), 's_index');
83
        $table->addOption('engine', 'MyISAM');
84
85
        $index = $table->getIndex('s_index');
86
        $index->addFlag('spatial');
87
88
        $this->_sm->dropAndCreateTable($table);
89
90
        $indexes = $this->_sm->listTableIndexes('spatial_index');
91
        $this->assertArrayHasKey('s_index', $indexes);
92
        $this->assertTrue($indexes['s_index']->hasFlag('spatial'));
93
    }
94
95
    /**
96
     * @group DBAL-400
97
     */
98
    public function testAlterTableAddPrimaryKey()
99
    {
100
        $table = new Table('alter_table_add_pk');
101
        $table->addColumn('id', 'integer');
102
        $table->addColumn('foo', 'integer');
103
        $table->addIndex(array('id'), 'idx_id');
104
105
        $this->_sm->createTable($table);
106
107
        $comparator = new Comparator();
108
        $diffTable  = clone $table;
109
110
        $diffTable->dropIndex('idx_id');
111
        $diffTable->setPrimaryKey(array('id'));
112
113
        $this->_sm->alterTable($comparator->diffTable($table, $diffTable));
0 ignored issues
show
Security Bug introduced by
It seems like $comparator->diffTable($table, $diffTable) targeting Doctrine\DBAL\Schema\Comparator::diffTable() can also be of type false; however, Doctrine\DBAL\Schema\Abs...maManager::alterTable() does only seem to accept object<Doctrine\DBAL\Schema\TableDiff>, did you maybe forget to handle an error condition?
Loading history...
114
115
        $table = $this->_sm->listTableDetails("alter_table_add_pk");
116
117
        $this->assertFalse($table->hasIndex('idx_id'));
118
        $this->assertTrue($table->hasPrimaryKey());
119
    }
120
121
    /**
122
     * @group DBAL-464
123
     */
124
    public function testDropPrimaryKeyWithAutoincrementColumn()
125
    {
126
        $table = new Table("drop_primary_key");
127
        $table->addColumn('id', 'integer', array('primary' => true, 'autoincrement' => true));
128
        $table->addColumn('foo', 'integer', array('primary' => true));
129
        $table->setPrimaryKey(array('id', 'foo'));
130
131
        $this->_sm->dropAndCreateTable($table);
132
133
        $diffTable = clone $table;
134
135
        $diffTable->dropPrimaryKey();
136
137
        $comparator = new Comparator();
138
139
        $this->_sm->alterTable($comparator->diffTable($table, $diffTable));
0 ignored issues
show
Security Bug introduced by
It seems like $comparator->diffTable($table, $diffTable) targeting Doctrine\DBAL\Schema\Comparator::diffTable() can also be of type false; however, Doctrine\DBAL\Schema\Abs...maManager::alterTable() does only seem to accept object<Doctrine\DBAL\Schema\TableDiff>, did you maybe forget to handle an error condition?
Loading history...
140
141
        $table = $this->_sm->listTableDetails("drop_primary_key");
142
143
        $this->assertFalse($table->hasPrimaryKey());
144
        $this->assertFalse($table->getColumn('id')->getAutoincrement());
145
    }
146
147
    /**
148
     * @group DBAL-789
149
     */
150
    public function testDoesNotPropagateDefaultValuesForUnsupportedColumnTypes()
151
    {
152
        $table = new Table("text_blob_default_value");
153
        $table->addColumn('def_text', 'text', array('default' => 'def'));
154
        $table->addColumn('def_text_null', 'text', array('notnull' => false, 'default' => 'def'));
155
        $table->addColumn('def_blob', 'blob', array('default' => 'def'));
156
        $table->addColumn('def_blob_null', 'blob', array('notnull' => false, 'default' => 'def'));
157
158
        $this->_sm->dropAndCreateTable($table);
159
160
        $onlineTable = $this->_sm->listTableDetails("text_blob_default_value");
161
162
        $this->assertNull($onlineTable->getColumn('def_text')->getDefault());
163
        $this->assertNull($onlineTable->getColumn('def_text_null')->getDefault());
164
        $this->assertFalse($onlineTable->getColumn('def_text_null')->getNotnull());
165
        $this->assertNull($onlineTable->getColumn('def_blob')->getDefault());
166
        $this->assertNull($onlineTable->getColumn('def_blob_null')->getDefault());
167
        $this->assertFalse($onlineTable->getColumn('def_blob_null')->getNotnull());
168
169
        $comparator = new Comparator();
170
171
        $this->_sm->alterTable($comparator->diffTable($table, $onlineTable));
0 ignored issues
show
Security Bug introduced by
It seems like $comparator->diffTable($table, $onlineTable) targeting Doctrine\DBAL\Schema\Comparator::diffTable() can also be of type false; however, Doctrine\DBAL\Schema\Abs...maManager::alterTable() does only seem to accept object<Doctrine\DBAL\Schema\TableDiff>, did you maybe forget to handle an error condition?
Loading history...
172
173
        $onlineTable = $this->_sm->listTableDetails("text_blob_default_value");
174
175
        $this->assertNull($onlineTable->getColumn('def_text')->getDefault());
176
        $this->assertNull($onlineTable->getColumn('def_text_null')->getDefault());
177
        $this->assertFalse($onlineTable->getColumn('def_text_null')->getNotnull());
178
        $this->assertNull($onlineTable->getColumn('def_blob')->getDefault());
179
        $this->assertNull($onlineTable->getColumn('def_blob_null')->getDefault());
180
        $this->assertFalse($onlineTable->getColumn('def_blob_null')->getNotnull());
181
    }
182
183 View Code Duplication
    public function testColumnCollation()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
184
    {
185
        $table = new Table('test_collation');
186
        $table->addOption('collate', $collation = 'latin1_swedish_ci');
187
        $table->addOption('charset', 'latin1');
188
        $table->addColumn('id', 'integer');
189
        $table->addColumn('text', 'text');
190
        $table->addColumn('foo', 'text')->setPlatformOption('collation', 'latin1_swedish_ci');
191
        $table->addColumn('bar', 'text')->setPlatformOption('collation', 'utf8_general_ci');
192
        $this->_sm->dropAndCreateTable($table);
193
194
        $columns = $this->_sm->listTableColumns('test_collation');
195
196
        $this->assertArrayNotHasKey('collation', $columns['id']->getPlatformOptions());
197
        $this->assertEquals('latin1_swedish_ci', $columns['text']->getPlatformOption('collation'));
198
        $this->assertEquals('latin1_swedish_ci', $columns['foo']->getPlatformOption('collation'));
199
        $this->assertEquals('utf8_general_ci', $columns['bar']->getPlatformOption('collation'));
200
    }
201
202
    /**
203
     * @group DBAL-843
204
     */
205
    public function testListLobTypeColumns()
206
    {
207
        $tableName = 'lob_type_columns';
208
        $table = new Table($tableName);
209
210
        $table->addColumn('col_tinytext', 'text', array('length' => MySqlPlatform::LENGTH_LIMIT_TINYTEXT));
211
        $table->addColumn('col_text', 'text', array('length' => MySqlPlatform::LENGTH_LIMIT_TEXT));
212
        $table->addColumn('col_mediumtext', 'text', array('length' => MySqlPlatform::LENGTH_LIMIT_MEDIUMTEXT));
213
        $table->addColumn('col_longtext', 'text');
214
215
        $table->addColumn('col_tinyblob', 'text', array('length' => MySqlPlatform::LENGTH_LIMIT_TINYBLOB));
216
        $table->addColumn('col_blob', 'blob', array('length' => MySqlPlatform::LENGTH_LIMIT_BLOB));
217
        $table->addColumn('col_mediumblob', 'blob', array('length' => MySqlPlatform::LENGTH_LIMIT_MEDIUMBLOB));
218
        $table->addColumn('col_longblob', 'blob');
219
220
        $this->_sm->dropAndCreateTable($table);
221
222
        $platform = $this->_sm->getDatabasePlatform();
223
        $offlineColumns = $table->getColumns();
224
        $onlineColumns = $this->_sm->listTableColumns($tableName);
225
226
        $this->assertSame(
227
            $platform->getClobTypeDeclarationSQL($offlineColumns['col_tinytext']->toArray()),
228
            $platform->getClobTypeDeclarationSQL($onlineColumns['col_tinytext']->toArray())
229
        );
230
        $this->assertSame(
231
            $platform->getClobTypeDeclarationSQL($offlineColumns['col_text']->toArray()),
232
            $platform->getClobTypeDeclarationSQL($onlineColumns['col_text']->toArray())
233
        );
234
        $this->assertSame(
235
            $platform->getClobTypeDeclarationSQL($offlineColumns['col_mediumtext']->toArray()),
236
            $platform->getClobTypeDeclarationSQL($onlineColumns['col_mediumtext']->toArray())
237
        );
238
        $this->assertSame(
239
            $platform->getClobTypeDeclarationSQL($offlineColumns['col_longtext']->toArray()),
240
            $platform->getClobTypeDeclarationSQL($onlineColumns['col_longtext']->toArray())
241
        );
242
243
        $this->assertSame(
244
            $platform->getBlobTypeDeclarationSQL($offlineColumns['col_tinyblob']->toArray()),
245
            $platform->getBlobTypeDeclarationSQL($onlineColumns['col_tinyblob']->toArray())
246
        );
247
        $this->assertSame(
248
            $platform->getBlobTypeDeclarationSQL($offlineColumns['col_blob']->toArray()),
249
            $platform->getBlobTypeDeclarationSQL($onlineColumns['col_blob']->toArray())
250
        );
251
        $this->assertSame(
252
            $platform->getBlobTypeDeclarationSQL($offlineColumns['col_mediumblob']->toArray()),
253
            $platform->getBlobTypeDeclarationSQL($onlineColumns['col_mediumblob']->toArray())
254
        );
255
        $this->assertSame(
256
            $platform->getBlobTypeDeclarationSQL($offlineColumns['col_longblob']->toArray()),
257
            $platform->getBlobTypeDeclarationSQL($onlineColumns['col_longblob']->toArray())
258
        );
259
    }
260
261
    /**
262
     * @group DBAL-423
263
     */
264
    public function testDiffListGuidTableColumn()
265
    {
266
        $offlineTable = new Table('list_guid_table_column');
267
        $offlineTable->addColumn('col_guid', 'guid');
268
269
        $this->_sm->dropAndCreateTable($offlineTable);
270
271
        $onlineTable = $this->_sm->listTableDetails('list_guid_table_column');
272
273
        $comparator = new Comparator();
274
275
        $this->assertFalse(
276
            $comparator->diffTable($offlineTable, $onlineTable),
277
            "No differences should be detected with the offline vs online schema."
278
        );
279
    }
280
281
    /**
282
     * @group DBAL-1082
283
     */
284 View Code Duplication
    public function testListDecimalTypeColumns()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
285
    {
286
        $tableName = 'test_list_decimal_columns';
287
        $table = new Table($tableName);
288
289
        $table->addColumn('col', 'decimal');
290
        $table->addColumn('col_unsigned', 'decimal', array('unsigned' => true));
291
292
        $this->_sm->dropAndCreateTable($table);
293
294
        $columns = $this->_sm->listTableColumns($tableName);
295
296
        $this->assertArrayHasKey('col', $columns);
297
        $this->assertArrayHasKey('col_unsigned', $columns);
298
        $this->assertFalse($columns['col']->getUnsigned());
299
        $this->assertTrue($columns['col_unsigned']->getUnsigned());
300
    }
301
302
    /**
303
     * @group DBAL-1082
304
     */
305 View Code Duplication
    public function testListFloatTypeColumns()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
306
    {
307
        $tableName = 'test_list_float_columns';
308
        $table = new Table($tableName);
309
310
        $table->addColumn('col', 'float');
311
        $table->addColumn('col_unsigned', 'float', array('unsigned' => true));
312
313
        $this->_sm->dropAndCreateTable($table);
314
315
        $columns = $this->_sm->listTableColumns($tableName);
316
317
        $this->assertArrayHasKey('col', $columns);
318
        $this->assertArrayHasKey('col_unsigned', $columns);
319
        $this->assertFalse($columns['col']->getUnsigned());
320
        $this->assertTrue($columns['col_unsigned']->getUnsigned());
321
    }
322
323
    /**
324
     * Test default null values (especially for mariadb 10.2.7+)
325
     * @link https://github.com/doctrine/dbal/issues/2817
326
     */
327
    public function testNullColumnDefaultWithTable()
328
    {
329
330
        $table = new Table("test_column_defaults_with_table");
331
        $table->addColumn('col0', 'integer', ['notnull' => false]);
332
        $table->addColumn('col1', 'integer', ['notnull' => false, 'default' => null]);
333
        $table->addColumn('col2', 'string', ['notnull' => false, 'default' => null]);
334
        $table->addColumn('col3', 'string', ['notnull' => false, 'default' => 'NULL']);
335
        $table->addColumn('col4', 'string', ['notnull' => false, 'default' => 'Hello world']);
336
        $table->addColumn('col5', 'datetime', ['notnull' => false, 'default' => null]);
337
        $table->addColumn('col6', 'decimal', ['scale' => 3, 'precision' => 6, 'notnull' => false, 'default' => -2.3]);
338
        $table->addColumn('col7', 'date', ['notnull' => false, 'default' => '2012-12-12']);
339
        $table->addColumn('col8', 'string', ['notnull' => true, 'default' => '']);
340
        $table->addColumn('col9', 'integer', ['notnull' => false, 'default' => 0]);
341
        $table->addColumn('col10', 'string', ['notnull' => false, 'default' => 'He"ll"o world']);
342
343
        $this->_sm->dropAndCreateTable($table);
344
345
        $onlineTable = $this->_sm->listTableDetails("test_column_defaults_with_table");
346
        $this->assertNull($onlineTable->getColumn('col0')->getDefault());
347
        $this->assertNull($onlineTable->getColumn('col1')->getDefault());
348
        $this->assertNull($onlineTable->getColumn('col2')->getDefault());
349
        $this->assertEquals('NULL', $onlineTable->getColumn('col3')->getDefault());
350
        $this->assertEquals('Hello world', $onlineTable->getColumn('col4')->getDefault());
351
        $this->assertNull($onlineTable->getColumn('col5')->getDefault());
352
        $this->assertEquals(-2.3, $onlineTable->getColumn('col6')->getDefault());
353
        $this->assertEquals('2012-12-12', $onlineTable->getColumn('col7')->getDefault());
354
        $this->assertTrue($onlineTable->getColumn('col8')->getNotnull());
355
        $this->assertEquals('', $onlineTable->getColumn('col8')->getDefault());
356
        $this->assertEquals(0, $onlineTable->getColumn('col9')->getDefault());
357
        $this->assertEquals('He"ll"o world', $onlineTable->getColumn('col10')->getDefault());
358
359
        $comparator = new Comparator();
360
361
        $diff = $comparator->diffTable($table, $onlineTable);
362
        $this->assertFalse($diff, "Tables should be identical with column defaults");
363
364
        /*
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
365
        // For later tests, otherwise cleanup
366
367
        $this->_sm->alterTable($diff);
368
369
        $this->_sm->listTableDetails("text_null_default_value");
370
371
        $this->assertNull($onlineTable->getColumn('txt_def_null')->getDefault());
372
        $this->assertEquals('NULL', $onlineTable->getColumn('txt_def_null_as_string')->getDefault());
373
        $this->assertEquals('NULL', $onlineTable->getColumn('txt_def_null_as_quoted_string')->getDefault());
374
        $this->assertEquals('"NULL"', $onlineTable->getColumn('txt_def_null_as_doublequoted_string')->getDefault());
375
        */
376
    }
377
378
    /**
379
     * For testing MariaDB 10.2+ / MySQL differences
380
     */
381
    public function testColumnDefaultsWithCreate() {
382
383
        $this->_conn->query('DROP TABLE IF EXISTS `test_column_defaults_with_create`');
384
        $sql = sprintf("
385
            CREATE TABLE `test_column_defaults_with_create` (
386
                `col0` INT(11) NULL,
387
                `col1` INT(10) UNSIGNED NULL DEFAULT NULL,
388
                `col2` VARCHAR(10) CHARACTER SET UTF8MB4 COLLATE UTF8MB4_GENERAL_CI NULL DEFAULT NULL,
389
                `col3` VARCHAR(10) CHARACTER SET UTF8MB4 COLLATE UTF8MB4_GENERAL_CI NULL DEFAULT 'NULL',
390
                `col4` VARCHAR(20) NULL DEFAULT 'Hello world',
391
                `col5` DATETIME NULL DEFAULT NULL,
392
                `col6` DECIMAL(6, 3) NULL DEFAULT -2.3,
393
                `col7` DATE NULL DEFAULT '2012-12-12',
394
                `col8` VARCHAR(20) NOT NULL DEFAULT '',
395
                `col9` INT(11) NULL DEFAULT 0,
396
                `col10` VARCHAR(20) NULL DEFAULT '%s'                                                
397
                ) ENGINE=INNODB;
398
        ", 'He"ll"o world');
399
400
        $this->_conn->query($sql);
401
        $t = $this->_sm->listTableDetails("test_column_defaults_with_create");
402
        $this->assertNull($t->getColumn('col0')->getDefault());
403
        $this->assertNull($t->getColumn('col1')->getDefault());
404
        $this->assertNull($t->getColumn('col2')->getDefault());
405
        $this->assertEquals('NULL', $t->getColumn('col3')->getDefault());
406
        $this->assertEquals('Hello world', $t->getColumn('col4')->getDefault());
407
        $this->assertNull($t->getColumn('col5')->getDefault());
408
        $this->assertEquals(-2.3, $t->getColumn('col6')->getDefault());
409
        $this->assertEquals('2012-12-12', $t->getColumn('col7')->getDefault());
410
        $this->assertTrue($t->getColumn('col8')->getNotnull());
411
        $this->assertEquals('', $t->getColumn('col8')->getDefault());
412
        $this->assertEquals(0, $t->getColumn('col9')->getDefault());
413
        $this->assertEquals('He"ll"o world', $t->getColumn('col10')->getDefault());
414
415
        // @todo mariadb returns 'current_timestamp()'
416
        //   `col10` DATETIME NULL DEFAULT CURRENT_TIMESTAMP
417
        //    $this->assertEquals('current_timestamp', strtolower($t->getColumn('col10')->getDefault()));
0 ignored issues
show
Unused Code Comprehensibility introduced by
74% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
418
    }
419
420
}
421