diff --git a/WinCCOA_QualityChecks/data/qualityGates/settings/PanelCheck.json b/WinCCOA_QualityChecks/data/qualityGates/settings/PanelCheck.json index 15d20fef..d0de00ae 100644 --- a/WinCCOA_QualityChecks/data/qualityGates/settings/PanelCheck.json +++ b/WinCCOA_QualityChecks/data/qualityGates/settings/PanelCheck.json @@ -20,10 +20,10 @@ "enabled": true }, { - "id": "PanelCheck.panel.extention", + "id": "PanelCheck.panel.extension", "description":{ "de_AT.utf8":"Überprüft Dateien auf die angegebene Erweiterung", - "en_US.utf8":"Checks files for the specified extentions" + "en_US.utf8":"Checks files for the specified extensions" }, "referenceValues": ["pnl", "xml"], "scorePoints": 1, diff --git a/WinCCOA_QualityChecks/data/qualityGates/settings/PicturesFile.json b/WinCCOA_QualityChecks/data/qualityGates/settings/PicturesFile.json index 3e112c0b..c1f98326 100644 --- a/WinCCOA_QualityChecks/data/qualityGates/settings/PicturesFile.json +++ b/WinCCOA_QualityChecks/data/qualityGates/settings/PicturesFile.json @@ -12,7 +12,7 @@ "enabled": true }, { - "id": "PicturesFile.file.extention", + "id": "PicturesFile.file.extension", "description":{ "de_AT.utf8":"Überprüft die Dateierweiterung des Bildes", "en_US.utf8":"Checks the file extension of the picture" diff --git a/WinCCOA_QualityChecks/data/qualityGates/settings/README.md b/WinCCOA_QualityChecks/data/qualityGates/settings/README.md index 4a61c289..83ce050a 100644 --- a/WinCCOA_QualityChecks/data/qualityGates/settings/README.md +++ b/WinCCOA_QualityChecks/data/qualityGates/settings/README.md @@ -39,7 +39,7 @@ | Parameter | referenceValues | |-----------|------------------------------------------------------------------------------------------| -| Function | Custom values used in the check (use depends on the check)
(e.g.: allowed extentions) | +| Function | Custom values used in the check (use depends on the check)
(e.g.: allowed extensions) | | Datatypes | dyn_mixed | | Example | ["pnl", "xml", ""] |
diff --git a/WinCCOA_QualityChecks/data/qualityGates/settings/ScriptFile.json b/WinCCOA_QualityChecks/data/qualityGates/settings/ScriptFile.json index f5e02d5b..614c358b 100644 --- a/WinCCOA_QualityChecks/data/qualityGates/settings/ScriptFile.json +++ b/WinCCOA_QualityChecks/data/qualityGates/settings/ScriptFile.json @@ -11,7 +11,7 @@ "enabled": true }, { - "id": "ScriptFile.file.extention", + "id": "ScriptFile.file.extension", "description":{ "de_AT.utf8":"Überprüft Dateien auf die angegebenen Erweiterungen", "en_US.utf8":"Checks files for the specified extensions" diff --git a/WinCCOA_QualityChecks/msg/de_AT.utf8/QgStaticCheck_Internal.cat b/WinCCOA_QualityChecks/msg/de_AT.utf8/QgStaticCheck_Internal.cat index 638cb512..3cdd49a1 100644 --- a/WinCCOA_QualityChecks/msg/de_AT.utf8/QgStaticCheck_Internal.cat +++ b/WinCCOA_QualityChecks/msg/de_AT.utf8/QgStaticCheck_Internal.cat @@ -1,5 +1,5 @@ details,WinCCOA internal files assert.exist,File '$file.name' exist? reason.exist,The file '$file.name' does not exist -assert.WinCCOALicenseCtrlExtExist,Contains WinCCOALicenseCtrlExt extention? +assert.WinCCOALicenseCtrlExtExist,Contains WinCCOALicenseCtrlExt extension? reason.WinCCOALicenseCtrlExtExist,Contains WinCCOALicenseCtrlExt. diff --git a/WinCCOA_QualityChecks/msg/de_AT.utf8/QgStaticCheck_OverloadedFiles.cat b/WinCCOA_QualityChecks/msg/de_AT.utf8/QgStaticCheck_OverloadedFiles.cat index 60529df1..3a023e3c 100644 --- a/WinCCOA_QualityChecks/msg/de_AT.utf8/QgStaticCheck_OverloadedFiles.cat +++ b/WinCCOA_QualityChecks/msg/de_AT.utf8/QgStaticCheck_OverloadedFiles.cat @@ -1,7 +1,7 @@ -assert.isCheater,Is file overloaded +assert.isCheater,Check if file $location is overloaded. reason.isCheater,It is not allowed to overwrite WinCCOA-license check files: $file.name filesList,Files -assert.isOverloaded,Is file overloaded +assert.isOverloaded,Check if file $location is overloaded. reason.isOverloaded,The file '$file.name' is overloaded from '$file.isOverloadedFrom'. -assert.isOverloadedAllowed,Is file overloaded +assert.isOverloadedAllowed,Check if file $location is overloaded (allowed overloads). reason.isOverloadedAllowed,The file '$file.name' is overloaded from '$file.isOverloadedFrom'. -> It's allowed diff --git a/WinCCOA_QualityChecks/msg/de_AT.utf8/QgStaticCheck_Panels.cat b/WinCCOA_QualityChecks/msg/de_AT.utf8/QgStaticCheck_Panels.cat index 0f5d5d92..a806255a 100644 --- a/WinCCOA_QualityChecks/msg/de_AT.utf8/QgStaticCheck_Panels.cat +++ b/WinCCOA_QualityChecks/msg/de_AT.utf8/QgStaticCheck_Panels.cat @@ -12,8 +12,8 @@ assert.panel.isCalculated,Is calculated reason.panel.isCalculated,Sorry, the panel '($panel.name)' can't be calculated. assert.panel.isExampleFile,Is example reason.panel.isExampleFile,The panel '($panel.name)' is an example file. Examples are ignored. -assert.panel.extention,Extention -reason.panel.extention,The panel '$panel.name' has an invalid extention '$panel.extention'. +assert.panel.extension,Extension +reason.panel.extension,The panel '$panel.name' has an invalid extension '$panel.extension'. assert.panel.isBackUp,Backup panel (.bak) reason.panel.isBackUp,Sorry, the panel '($panel.name)' is a backup, can't be calculated. assert.panel.isCrypted,Is encrypted. diff --git a/WinCCOA_QualityChecks/msg/de_AT.utf8/QgStaticCheck_Pictures.cat b/WinCCOA_QualityChecks/msg/de_AT.utf8/QgStaticCheck_Pictures.cat index 343ddc3d..7b041400 100644 --- a/WinCCOA_QualityChecks/msg/de_AT.utf8/QgStaticCheck_Pictures.cat +++ b/WinCCOA_QualityChecks/msg/de_AT.utf8/QgStaticCheck_Pictures.cat @@ -11,5 +11,5 @@ filesList,Files subDirsList,Sub directories assert.file.size,Size reason.file.size,The picture '$file.name' is too big ($file.size). -assert.file.extention,Extention -reason.file.extention,The picture '$file.name' has an invalid extention '$file.extention'. +assert.file.extension,Extension +reason.file.extension,The picture '$file.name' has an invalid extension '$file.extension'. Possible extensions: $allowedValues diff --git a/WinCCOA_QualityChecks/msg/de_AT.utf8/QgStaticCheck_ScriptFile.cat b/WinCCOA_QualityChecks/msg/de_AT.utf8/QgStaticCheck_ScriptFile.cat index 1b8caf22..2d682275 100644 --- a/WinCCOA_QualityChecks/msg/de_AT.utf8/QgStaticCheck_ScriptFile.cat +++ b/WinCCOA_QualityChecks/msg/de_AT.utf8/QgStaticCheck_ScriptFile.cat @@ -2,5 +2,5 @@ assert.file.isCalculated,Is calculated reason.file.isCalculated,Sorry, the script '($file.name)' can't be calculated. assert.file.isExampleFile,Is an example file reason.file.isExampleFile,The script '($file.name)' is an example file. Examples are ignored. -assert.file.extention,Extention -reason.file.extention,The script '$file.name' has an invalid extention '$file.extention'. +assert.file.extension,Extension +reason.file.extension,The script '$file.name' has an invalid extension '$file.extension'. diff --git a/WinCCOA_QualityChecks/msg/en_US.utf8/QgStaticCheck_Internal.cat b/WinCCOA_QualityChecks/msg/en_US.utf8/QgStaticCheck_Internal.cat index 638cb512..3cdd49a1 100644 --- a/WinCCOA_QualityChecks/msg/en_US.utf8/QgStaticCheck_Internal.cat +++ b/WinCCOA_QualityChecks/msg/en_US.utf8/QgStaticCheck_Internal.cat @@ -1,5 +1,5 @@ details,WinCCOA internal files assert.exist,File '$file.name' exist? reason.exist,The file '$file.name' does not exist -assert.WinCCOALicenseCtrlExtExist,Contains WinCCOALicenseCtrlExt extention? +assert.WinCCOALicenseCtrlExtExist,Contains WinCCOALicenseCtrlExt extension? reason.WinCCOALicenseCtrlExtExist,Contains WinCCOALicenseCtrlExt. diff --git a/WinCCOA_QualityChecks/msg/en_US.utf8/QgStaticCheck_OverloadedFiles.cat b/WinCCOA_QualityChecks/msg/en_US.utf8/QgStaticCheck_OverloadedFiles.cat index 60529df1..3a023e3c 100644 --- a/WinCCOA_QualityChecks/msg/en_US.utf8/QgStaticCheck_OverloadedFiles.cat +++ b/WinCCOA_QualityChecks/msg/en_US.utf8/QgStaticCheck_OverloadedFiles.cat @@ -1,7 +1,7 @@ -assert.isCheater,Is file overloaded +assert.isCheater,Check if file $location is overloaded. reason.isCheater,It is not allowed to overwrite WinCCOA-license check files: $file.name filesList,Files -assert.isOverloaded,Is file overloaded +assert.isOverloaded,Check if file $location is overloaded. reason.isOverloaded,The file '$file.name' is overloaded from '$file.isOverloadedFrom'. -assert.isOverloadedAllowed,Is file overloaded +assert.isOverloadedAllowed,Check if file $location is overloaded (allowed overloads). reason.isOverloadedAllowed,The file '$file.name' is overloaded from '$file.isOverloadedFrom'. -> It's allowed diff --git a/WinCCOA_QualityChecks/msg/en_US.utf8/QgStaticCheck_Panels.cat b/WinCCOA_QualityChecks/msg/en_US.utf8/QgStaticCheck_Panels.cat index 0f5d5d92..a806255a 100644 --- a/WinCCOA_QualityChecks/msg/en_US.utf8/QgStaticCheck_Panels.cat +++ b/WinCCOA_QualityChecks/msg/en_US.utf8/QgStaticCheck_Panels.cat @@ -12,8 +12,8 @@ assert.panel.isCalculated,Is calculated reason.panel.isCalculated,Sorry, the panel '($panel.name)' can't be calculated. assert.panel.isExampleFile,Is example reason.panel.isExampleFile,The panel '($panel.name)' is an example file. Examples are ignored. -assert.panel.extention,Extention -reason.panel.extention,The panel '$panel.name' has an invalid extention '$panel.extention'. +assert.panel.extension,Extension +reason.panel.extension,The panel '$panel.name' has an invalid extension '$panel.extension'. assert.panel.isBackUp,Backup panel (.bak) reason.panel.isBackUp,Sorry, the panel '($panel.name)' is a backup, can't be calculated. assert.panel.isCrypted,Is encrypted. diff --git a/WinCCOA_QualityChecks/msg/en_US.utf8/QgStaticCheck_Pictures.cat b/WinCCOA_QualityChecks/msg/en_US.utf8/QgStaticCheck_Pictures.cat index 343ddc3d..7b041400 100644 --- a/WinCCOA_QualityChecks/msg/en_US.utf8/QgStaticCheck_Pictures.cat +++ b/WinCCOA_QualityChecks/msg/en_US.utf8/QgStaticCheck_Pictures.cat @@ -11,5 +11,5 @@ filesList,Files subDirsList,Sub directories assert.file.size,Size reason.file.size,The picture '$file.name' is too big ($file.size). -assert.file.extention,Extention -reason.file.extention,The picture '$file.name' has an invalid extention '$file.extention'. +assert.file.extension,Extension +reason.file.extension,The picture '$file.name' has an invalid extension '$file.extension'. Possible extensions: $allowedValues diff --git a/WinCCOA_QualityChecks/msg/en_US.utf8/QgStaticCheck_ScriptFile.cat b/WinCCOA_QualityChecks/msg/en_US.utf8/QgStaticCheck_ScriptFile.cat index 1b8caf22..2d682275 100644 --- a/WinCCOA_QualityChecks/msg/en_US.utf8/QgStaticCheck_ScriptFile.cat +++ b/WinCCOA_QualityChecks/msg/en_US.utf8/QgStaticCheck_ScriptFile.cat @@ -2,5 +2,5 @@ assert.file.isCalculated,Is calculated reason.file.isCalculated,Sorry, the script '($file.name)' can't be calculated. assert.file.isExampleFile,Is an example file reason.file.isExampleFile,The script '($file.name)' is an example file. Examples are ignored. -assert.file.extention,Extention -reason.file.extention,The script '$file.name' has an invalid extention '$file.extention'. +assert.file.extension,Extension +reason.file.extension,The script '$file.name' has an invalid extension '$file.extension'. diff --git a/WinCCOA_QualityChecks/scripts/QualityGates/QGatesConvertOaTestToJUnitXml.ctl b/WinCCOA_QualityChecks/scripts/QualityGates/QGatesConvertOaTestToJUnitXml.ctl deleted file mode 100644 index a2d3a8f6..00000000 --- a/WinCCOA_QualityChecks/scripts/QualityGates/QGatesConvertOaTestToJUnitXml.ctl +++ /dev/null @@ -1,225 +0,0 @@ -// -// CtrlppCheck -// a static code analysis tool for WinCC OA's Ctrl language -// -// Copyright 2022 SIEMENS AG -// -// SPDX-License-Identifier: GPL-3.0-only -// - -/// @cond WinCCOA_intern - -//-------------------------------------------------------------------------------- -// used libraries (#uses) -#uses "fileSys" -#uses "csv" -#uses "CtrlXml" - -//-------------------------------------------------------------------------------- -class OaTestToXml -{ - public void setData(const dyn_dyn_string &csv, string testSuiteName) - { - _testSuiteName = testSuiteName; - _header = csv[1]; - _csv = csv; - dynRemove(_csv, 1); - } - - public void parseData() - { - if ( _xmlDocNum == -1 ) - { - _xmlDocNum = xmlNewDocument(); - _parentNode = xmlAppendChild(_xmlDocNum, -1, XML_ELEMENT_NODE, "testsuites"); - } - - _addTestSuite(); - - -// xmlSetElementAttribute(_xmlDocNum, _parentNode, "duration", _sumDuration); - } - - - public void writeDocument(const string filePath) - { - xmlDocumentToFile(_xmlDocNum, filePath); - xmlCloseDocument(_xmlDocNum); - dynClear(_csv); - _xmlDocNum = -1; - } - - private void _addTestSuite() - { - _tsNode = xmlAppendChild(_xmlDocNum, _parentNode, XML_ELEMENT_NODE, "testsuite"); - xmlSetElementAttribute(_xmlDocNum, _tsNode, "name", _testSuiteName); - - _tsTimestamp = ""; - _tsTime = 0; - _tsErrors = 0; - _tsTests = 0; - _tsFailures = 0; - _tsSkipped = 0; - _tsErr = 0; - - for(int i = 1; i <= dynlen(_csv); i++) - _addTestCase(_csv[i]); - - string sTime; - if ( dynlen(_csv) > 0 ) - { - _tsTimestamp = _csv[1][_idxStartTimeStamp]; - time t1 = _csv[1][_idxStartTimeStamp]; - time t2 = _csv[dynlen(_csv)][_idxEndTimeStamp]; - time tDiff = t2 - t1; - _tsTime = (float)tDiff; - sTime = _tsTime; - strreplace(sTime, ",", "."); - } - xmlSetElementAttribute(_xmlDocNum, _tsNode, "timestamp", _tsTimestamp); - xmlSetElementAttribute(_xmlDocNum, _tsNode, "time", sTime); - xmlSetElementAttribute(_xmlDocNum, _tsNode, "errors", _tsErrors); - xmlSetElementAttribute(_xmlDocNum, _tsNode, "tests", _tsTests); - xmlSetElementAttribute(_xmlDocNum, _tsNode, "failures", _tsFailures); - xmlSetElementAttribute(_xmlDocNum, _tsNode, "skipped", _tsSkipped); - - _sumDuration = _sumDuration + _tsTime; - } - - private void _addTestCase(const dyn_string &tcItems) - { - if ( dynlen(tcItems) < _idxMethod ) - { - DebugTN(__FUNCTION__, "missing items", tcItems); - return; - } - const string method = tcItems[_idxMethod]; - - if ( method == "oaUnitInfo" ) - return; // junit don supported info state - - _tsTests++; - - _tcNode = xmlAppendChild(_xmlDocNum, _tsNode, XML_ELEMENT_NODE, "testcase"); - xmlSetElementAttribute(_xmlDocNum, _tcNode, "class", ""); - xmlSetElementAttribute(_xmlDocNum, _tcNode, "name", tcItems[_idxTcId]); - - string duration = tcItems[_idxDuration]; - strreplace(duration, ",", "."); - xmlSetElementAttribute(_xmlDocNum, _tcNode, "time", duration); - - const string state = tcItems[_idxState]; - - if ( state == "Pass" ) - return; - else if ( state == "Fail" ) - _addFailure(tcItems, "failure"); - else if ( state == "Aborted" ) - _addFailure(tcItems, "error"); - else // undefined state is allways a error - _addFailure(tcItems, "failure"); - } - - private void _addFailure(const dyn_string &tcItems, string type) - { - string msg = tcItems[_idxErrMsg]; - if ( tcItems[_idxNote] ) - msg = msg + " Note: " + tcItems[_idxNote]; - - const string knownBug = tcItems[_idxKnownBug]; - - if( knownBug != "" ) - { - type = "skipped"; - _tsSkipped++; - msg = msg + " Known bug: " + knownBug; - } - else if ( type == "failure" ) - _tsFailures++; - else - _tsErrors++; - - int node = xmlAppendChild(_xmlDocNum, _tcNode, XML_ELEMENT_NODE, type); - int attr = xmlAppendChild(_xmlDocNum, node, XML_TEXT_NODE, type); - - - xmlSetElementAttribute(_xmlDocNum, node, "message", msg); - xmlSetNodeValue(_xmlDocNum, attr, tcItems[_idxStackTrace]); - } - - - int _idxTcId = 1; - int _idxStartTimeStamp = 2; - int _idxEndTimeStamp = 3; - int _idxDuration = 4; - int _idxMethod = 5; - int _idxState = 6; - int _idxErrMsg = 13; - int _idxKnownBug = 14; - int _idxNote = 15; - int _idxStackTrace = 18; - - float _sumDuration; - - string _tsTimestamp; - float _tsTime; - int _tsErrors; - int _tsTests; - int _tsFailures; - int _tsSkipped; - int _tsErr; - - int _parentNode = -1; - int _tsNode = -1; - int _tcNode = -1; - int _xmlDocNum = -1; - - string _testSuiteName; - dyn_string _header; - dyn_dyn_string _csv; -}; - - -//-------------------------------------------------------------------------------- -main() -{ - string resultDir = makeNativePath(getenv("WORKSPACE") + "/test/"); - -// string resultDir = getPath(DATA_REL_PATH); - if ( resultDir == "" || !isdir(resultDir) ) - { - DebugTN("test result dir does not exists. Check env variable WORKSPACE", resultDir); - exit(0); - } - - dyn_string fileNames = getFileNamesRecursive(resultDir); - - OaTestToXml parser = OaTestToXml(); - - for(int i = 1; i <= dynlen(fileNames); i++) - { - if ( !isfile(fileNames[i]) || getExt(fileNames[i]) == "xml" ) - continue; - - const string testFilePath = fileNames[i]; - - dyn_dyn_string csv; - csvFileRead(testFilePath, csv, ";"); - - if ( dynlen(csv) < 1 ) - { - DebugTN("test result is missing", testFilePath); - exit(-1); - } - - string testSuiteName = baseName(testFilePath); - testSuiteName = delExt(testSuiteName); - parser.setData(csv, testSuiteName); - parser.parseData(); - } - - parser.writeDocument(resultDir + "result.xml"); -} - - -// @endcond diff --git a/WinCCOA_QualityChecks/scripts/QualityGates/StaticTests/QgCtrlppCheck.ctl b/WinCCOA_QualityChecks/scripts/QualityGates/StaticTests/QgCtrlppCheck.ctl index 1077873b..0af6866f 100644 --- a/WinCCOA_QualityChecks/scripts/QualityGates/StaticTests/QgCtrlppCheck.ctl +++ b/WinCCOA_QualityChecks/scripts/QualityGates/StaticTests/QgCtrlppCheck.ctl @@ -9,7 +9,7 @@ #uses "classes/QualityGates/QgCtrlppCheck/QgCtrlppCheck" -void main() +void main(string path = PROJ_PATH) { - exit(start_QgCtrlppCheck()); + exit(start_QgCtrlppCheck(path)); } diff --git a/WinCCOA_QualityChecks/scripts/QualityGates/StaticTests/QgPanelsCheck.ctl b/WinCCOA_QualityChecks/scripts/QualityGates/StaticTests/QgPanelsCheck.ctl index 4bf2c615..9acd1560 100644 --- a/WinCCOA_QualityChecks/scripts/QualityGates/StaticTests/QgPanelsCheck.ctl +++ b/WinCCOA_QualityChecks/scripts/QualityGates/StaticTests/QgPanelsCheck.ctl @@ -26,6 +26,7 @@ class QgStaticPanelCheck : QgBase //-------------------------------------------------------------------------------- //@public members //-------------------------------------------------------------------------------- + public string checkedPath = PROJ_PATH; //------------------------------------------------------------------------------ /** @brief Function setups panels tests. @@ -36,8 +37,9 @@ class QgStaticPanelCheck : QgBase { if ( QgBase::setUp() ) return -1; - - _panels.setDir(PROJ_PATH + PANELS_REL_PATH); + + throwError(makeError("", PRIO_INFO, ERR_CONTROL, 0, Qg::getId() + " will check " + this.checkedPath + PANELS_REL_PATH)); + _panels.setDir(this.checkedPath + PANELS_REL_PATH); if ( !_panels.exists() ) setMinValidScore("QgStaticCheck_Panels", "assert.missingPanels", "reason.missingPanels"); @@ -90,10 +92,11 @@ class QgStaticPanelCheck : QgBase /** @breif main rutine to start QualityGate QgStaticCheck-panels */ -void main() +void main(string path = PROJ_PATH) { Qg::setId("QgStaticCheck_Panels"); QgStaticPanelCheck qg = QgStaticPanelCheck(); + qg.checkedPath = path; exit(qg.start()); } diff --git a/WinCCOA_QualityChecks/scripts/QualityGates/StaticTests/QgPicturesCheck.ctl b/WinCCOA_QualityChecks/scripts/QualityGates/StaticTests/QgPicturesCheck.ctl index e827a8f4..71cc6cfa 100644 --- a/WinCCOA_QualityChecks/scripts/QualityGates/StaticTests/QgPicturesCheck.ctl +++ b/WinCCOA_QualityChecks/scripts/QualityGates/StaticTests/QgPicturesCheck.ctl @@ -27,6 +27,7 @@ class QgStaticCheck_Pictures : QgBase //-------------------------------------------------------------------------------- //@public members //-------------------------------------------------------------------------------- + public string checkedPath = PROJ_PATH; //------------------------------------------------------------------------------ /** @brief Function setups pictures tests. @@ -37,8 +38,9 @@ class QgStaticCheck_Pictures : QgBase { if ( QgBase::setUp() ) return -1; - - _pictures.setDir(PROJ_PATH + PICTURES_REL_PATH); + + throwError(makeError("", PRIO_INFO, ERR_CONTROL, 0, Qg::getId() + " will check " + this.checkedPath + PICTURES_REL_PATH)); + _pictures.setDir(this.checkedPath + PICTURES_REL_PATH); if ( !_pictures.exists() ) setMinValidScore("QgStaticCheck_Pictures", "assert.missingPictures", "reason.missingPictures"); @@ -91,9 +93,10 @@ class QgStaticCheck_Pictures : QgBase /** @breif main rutine to start QualityGate QgStaticCheck-Pictures */ -void main() +void main(string path = PROJ_PATH) { Qg::setId("QgStaticCheck_Pictures"); QgStaticCheck_Pictures qg = QgStaticCheck_Pictures(); + qg.checkedPath = path; exit(qg.start()); } diff --git a/WinCCOA_QualityChecks/scripts/QualityGates/StaticTests/QgScriptsCheck.ctl b/WinCCOA_QualityChecks/scripts/QualityGates/StaticTests/QgScriptsCheck.ctl index 21030386..aa680bbc 100644 --- a/WinCCOA_QualityChecks/scripts/QualityGates/StaticTests/QgScriptsCheck.ctl +++ b/WinCCOA_QualityChecks/scripts/QualityGates/StaticTests/QgScriptsCheck.ctl @@ -24,20 +24,25 @@ */ class QgStaticCheck_Scripts : QgBase { - + public string checkedPath = PROJ_PATH; public int setUp() { if ( QgBase::setUp() ) + { + throwError(makeError("", PRIO_SEVERE, ERR_CONTROL, 0, "QgBase::setUp fails")); return -1; + } if ( Qg::getId() == "QgStaticCheck_Scripts" ) { - _scriptsData.setDir(PROJ_PATH + SCRIPTS_REL_PATH); + throwError(makeError("", PRIO_INFO, ERR_CONTROL, 0, Qg::getId() + " will check " + this.checkedPath + SCRIPTS_REL_PATH)); + _scriptsData.setDir(this.checkedPath + SCRIPTS_REL_PATH); _scriptsData.setType(ScriptsDataType::scripts); } else if ( Qg::getId() == "QgStaticCheck_Libs" ) { - _scriptsData.setDir(PROJ_PATH + LIBS_REL_PATH); + throwError(makeError("", PRIO_INFO, ERR_CONTROL, 0, Qg::getId() + " will check " + this.checkedPath + LIBS_REL_PATH)); + _scriptsData.setDir(this.checkedPath + LIBS_REL_PATH); _scriptsData.setType(ScriptsDataType::libs); } @@ -57,9 +62,8 @@ class QgStaticCheck_Scripts : QgBase public int validate() { - if ( (Qg::getId() == "QgStaticCheck_Scripts") && (_scriptsData.getCountOfFilesRecursive() <= 0) && - isdir(PROJ_PATH + LIBS_REL_PATH) && (_scriptsData.getCountOfSubDirs() <= 0) ) + isdir(this.checkedPath + LIBS_REL_PATH) && (_scriptsData.getCountOfSubDirs() <= 0) ) { // there are no scripts. Libs only and libs are checked in QgStaticCheck_Libs setMinValidScore("QgStaticCheck_Scripts", "assert.missingScripts", "reason.missingScripts"); @@ -83,7 +87,7 @@ class QgStaticCheck_Scripts : QgBase /** Main rutine to start QG-Static check of scripts */ -void main(string testType) +void main(string testType, string path = PROJ_PATH) { if ( testType == "scripts" ) { @@ -100,5 +104,6 @@ void main(string testType) } QgStaticCheck_Scripts qg = QgStaticCheck_Scripts(); + qg.checkedPath = path; exit(qg.start()); } diff --git a/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgApp.ctl b/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgApp.ctl index 96a05320..aa031619 100644 --- a/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgApp.ctl +++ b/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgApp.ctl @@ -18,6 +18,7 @@ class QgApp _isValid = FALSE; if ( id == "" ) { + /// @todo I think we can remove this class, because always ends here. DebugFTN("QgApp", "!!! Parameter #1 (id) is missing" ); return; } diff --git a/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgBase.ctl b/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgBase.ctl index 5f371676..2e4fb06b 100644 --- a/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgBase.ctl +++ b/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgBase.ctl @@ -11,7 +11,7 @@ // used libraries (#uses) #uses "classes/QualityGates/AddOn/FileSys/QgAddOnTmpSourceDir" #uses "classes/QualityGates/QgResultPublisher" -#uses "classes/StTest" +#uses "classes/oaTest/OaTest" #uses "classes/QualityGates/Qg" #uses "classes/QualityGates/QgMsgCat" #uses "classes/QualityGates/QgVersionResult" @@ -20,7 +20,7 @@ // declare variables and constans QgMsgCat myQgMsgCat = QgMsgCat(); -StTest myTest = StTest(); +OaTest myTest = OaTest(); @@ -50,7 +50,6 @@ class QgBase */ public int setUp() { - myTest.testSuiteId = Qg::getId(); myTest.setUp(); myQgMsgCat.setName(Qg::getId()); @@ -153,7 +152,6 @@ class QgBase //-------------------------------------------------------------------------------- protected QgAddOnTmpSourceDir _sourceDir = QgAddOnTmpSourceDir(); protected QgResultPublisher _publisher = QgResultPublisher(); - //protected QgVersionResult _result = QgVersionResult(); protected shared_ptr _result; protected bool _setMinScore = FALSE; diff --git a/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgCtrlppCheck/QgCtrlppCheck.ctl b/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgCtrlppCheck/QgCtrlppCheck.ctl index bd4b3483..f4c0f522 100644 --- a/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgCtrlppCheck/QgCtrlppCheck.ctl +++ b/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgCtrlppCheck/QgCtrlppCheck.ctl @@ -25,6 +25,7 @@ class QgCtrlppCheck : QgBase //-------------------------------------------------------------------------------- //@public members //-------------------------------------------------------------------------------- + public string checkedPath = PROJ_PATH; //------------------------------------------------------------------------------ /** @brief Calculates / start ctrlppcheck. @@ -33,7 +34,7 @@ class QgCtrlppCheck : QgBase */ public int calculate() { - return checkDir(PROJ_PATH + SCRIPTS_REL_PATH); + return checkDir(this.checkedPath + SCRIPTS_REL_PATH); } //------------------------------------------------------------------------------ @@ -60,14 +61,14 @@ class QgCtrlppCheck : QgBase "_CtrlppCheck.filter.severity", disabledSeverities); includeFilesPattern = "*"; } - else if ( Qg::isRunningOnJenkins() ) - { - disabledIds = makeDynString("debug", "unreadVariable", - "checkLibraryFunction", "checkLibraryNoReturn", - "unusedFunction"); - disabledSeverities = makeDynString("debug", "information"); - includeFilesPattern = makeUnixPath(dirPath + "*"); - } + // else if ( Qg::isRunningOnJenkins() ) + // { + // disabledIds = makeDynString("debug", "unreadVariable", + // "checkLibraryFunction", "checkLibraryNoReturn", + // "unusedFunction"); + // disabledSeverities = makeDynString("debug", "information"); + // includeFilesPattern = makeUnixPath(dirPath + "*"); + // } else { disabledIds = makeDynString("debug", "unreadVariable", @@ -125,15 +126,15 @@ class QgCtrlppCheck : QgBase "_CtrlppCheck.settings.verbose", check.settings.verbose, "_CtrlppCheck.settings.inlineSuppressions", check.settings.inlineSuppressions); } - else if ( Qg::isRunningOnJenkins() ) - { - check.settings.enableLibCheck = FALSE; - //check.settings.enableHeadersCheck = TRUE; // currently disabled - check.settings.includeSubProjects = TRUE; - check.settings.inconclusive = FALSE; - check.settings.verbose = FALSE; - check.settings.inlineSuppressions = TRUE; - } + // else if ( Qg::isRunningOnJenkins() ) + // { + // check.settings.enableLibCheck = FALSE; + // check.settings.enableHeadersCheck = TRUE; + // check.settings.includeSubProjects = TRUE; + // check.settings.inconclusive = FALSE; + // check.settings.verbose = FALSE; + // check.settings.inlineSuppressions = TRUE; + // } else { check.settings.enableCheckLibrary(FALSE); @@ -186,9 +187,10 @@ class QgCtrlppCheck : QgBase /// Start Qg ctrlppcheck. /// Simple old ctrl style. -public int start_QgCtrlppCheck() +public int start_QgCtrlppCheck(string path = PROJ_PATH) { Qg::setId("QgCtrlppCheck"); QgCtrlppCheck qg = QgCtrlppCheck(); + qg.checkedPath = path; return qg.start(); } diff --git a/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgOverloadedFilesCheck/QgOverloadedFilesCheck.ctl b/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgOverloadedFilesCheck/QgOverloadedFilesCheck.ctl index a9fde0a5..9794dcf2 100644 --- a/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgOverloadedFilesCheck/QgOverloadedFilesCheck.ctl +++ b/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgOverloadedFilesCheck/QgOverloadedFilesCheck.ctl @@ -118,6 +118,7 @@ class QgOverloadedFilesCheck { result.setMsgCatName("QgStaticCheck_OverloadedFiles"); result.setAssertionText("filesList"); + result.setLocation(PROJ_PATH); for(int i = 1; i <= dynlen(_relPaths); i++) { @@ -129,6 +130,7 @@ class QgOverloadedFilesCheck if ( settings.isEnabled() ) { shared_ptr assertion = new QgVersionResult(); + assertion.setLocation(relPath); assertion.setMsgCatName("QgStaticCheck_OverloadedFiles"); if ( isAllowed(relPath) ) diff --git a/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgResultPublisher.ctl b/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgResultPublisher.ctl index 613a04e9..2744840f 100644 --- a/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgResultPublisher.ctl +++ b/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgResultPublisher.ctl @@ -127,7 +127,7 @@ class QgResultPublisher //------------------------------------------------------------------------------ protected int _publishFull(const QgAddOnResultsDir &resDir) { - if ( Qg::isRunningOnJenkins() ) + if ( Qg::isRunningOnJenkins() || true ) return _publishFullOnJenkins(resDir); else return _publishFullLocale(resDir); diff --git a/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgStaticCheck/CtrlCode/FunctionData.ctl b/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgStaticCheck/CtrlCode/FunctionData.ctl index d70167ce..bc8edd35 100644 --- a/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgStaticCheck/CtrlCode/FunctionData.ctl +++ b/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgStaticCheck/CtrlCode/FunctionData.ctl @@ -7,8 +7,6 @@ // SPDX-License-Identifier: GPL-3.0-only // -#uses "classes/QualityGates/QgBase" -#uses "CtrlOaUnit" #uses "classes/QualityGates/Tools/Lizard/ToolLizard" #uses "classes/QualityGates/QgSettings" diff --git a/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgStaticCheck/CtrlCode/ScriptData.ctl b/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgStaticCheck/CtrlCode/ScriptData.ctl index fcc18e19..5d1f9617 100644 --- a/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgStaticCheck/CtrlCode/ScriptData.ctl +++ b/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgStaticCheck/CtrlCode/ScriptData.ctl @@ -9,9 +9,7 @@ #uses "classes/QualityGates/Tools/Python/Python" #uses "classes/FileSys/QgFile" -#uses "classes/QualityGates/QgBase" #uses "csv" -#uses "CtrlOaUnit" #uses "classes/QualityGates/Tools/Lizard/ToolLizard" #uses "classes/QualityGates/QgStaticCheck/CtrlCode/FunctionData" #uses "classes/Variables/Float" @@ -63,7 +61,7 @@ class ScriptData //------------------------------------------------------------------------------ /** - Return the checked file name with extention. + Return the checked file name with extension. @note Not full path only the file name. */ public string getName() diff --git a/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgStaticCheck/CtrlCode/ScriptFile.ctl b/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgStaticCheck/CtrlCode/ScriptFile.ctl index b434491b..353393b0 100644 --- a/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgStaticCheck/CtrlCode/ScriptFile.ctl +++ b/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgStaticCheck/CtrlCode/ScriptFile.ctl @@ -24,8 +24,8 @@ class ScriptFile : QgFile public ScriptFile(string filePath = "") { setFilePath(filePath); - // !! extention must be written lowercase, that NonCaseSensitive works - _enabledExtentions = makeDynString("ctl", "ctc"); + // !! extension must be written lowercase, that NonCaseSensitive works + _enabledExtensions = makeDynString("ctl", "ctc"); } //------------------------------------------------------------------------------ @@ -56,7 +56,7 @@ class ScriptFile : QgFile public int calculate() { _isCalculated = FALSE; - _extention = getExt(getFilePath()); + _extension = getExt(getFilePath()); if ( !isfile(getFilePath()) ) { @@ -117,17 +117,17 @@ class ScriptFile : QgFile } { - shared_ptr settings = new QgSettings("ScriptFile.file.extention"); + shared_ptr settings = new QgSettings("ScriptFile.file.extension"); if ( settings.isEnabled() ) { - // check for valid extentions + // check for valid extensions shared_ptr assertion = new QgVersionResult(); assertion.setMsgCatName("QgStaticCheck_ScriptFile"); - assertion.setAssertionText("assert.file.extention"); - assertion.setReasonText("reason.file.extention", makeMapping("file.name", getName(), - "file.extention", _extention)); - if ( !assertion.assertDynContains(settings.getReferenceValues(), strtolower(_extention), settings.getScorePoints()) ) + assertion.setAssertionText("assert.file.extension"); + assertion.setReasonText("reason.file.extension", makeMapping("file.name", getName(), + "file.extension", _extension)); + if ( !assertion.assertDynContains(settings.getReferenceValues(), strtolower(_extension), settings.getScorePoints()) ) { result.addChild(assertion); return 0; @@ -191,8 +191,8 @@ class ScriptFile : QgFile protected ScriptData _scriptData = ScriptData(); - static dyn_string _enabledExtentions = makeDynString(); - string _extention; + static dyn_string _enabledExtensions = makeDynString(); + string _extension; bool _isCalculated; diff --git a/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgStaticCheck/Panels/PanelCheck.ctl b/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgStaticCheck/Panels/PanelCheck.ctl index 26484203..4c0204da 100644 --- a/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgStaticCheck/Panels/PanelCheck.ctl +++ b/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgStaticCheck/Panels/PanelCheck.ctl @@ -9,11 +9,9 @@ #uses "classes/QualityGates/QgVersionResult" #uses "classes/FileSys/QgFile" -#uses "classes/QualityGates/QgBase" #uses "classes/QualityGates/QgAddOnResultErr" #uses "classes/QualityGates/QgStaticCheck/Panels/PanelFile/PanelFile" #uses "classes/QualityGates/QgSettings" -#uses "CtrlOaUnit" //-------------------------------------------------------------------------------- /** @@ -37,8 +35,8 @@ class PanelCheck : QgFile public PanelCheck(const string &filePath) { setFilePath(filePath); - // !! extention must be written lowercase, that NonCaseSensitive works - _enabledExtentions = makeDynString("pnl", "xml", ""); + // !! extension must be written lowercase, that NonCaseSensitive works + _enabledExtensions = makeDynString("pnl", "xml", ""); } //------------------------------------------------------------------------------ @@ -147,7 +145,7 @@ class PanelCheck : QgFile return 0; } - _extention = getExt(getFilePath()); + _extension = getExt(getFilePath()); _pnl.read(); @@ -236,7 +234,7 @@ class PanelCheck : QgFile if ( validateIsExample() || validateIsBackUp() || - validateExtention() || + validateExtension() || validateIsCrypted() || validateIsCalculated() ) { @@ -304,19 +302,19 @@ class PanelCheck : QgFile return 0; } - // check for valid extentions - protected int validateExtention() + // check for valid extensions + protected int validateExtension() { - shared_ptr settings = new QgSettings("PanelCheck.panel.extention"); + shared_ptr settings = new QgSettings("PanelCheck.panel.extension"); if ( settings.isEnabled() ) { shared_ptr assertion = new QgVersionResult(); assertion.setMsgCatName("QgStaticCheck_Panels"); - assertion.setAssertionText("assert.panel.extention"); - assertion.setReasonText("reason.panel.extention", makeMapping("panel.name", getName(), - "panel.extention", _extention)); - if ( !assertion.assertDynContains(settings.getReferenceValues(), strtolower(_extention), settings.getScorePoints()) ) + assertion.setAssertionText("assert.panel.extension"); + assertion.setReasonText("reason.panel.extension", makeMapping("panel.name", getName(), + "panel.extension", _extension)); + if ( !assertion.assertDynContains(settings.getReferenceValues(), strtolower(_extension), settings.getScorePoints()) ) { result.addChild(assertion); return 1; @@ -560,8 +558,8 @@ class PanelCheck : QgFile //-------------------------------------------------------------------------------- static string _sourceDir = PROJ_PATH; - static dyn_string _enabledExtentions = makeDynString(); - string _extention; + static dyn_string _enabledExtensions = makeDynString(); + string _extension; PanelFile _pnl = PanelFile(); diff --git a/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgStaticCheck/Pictures/PicturesFile.ctl b/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgStaticCheck/Pictures/PicturesFile.ctl index db8fd432..5fc30b8e 100644 --- a/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgStaticCheck/Pictures/PicturesFile.ctl +++ b/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgStaticCheck/Pictures/PicturesFile.ctl @@ -1,14 +1,13 @@ #uses "std" -#uses "classes/QualityGates/QgBase" +#uses "spaceCheck" #uses "classes/QualityGates/QgSettings" -#uses "CtrlOaUnit" class PicturesFile { public PicturesFile(const string &path) { _path = path; - // !! extention must be written lowercase, that NonCaseSensitive works + // !! extension must be written lowercase, that NonCaseSensitive works } public int calculate() @@ -17,7 +16,7 @@ class PicturesFile return -1; _size = getFileSize(_path); - _extention = getExt(_path); + _extension = getExt(_path); return 0; } @@ -39,6 +38,7 @@ class PicturesFile if ( settings.isEnabled() ) { shared_ptr assertion = new QgVersionResult(); + assertion.setMsgCatName("QgStaticCheck_Pictures"); assertion.setAssertionText("assert.file.size"); assertion.setReasonText("reason.file.size", makeMapping("file.name", getName(), "file.size", byteSizeToString(_size))); @@ -50,15 +50,17 @@ class PicturesFile } { - shared_ptr settings = new QgSettings("PicturesFile.file.extention"); + shared_ptr settings = new QgSettings("PicturesFile.file.extension"); if ( settings.isEnabled() ) { shared_ptr assertion = new QgVersionResult(); - assertion.setAssertionText("assert.file.extention"); - assertion.setReasonText("reason.file.extention", makeMapping("file.name", getName(), - "file.extention", _extention)); - assertion.assertDynContains(settings.getReferenceValues(), strtolower(_extention), settings.getScorePoints()); + assertion.setMsgCatName("QgStaticCheck_Pictures"); + assertion.setAssertionText("assert.file.extension"); + assertion.setReasonText("reason.file.extension", makeMapping("file.name", getName(), + "file.extension", _extension, + "allowedValues", settings.getReferenceValues())); + assertion.assertDynContains(settings.getReferenceValues(), strtolower(_extension), settings.getScorePoints()); result.addChild(assertion); } } @@ -73,7 +75,7 @@ class PicturesFile public shared_ptr result; - string _extention; + string _extension; uint _size; string _path; }; diff --git a/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgSyntaxCheck/QgSyntaxCheck.ctl b/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgSyntaxCheck/QgSyntaxCheck.ctl index c0bd9328..47fc2fe8 100644 --- a/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgSyntaxCheck/QgSyntaxCheck.ctl +++ b/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgSyntaxCheck/QgSyntaxCheck.ctl @@ -146,7 +146,7 @@ class QgSyntaxCheck : QgBase { /// @todo remove this check when are WinCCOALicenseCtrlExt implemented if ( strpos(msg, "WinCCOALicenseCtrlExt") > 0 ) - continue; // ignore missing extention, this is added by IL + continue; // ignore missing extension, this is added by IL } else if ( errCode == "61" ) { @@ -156,7 +156,7 @@ class QgSyntaxCheck : QgBase if ( str.endsWith(makeUnixPath(SCRIPTS_REL_PATH)) || str.endsWith(makeUnixPath(PANELS_REL_PATH)) ) { DebugFTN("QgSyntaxCheck", "oa bug, ignore this message", msg); - continue; // ignore missing extention, this is added by IL + continue; // ignore missing extension, this is added by IL } } diff --git a/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgTest.ctl b/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgTest.ctl index 089954f8..d7cea5d0 100644 --- a/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgTest.ctl +++ b/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgTest.ctl @@ -11,8 +11,7 @@ // used libraries (#uses) #uses "classes/QualityGates/QgMsgCat" #uses "classes/Variables/Float" -#uses "classes/StTest" -#uses "CtrlOaUnit" +#uses "classes/oaTest/OaTest" //-------------------------------------------------------------------------------- // declare variables and constans @@ -21,10 +20,10 @@ /*! @brief QualityGate test class. - @details StTest customized to handle with QualityGates. + @details OaTest customized to handle with QualityGates. @author lschopp */ -class QgTest : StTest +class QgTest : OaTest { //-------------------------------------------------------------------------------- //@public members diff --git a/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgVersionResult.ctl b/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgVersionResult.ctl index f7c0b8e8..b087fbe2 100644 --- a/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgVersionResult.ctl +++ b/WinCCOA_QualityChecks/scripts/libs/classes/QualityGates/QgVersionResult.ctl @@ -57,6 +57,7 @@ struct QgVersionResult string reason; string reasonKey; mapping reasonDollars; + string location; static const float NOT_VALID_SCORE = 0.0; float score = NOT_VALID_SCORE; @@ -68,6 +69,18 @@ struct QgVersionResult { } + //------------------------------------------------------------------------------ + void setLocation(const string &location) + { + this.location = location; + } + + //------------------------------------------------------------------------------ + string getLocation() + { + return this.location; + } + //------------------------------------------------------------------------------ void setMsgCatName(const string &name) { @@ -503,11 +516,17 @@ struct QgVersionResult protected _addScorePoints(int points = 1) { mapping userData; + if (location != "") + { + assertDollars["location"] = location; + userData["Location"] = location; + } + userData["Note"] = msgCat.getText(assertKey, assertDollars); + + userData["Method"] = assertKey; userData["ErrMsg"] = msgCat.getText(reasonKey, reasonDollars); - dyn_string stack = getStackTrace(); - dynRemove(stack, 1); - userData["StackTrace"] = stack; + userData["StackTrace"] = makeDynString(); getKnownBugId(userData); @@ -517,15 +536,18 @@ struct QgVersionResult errorPoints += points; lastErr = reason; + const int prio = mappingHasKey(userData, "KnownBug") ? PRIO_INFO : PRIO_WARNING; + throwError(makeError("QgBase", prio, ERR_CONTROL, 10, msgCat.getText(reasonKey, reasonDollars))); + if ( _enableOaTestOutput() ) oaUnitFail(assertKey, userData); -// throwError(makeError("QgBase", PRIO_WARNING, ERR_CONTROL, 10, msgCat.getText(reasonKey, reasonDollars))); } else { if ( _enableOaTestOutput() ) oaUnitPass(assertKey, userData); -// throwError(makeError("QgBase", PRIO_INFO, ERR_CONTROL, 11, msgCat.getText(assertKey, assertDollars))); + else + throwError(makeError("QgBase", PRIO_INFO, ERR_CONTROL, 11, msgCat.getText(assertKey, assertDollars))); } _allowNextErr = FALSE; @@ -572,6 +594,7 @@ struct QgVersionResult */ protected static bool _enableOaTestOutput() { + return true; return Qg::isRunningOnJenkins(); } diff --git a/WinCCOA_QualityChecks/scripts/libs/classes/StTest.ctl b/WinCCOA_QualityChecks/scripts/libs/classes/StTest.ctl deleted file mode 100644 index 521a470c..00000000 --- a/WinCCOA_QualityChecks/scripts/libs/classes/StTest.ctl +++ /dev/null @@ -1,216 +0,0 @@ -// -// CtrlppCheck -// a static code analysis tool for WinCC OA's Ctrl language -// -// Copyright 2022 SIEMENS AG -// -// SPDX-License-Identifier: GPL-3.0-only -// - -//-------------------------------------------------------------------------------- -// used libraries (#uses) -#uses "CtrlOaUnit" -#uses "classes/QualityGates/Qg" - -//-------------------------------------------------------------------------------- -// declare variables and constans - -//-------------------------------------------------------------------------------- -/*! @brief WinCCOA Test class. - * - * @details This class defined base test class. For each test you must create own - * derived class. - * - * @author lschopp - */ -class StTest -{ -//-------------------------------------------------------------------------------- -//@public members -//-------------------------------------------------------------------------------- - - //------------------------------------------------------------------------------ - public int startAll() - { - if ( dynlen(_tcIds) <= 0 ) - _tcIds = _getAllTcIds(); - - return start(); - } - //------------------------------------------------------------------------------ - /** @brief Function start tests. - * @details Function starts all test-cases defined in _tcIds. - * @return Error code. - * value | description - * ------|------------ - * 0 | Success. - * -1 | List of test-cases is empty. - * -2 | Setup does not works. - * -3 | Tear-Down does not works. - */ - public int start() - { - - if ( dynlen(_tcIds) <= 0 ) - _tcIds = _getAllTcIds(); - - if ( dynlen(_tcIds) <= 0 ) - { - DebugFTN("StTest", __FUNCTION__, "has not found tc ids"); - return -1; - } - - if ( setUp() ) - { - DebugFTN("StTest", __FUNCTION__, "setUp returns some error"); - return -2; - } - - for(int i = 1; i <= dynlen(_tcIds); i++) - { - oaUnitInfo(_tcIds[i], "start test case"); - if ( startSingle(_tcIds[i]) ) - _errCount++; - } - - if ( tearDown() ) - { - DebugFTN("StTest", __FUNCTION__, "tearDown returns some error"); - return -3; - } - - return _errCount; - } - - //------------------------------------------------------------------------------ - public dyn_string _getAllTcIds() - { - return makeDynString(); - } - - //------------------------------------------------------------------------------ - /** @brief Default tear-down of this test. - @details Function is called when are tests finished to clear some test dependency. - This is created for customizing the the tests. - @return Error code. Returns 0 when successfull, otherwise -1. - */ - public int tearDown() - { - return 0; - } - - //------------------------------------------------------------------------------ - /** @brief Default setup of this test. - @details Function is called before start (on setup) of test cases. - This is created for customizing the the tests. - @return Error code. Returns 0 when successful, otherwise -1. - */ - public int setUp() - { - if ( !Qg::isRunningOnJenkins() ) - return 0; // init test dir only on jenkins - - string dir = getenv("WORKSPACE") + "/test/"; - if ( !isdir(dir) ) - mkdir(dir); - - string timeStamp = (long)getCurrentTime(); - - dir += timeStamp + "/"; - mkdir(dir); - - string fileName; - - if ( testSuiteId != "" ) - fileName = testSuiteId + ".json"; - else - { - fileName = getTypeName(this); - int idx = strpos(fileName, ":"); - if ( idx > 0 ) - fileName = substr(fileName, 0, idx); - } - - if ( fileName == "" ) - fileName = "result.json"; - - if ( oaUnitSetup(dir + fileName, makeMapping("Format", RESULT_FILE_FORMAT)) ) - return -1; - - return 0; - } - - //------------------------------------------------------------------------------ - /** @brief Function start single test case. - * @details Test cases are defined in _tcIds. - * @param testCaseId ID of the test case. Id must be unique in the test class. - * @return Error code. Returns 0 when successfull. For more error codes see also - * oaUnit functions. - */ - public int startSingle(const string &testCaseId) - { - _testCaseId = testCaseId; - DebugFTN("StTest", __FUNCTION__, _testCaseId); - try - { - int err = _startSingle(); - if ( err == 0 ) - return 0; - - if ( err < 0 ) - return oaUnitAbort(_testCaseId, "undefined test case"); - - return err; - } - catch - { - throwError(getLastException()); - return oaUnitAbort(_testCaseId, "luaft in catch"); - } - return 0; // defensive - } - - //------------------------------------------------------------------------------ - public string _getTcId() - { - return _testCaseId; - } - - //------------------------------------------------------------------------------ - /** @brief Place holder for customized test cases. - * @details Function is called to start customized test-cases. This must be - * overloaded in derived test class. Here is place to make the test-cases - * self. - * @return Error code. - * value | description - * ------|------------ - * 0 | Success. - * -1 | Test-case is aborted or failed. - */ - public int _startSingle() - { - return _startTest(); - } - - //------------------------------------------------------------------------------ - /** @brief Function returns all test-cases defined for this test. - @return List with all test-case IDs. - */ - public dyn_string getTestCaseIds() - { - return _tcIds; - } - - public string testSuiteId; - public string _testCaseId; //!< Current test case ID. - public dyn_string _tcIds; //!< List with all test-case IDs. must be overloaded in derived class. - public static const int RESULT_FILE_FORMAT = 2; //!< Default result output. - -//-------------------------------------------------------------------------------- -//@private members -//-------------------------------------------------------------------------------- - int _errCount; // count of all NOT passed test-cases. - -}; - - diff --git a/WinCCOA_QualityChecks/scripts/libs/scriptEditor/ctrlPPCheck_ext.ctl b/WinCCOA_QualityChecks/scripts/libs/scriptEditor/ctrlPPCheck_ext.ctl index 1979def3..bf9a13b9 100644 --- a/WinCCOA_QualityChecks/scripts/libs/scriptEditor/ctrlPPCheck_ext.ctl +++ b/WinCCOA_QualityChecks/scripts/libs/scriptEditor/ctrlPPCheck_ext.ctl @@ -9,7 +9,7 @@ /** @file scripts/scriptEditor/ctrlPPCheck_ext.ctl - @brief Extention for static tests in ctrl editor + @brief Extension for static tests in ctrl editor @details Extended static code check in ctrl editor + ctrlPP check + CCN