Skip to content

Commit 2dcfd16

Browse files
committed
Cleaned up code - some adjustments to selected files
The following adjustments were made: - Control structures should use curly braces (PHP:S121) - Mergeable "if" statements should be combined (PHP:S1066) - Redundant pairs of parentheses should be removed (PHP:1110) - Unused local variables should be removed (PHP:S1481) - Local variables should not be declared and then immediately returned or thrown (PHP:S1488) - PHP keywords and constants "true", "false", "null" should be lower case (PHP:S1781) - Unused assignments should be removed (PHP:S1854) - The "print" statement should not be used (python:PrintStatementUsage)
1 parent 18ef560 commit 2dcfd16

8 files changed

Lines changed: 103 additions & 113 deletions

File tree

config.inc.php

Lines changed: 70 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@
7373
"@TestCaseSpecDisplay:"
7474
];
7575

76-
$tlCfg->keywords->onDeleteCheckFrozenTCVersions = TRUE;
77-
$tlCfg->keywords->onDeleteCheckExecutedTCVersions = TRUE;
76+
$tlCfg->keywords->onDeleteCheckFrozenTCVersions = true;
77+
$tlCfg->keywords->onDeleteCheckExecutedTCVersions = true;
7878

7979
// main key testproject PREFIX
8080
// element array
@@ -125,7 +125,7 @@
125125
*/
126126
$tlCfg->temp_dir = TL_ABS_PATH . 'gui' . DIRECTORY_SEPARATOR . 'templates_c' .
127127
DIRECTORY_SEPARATOR;
128-
if (($tpltmp = getenv('TESTLINK_TEMPLATES_C'))) {
128+
if ($tpltmp = getenv('TESTLINK_TEMPLATES_C')) {
129129
$tlCfg->temp_dir = trim($tpltmp);
130130
}
131131

@@ -318,7 +318,7 @@
318318
// ini_set('session.gc_maxlifetime', 60*90);
319319

320320
$tlCfg->notifications->userSignUp = new stdClass();
321-
$tlCfg->notifications->userSignUp->enabled = TRUE; // @see notifyGlobalAdmins()
321+
$tlCfg->notifications->userSignUp->enabled = true; // @see notifyGlobalAdmins()
322322
$tlCfg->notifications->userSignUp->to = new stdClass();
323323
$tlCfg->notifications->userSignUp->to->roles = array(
324324
TL_ROLES_ADMIN
@@ -359,7 +359,7 @@
359359
* put it out of reach via web or configure access denied.
360360
*/
361361
$tlCfg->log_path = '/var/testlink/logs/'; /* unix example */
362-
if (($lp = getenv('TESTLINK_LOG_PATH'))) {
362+
if ($lp = getenv('TESTLINK_LOG_PATH')) {
363363
$tlCfg->log_path = trim($lp);
364364
}
365365

@@ -598,7 +598,7 @@
598598
$tlCfg->authentication['ldap'][1]['ldap_surname_field'] = 'sn';
599599

600600
// Follows Mantisbt idea.
601-
// True if user does not exist on DB, but can be get from LDAP,
601+
// true if user does not exist on DB, but can be get from LDAP,
602602
// the user will be created AUTOMATICALLY with default user role.
603603
// Create user with following data from LDAP
604604
// mail
@@ -609,7 +609,7 @@
609609
/**
610610
* Enable/disable Users to create accounts on login page
611611
*/
612-
$tlCfg->user_self_signup = TRUE;
612+
$tlCfg->user_self_signup = true;
613613

614614
/**
615615
* What happens when Administrator push the Reset Password Button
@@ -650,11 +650,11 @@
650650

651651
/**
652652
* XML-RPC API availability - do less than promised ;)
653-
* FALSE => user are not able to generate and set his/her API key.
653+
* false => user are not able to generate and set his/her API key.
654654
* XML-RPC server do not check this config in order to answer or not a call.
655655
*/
656656

657-
$tlCfg->api->enabled = TRUE;
657+
$tlCfg->api->enabled = true;
658658

659659
// used to display API ID info in the *View pages
660660
$tlCfg->api->id_format = "[ID: %s ]";
@@ -923,7 +923,7 @@
923923
*/
924924

925925
// seems that with config options that will be used on javascript via smarty template variables
926-
// we are having problems using FALSE/TRUE => use 0/1 (or our CONSTANT DISABLED/ENABLED)
926+
// we are having problems using false/true => use 0/1 (or our CONSTANT DISABLED/ENABLED)
927927
$tlCfg->gui->checkNotSaved = ENABLED;
928928

929929
// ----------------------------------------------------------------------------
@@ -938,7 +938,7 @@
938938
/**
939939
* show/hide testcase id on tree menu
940940
*/
941-
$tlCfg->treemenu_show_testcase_id = TRUE;
941+
$tlCfg->treemenu_show_testcase_id = true;
942942

943943
/**
944944
* Reorder test cases based on TC Name or External ID in tree on
@@ -1034,7 +1034,7 @@
10341034
// Display test case version when creating:
10351035
// - test spec document
10361036
// - test reports
1037-
$tlCfg->document_generator->tc_version_enabled = TRUE;
1037+
$tlCfg->document_generator->tc_version_enabled = true;
10381038

10391039
// ----------------------------------------------------------------------------
10401040
/* [Test Executions] */
@@ -1050,21 +1050,21 @@
10501050
// DESCending -> last execution on top [STANDARD BEHAVIOUR]
10511051
$tlCfg->exec_cfg->history_order = 'DESC';
10521052

1053-
// TRUE -> the whole execution history for the choosen build will be showed
1054-
// FALSE -> just last execution for the choosen build will be showed [STANDARD BEHAVIOUR]
1055-
$tlCfg->exec_cfg->history_on = FALSE;
1053+
// true -> the whole execution history for the choosen build will be showed
1054+
// false -> just last execution for the choosen build will be showed [STANDARD BEHAVIOUR]
1055+
$tlCfg->exec_cfg->history_on = false;
10561056

1057-
// TRUE -> test case VERY LAST (i.e. in any build) execution status will be displayed [STANDARD BEHAVIOUR]
1058-
// FALSE -> only last result on current build.
1059-
$tlCfg->exec_cfg->show_last_exec_any_build = TRUE;
1057+
// true -> test case VERY LAST (i.e. in any build) execution status will be displayed [STANDARD BEHAVIOUR]
1058+
// false -> only last result on current build.
1059+
$tlCfg->exec_cfg->show_last_exec_any_build = true;
10601060

1061-
// TRUE -> History for all builds will be shown
1062-
// FALSE -> Only history of the current build will be shown [STANDARD BEHAVIOUR]
1063-
$tlCfg->exec_cfg->show_history_all_builds = FALSE;
1061+
// true -> History for all builds will be shown
1062+
// false -> Only history of the current build will be shown [STANDARD BEHAVIOUR]
1063+
$tlCfg->exec_cfg->show_history_all_builds = false;
10641064

1065-
// TRUE -> History for all platforms (if any exists for test plan) will be shown
1066-
// FALSE -> Only history of the current platform will be shown [STANDARD BEHAVIOUR]
1067-
$tlCfg->exec_cfg->show_history_all_platforms = FALSE;
1065+
// true -> History for all platforms (if any exists for test plan) will be shown
1066+
// false -> Only history of the current platform will be shown [STANDARD BEHAVIOUR]
1067+
$tlCfg->exec_cfg->show_history_all_platforms = false;
10681068

10691069
// different models for the attachments management on execution page
10701070
// $att_model_m1 -> shows upload button and title
@@ -1217,10 +1217,10 @@
12171217
// COPY OR NOT issues linked to latest execution to the new execution
12181218
// DEAFULT false => no option on GUI
12191219

1220-
$tlCfg->exec_cfg->copyLatestExecIssues->enabled = FALSE;
1220+
$tlCfg->exec_cfg->copyLatestExecIssues->enabled = false;
12211221

12221222
// value to set as default
1223-
$tlCfg->exec_cfg->copyLatestExecIssues->default = FALSE;
1223+
$tlCfg->exec_cfg->copyLatestExecIssues->default = false;
12241224

12251225
// you can choose only between columns present on
12261226
// (see exec.inc.php, function get_bugs_for_exec())
@@ -1259,8 +1259,8 @@
12591259
// ----------------------------------------------------------------------
12601260
/* [Test Specification] */
12611261

1262-
// TRUE will be displayed when displayed a test case
1263-
$tlCfg->spec_cfg->show_tplan_usage = TRUE;
1262+
// true will be displayed when displayed a test case
1263+
$tlCfg->spec_cfg->show_tplan_usage = true;
12641264

12651265
// 'horizontal' -> step and results on the same row
12661266
// 'vertical' -> steps on one row, results in the row bellow
@@ -1305,8 +1305,8 @@
13051305
// There are some preconfigured standard types which you can use,
13061306
// additionally you can configure your own types.
13071307
$tlCfg->testcase_cfg->relations = new stdClass();
1308-
$tlCfg->testcase_cfg->relations->enable = TRUE;
1309-
$tlCfg->testcase_cfg->relations->interproject_linking = FALSE;
1308+
$tlCfg->testcase_cfg->relations->enable = true;
1309+
$tlCfg->testcase_cfg->relations->interproject_linking = false;
13101310

13111311
/**
13121312
* Localization identifiers for test cases relation types
@@ -1358,28 +1358,28 @@
13581358
];
13591359

13601360
// @since 1.9.18
1361-
// TRUE => After a test case version has been executed
1361+
// true => After a test case version has been executed
13621362
// attachment on test case spec can not be added/removed
13631363
//
1364-
// FALSE
1364+
// false
13651365
//
13661366
// This means that at GUI Level, will not be possible:
13671367
// add a new attachment to an Executed Test Case Version
13681368
// delete an attachment from Executed Test Case Version
1369-
$tlCfg->testcase_cfg->downloadOnlyAfterExec = TRUE;
1369+
$tlCfg->testcase_cfg->downloadOnlyAfterExec = true;
13701370

13711371
// This means that at GUI Level, will not be possible:
13721372
// add a new req version link to an Executed Test Case Version
13731373
// delete a req version link from Executed Test Case Version
1374-
$tlCfg->testcase_cfg->reqLinkingDisabledAfterExec = TRUE;
1374+
$tlCfg->testcase_cfg->reqLinkingDisabledAfterExec = true;
13751375

13761376
// Effects on Linked Requirements Version after
13771377
// execution of a Test Case Version
1378-
$tlCfg->testcase_cfg->freezeReqVersionAfterExec = TRUE;
1378+
$tlCfg->testcase_cfg->freezeReqVersionAfterExec = true;
13791379

13801380
// Effects on TCVersion N when TCVersion N+1 is created
1381-
$tlCfg->testcase_cfg->freezeTCVersionOnNewTCVersion = TRUE;
1382-
$tlCfg->testcase_cfg->freezeTCVRelationsOnNewTCVersion = TRUE;
1381+
$tlCfg->testcase_cfg->freezeTCVersionOnNewTCVersion = true;
1382+
$tlCfg->testcase_cfg->freezeTCVRelationsOnNewTCVersion = true;
13831383

13841384
// Because:
13851385
// The Relation must be frozen (cannot be deleted) when
@@ -1389,17 +1389,17 @@
13891389
// this new configuration will allow this operation
13901390
// only on latest test case version
13911391
//
1392-
$tlCfg->testcase_cfg->addTCVRelationsOnlyOnLatestTCVersion = TRUE;
1392+
$tlCfg->testcase_cfg->addTCVRelationsOnlyOnLatestTCVersion = true;
13931393

13941394
// Not Already Implemented
1395-
// $tlCfg->testcase_cfg->allowAddTCVRelationsOnOldTCVersion = TRUE;
1395+
// $tlCfg->testcase_cfg->allowAddTCVRelationsOnOldTCVersion = true;
13961396

1397-
// $tlCfg->testcase_cfg->frozenNotExecutedTCVDelAttachtments = FALSE;
1398-
// $tlCfg->testcase_cfg->frozenNotExecutedTCVAddAttachtments = FALSE;
1399-
// $tlCfg->testcase_cfg->frozenNotExecutedTCVAddTCVRel = FALSE;
1400-
// $tlCfg->testcase_cfg->frozenNotExecutedTCVDelTCVRel = FALSE;
1401-
// $tlCfg->testcase_cfg->frozenNotExecutedTCVAddREQVLink = FALSE;
1402-
// $tlCfg->testcase_cfg->frozenNotExecutedTCVDelREQVLink = FALSE;
1397+
// $tlCfg->testcase_cfg->frozenNotExecutedTCVDelAttachtments = false;
1398+
// $tlCfg->testcase_cfg->frozenNotExecutedTCVAddAttachtments = false;
1399+
// $tlCfg->testcase_cfg->frozenNotExecutedTCVAddTCVRel = false;
1400+
// $tlCfg->testcase_cfg->frozenNotExecutedTCVDelTCVRel = false;
1401+
// $tlCfg->testcase_cfg->frozenNotExecutedTCVAddREQVLink = false;
1402+
// $tlCfg->testcase_cfg->frozenNotExecutedTCVDelREQVLink = false;
14031403

14041404
// Change order using CSS flexbox model
14051405
// @used-by tcEdit.tpl
@@ -1411,7 +1411,7 @@
14111411
// Effects on Req Version to TCVersion LINK
14121412
// when a new version of a linked Test Case is created
14131413
// If LINK is frozen, then this means that link can not be deleted.
1414-
// $tlCfg->reqTCLinks->freezeLinkOnNewTCVersion = FALSE;
1414+
// $tlCfg->reqTCLinks->freezeLinkOnNewTCVersion = false;
14151415
//
14161416
// Important Notice:
14171417
// Req Version to TCVersion Link can be done ONLY TO LATEST TCV.
@@ -1427,22 +1427,22 @@
14271427
// on GUI on the Assign Requirements Feature:
14281428
// this option has EFFECT
14291429
//
1430-
$tlCfg->reqTCLinks->freezeLinkOnNewTCVersion = TRUE;
1430+
$tlCfg->reqTCLinks->freezeLinkOnNewTCVersion = true;
14311431

14321432
// Effects on Req Version to TCVersion LINK
14331433
// when a new version of a linked Req Version is created
1434-
$tlCfg->reqTCLinks->freezeLinkOnNewREQVersion = TRUE;
1434+
$tlCfg->reqTCLinks->freezeLinkOnNewREQVersion = true;
14351435

14361436
// Effects on BOTH ends of Req Version to TCVersion LINK
14371437
// when a new version of a linked TC Version is created
1438-
$tlCfg->reqTCLinks->freezeBothEndsOnNewTCVersion = TRUE;
1438+
$tlCfg->reqTCLinks->freezeBothEndsOnNewTCVersion = true;
14391439

14401440
// Effects on BOTH ends of Req Version to TCVersion LINK
14411441
// when a new version of a linked REQ Version is created
1442-
$tlCfg->reqTCLinks->freezeBothEndsOnNewREQVersion = TRUE;
1442+
$tlCfg->reqTCLinks->freezeBothEndsOnNewREQVersion = true;
14431443

14441444
// Effects on REQ Version N when REQ Version N+1 is created
1445-
$tlCfg->req_cfg->freezeREQVersionOnNewREQVersion = TRUE;
1445+
$tlCfg->req_cfg->freezeREQVersionOnNewREQVersion = true;
14461446

14471447
/**
14481448
* text template for a new items:
@@ -1540,12 +1540,12 @@
15401540
* Attachment feature availability
15411541
*/
15421542
$tlCfg->attachments = new stdClass();
1543-
$tlCfg->attachments->enabled = TRUE;
1543+
$tlCfg->attachments->enabled = true;
15441544

1545-
// TRUE -> when you upload a file you can give no title
1546-
$tlCfg->attachments->allow_empty_title = TRUE;
1545+
// true -> when you upload a file you can give no title
1546+
$tlCfg->attachments->allow_empty_title = true;
15471547

1548-
// $tlCfg->attachments->allow_empty_title == TRUE, you can ask the system
1548+
// $tlCfg->attachments->allow_empty_title == true, you can ask the system
15491549
// to do something
15501550
//
15511551
// 'none' -> just write on db an empty title
@@ -1599,7 +1599,7 @@
15991599
* Put it out of reach via web or configure access denied.
16001600
*/
16011601
$g_repositoryPath = '/var/testlink/upload_area/'; /* unix example */
1602-
if (($upa = getenv('TESTLINK_UPLOAD_AREA'))) {
1602+
if ($upa = getenv('TESTLINK_UPLOAD_AREA')) {
16031603
$g_repositoryPath = trim($upa);
16041604
}
16051605

@@ -1620,7 +1620,7 @@
16201620
// HAS TO BE REMOVED - > req_doc_id UNIQUE INSIDE test project
16211621
// true : you want req_doc_id UNIQUE IN THE WHOLE DB (system_wide)
16221622
// false: you want req_doc_id UNIQUE INSIDE a SRS
1623-
// $tlCfg->req_cfg->reqdoc_id->is_system_wide = FALSE;
1623+
// $tlCfg->req_cfg->reqdoc_id->is_system_wide = false;
16241624

16251625
$tlCfg->req_cfg->monitor_enabled = true;
16261626

@@ -1629,11 +1629,11 @@
16291629

16301630
/**
16311631
* Test Case generation from Requirements - use_req_spec_as_testsuite_name
1632-
* FALSE => test cases are created and assigned to a test suite
1632+
* false => test cases are created and assigned to a test suite
16331633
* with name $tlCfg->req_cfg->default_testsuite_name
1634-
* TRUE => REQuirement Specification Title is used as testsuite name
1634+
* true => REQuirement Specification Title is used as testsuite name
16351635
*/
1636-
$tlCfg->req_cfg->use_req_spec_as_testsuite_name = TRUE;
1636+
$tlCfg->req_cfg->use_req_spec_as_testsuite_name = true;
16371637
$tlCfg->req_cfg->default_testsuite_name = "Auto-created Test cases";
16381638
$tlCfg->req_cfg->testsuite_details = "Test Cases in the Test Suite are generated from Requirements. " .
16391639
"A refinement of test scenario is highly recommended.";
@@ -1728,7 +1728,7 @@
17281728
$tlCfg->internal_links = new stdClass();
17291729

17301730
//
1731-
// TRUE: links to other requirements/requirement specifications are
1731+
// true: links to other requirements/requirement specifications are
17321732
// automatically generated from the corresponding Document ID, enclosed by tags (like BBCode).
17331733
//
17341734
// Usage:
@@ -1740,9 +1740,9 @@
17401740
// [req tproj=<tproj_prefix> anchor=<anchor_name>]req_doc_id[/req]
17411741
// This syntax also works for requirement specifications.
17421742
//
1743-
// FALSE: no links are automatically created.
1743+
// false: no links are automatically created.
17441744
//
1745-
$tlCfg->internal_links->enable = TRUE;
1745+
$tlCfg->internal_links->enable = true;
17461746

17471747
// how a linked document (requirement/requirement specification) should be displayed.
17481748
// posible values:
@@ -1775,8 +1775,8 @@
17751775
// There are some preconfigured standard types which you can use,
17761776
// additionally you can configure your own types.
17771777
$tlCfg->req_cfg->relations = new stdClass();
1778-
$tlCfg->req_cfg->relations->enable = TRUE;
1779-
$tlCfg->req_cfg->relations->interproject_linking = FALSE;
1778+
$tlCfg->req_cfg->relations->enable = true;
1779+
$tlCfg->req_cfg->relations->interproject_linking = false;
17801780

17811781
// Requirement/testcase diff
17821782
// default value of lines to show before and after each difference
@@ -1911,8 +1911,8 @@
19111911
$tlCfg->tree_filter_cfg->testcases->plan_mode->filter_custom_fields = ENABLED;
19121912
$tlCfg->tree_filter_cfg->testcases->plan_mode->filter_result = ENABLED;
19131913
$tlCfg->tree_filter_cfg->testcases->plan_mode->advanced_filter_mode_choice = ENABLED;
1914-
$tlCfg->tree_filter_cfg->testcases->plan_mode->setting_build_inactive_out = FALSE;
1915-
$tlCfg->tree_filter_cfg->testcases->plan_mode->setting_build_close_out = FALSE;
1914+
$tlCfg->tree_filter_cfg->testcases->plan_mode->setting_build_inactive_out = false;
1915+
$tlCfg->tree_filter_cfg->testcases->plan_mode->setting_build_close_out = false;
19161916

19171917
$tlCfg->tree_filter_cfg->testcases->plan_add_mode->filter_tc_id = ENABLED;
19181918
$tlCfg->tree_filter_cfg->testcases->plan_add_mode->filter_testcase_name = ENABLED;
@@ -2225,10 +2225,9 @@
22252225
}
22262226
}
22272227

2228-
if (false !== $serverLanguage) {
2229-
if (array_key_exists($serverLanguage, $tlCfg->locales)) {
2230-
$tlCfg->default_language = $serverLanguage;
2231-
}
2228+
if (false !== $serverLanguage &&
2229+
array_key_exists($serverLanguage, $tlCfg->locales)) {
2230+
$tlCfg->default_language = $serverLanguage;
22322231
}
22332232
define('TL_DEFAULT_LOCALE', $tlCfg->default_language);
22342233

0 commit comments

Comments
 (0)