Commit 9877ee90 authored by Felix Flor's avatar Felix Flor

added support for ignoring files on ci check file

parent 388520dd
......@@ -13,7 +13,15 @@ require_once __DIR__ . '/config.inc.php';
checkEnvironment();
checkGivenArguments($argv);
$filesToCheck = searchDirectoryForFiles(realpath($argv[1]));
$path = realpath($argv[1]);
$filesToCheck = searchDirectoryForFiles($path);
$ignoredModulesFile = $path.'/.aphpbreakdown-ignored-modules';
$GLOBALS['ignored_php_modules'] = array();
if(\file_exists($ignoredModulesFile) && \is_readable($ignoredModulesFile))
$GLOBALS['ignored_php_modules'] = \file($ignoredModulesFile, FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES);
system("clear");
......
......@@ -20,6 +20,9 @@ function matchClassToModule($phpClassName) {
if(!is_string($phpClassName))
throw new \Exception ("Invalid parameter type! Must: string, Is: " . gettype($phpClassName));
if(\in_array($GLOBALS['php71_class_to_module_list'][$phpClassName], $GLOBALS['ignored_php_modules']))
return "IGNORED";
if(array_key_exists($phpClassName, $GLOBALS['php71_class_to_module_list']))
return $GLOBALS['php71_class_to_module_list'][$phpClassName];
......
......@@ -20,6 +20,10 @@ function matchConstantToModule($phpConstantName) {
throw new \Exception ("Invalid parameter type! Must: string, Is: " . gettype($phpConstantName));
foreach($GLOBALS['php71_constants_to_module_list'] as $constantModules => $constantOfModule){
if(\in_array($constantModules, $GLOBALS['ignored_php_modules']))
return "IGNORED";
if(array_key_exists($phpConstantName ,$constantOfModule))
return $constantModules;
......
......@@ -19,6 +19,9 @@ function matchFunctionToModule($phpFunctionName) {
if(!is_string($phpFunctionName))
throw new \Exception ("Invalid parameter type! Must: string, Is: " . gettype($phpFunctionName));
if(\in_array($GLOBALS['php71_functions_to_module_list'][$phpFunctionName], $GLOBALS['ignored_php_modules']))
return "IGNORED";
if(array_key_exists($phpFunctionName, $GLOBALS['php71_functions_to_module_list']))
return $GLOBALS['php71_functions_to_module_list'][$phpFunctionName];
......
......@@ -106,6 +106,11 @@ function createTestfileFromTemplate($filesToCheck, $template, $exportFileName){
}
// delete IGNORED from modules array
if( false !== ($key = \array_search('IGNORED', $neededModules)) )
unset($neededModules[$key]);
$ignoredModules = implode("','", $GLOBALS['ignored_php_modules']);
$neededModules = implode("','", $neededModules);
$neededFunctions = implode("','", $neededFunctions);
$neededConstants = implode("','", $neededConstants);
......@@ -135,6 +140,7 @@ function createTestfileFromTemplate($filesToCheck, $template, $exportFileName){
$exportFileTemplate = file_get_contents('inc/output/fileTemplates/ciIntegrationTestfile.template');
}
$exportFileTemplate = str_replace('<IGNOREDMODULES>', $ignoredModules, $exportFileTemplate);
$exportFileTemplate = str_replace('<NEEDEDMODULES>', $neededModules, $exportFileTemplate);
$exportFileTemplate = str_replace('<NEEDEDFUNCTIONS>', $neededFunctions, $exportFileTemplate);
$exportFileTemplate = str_replace('<NEEDEDCONSTANTS>', $neededConstants, $exportFileTemplate);
......
<?php
$ignoredModules = array( '<IGNOREDMODULES>' );
$neededModules = array( '<NEEDEDMODULES>' );
$neddedModulesInstallStatus = array();
......@@ -25,14 +27,25 @@ foreach($neededModules as $neededModule){
}
if(!empty($ignoredModules)){
echo "\e[32mIgnored Modules:\n\n";
foreach($ignoredModules as $module)
echo $module."\n";
echo "\n\e[39m";
}
if (in_array(false, $neddedModulesInstallStatus)) {
$error = true;
echo "\e[31mMissing Modules: ";
echo "\e[31mMissing Modules:\n\n";
foreach($neddedModulesInstallStatus as $module => $moduleStatus){
if(!$moduleStatus)
echo $module." ";
echo $module."\n";
}
echo "\n\n\e[39m";
echo "\n\e[39m";
}
# needed functions
......@@ -47,8 +60,7 @@ foreach($neededFunctions as $neededFunction){
}
if (in_array(false, $neededFunctionsInstallStatus)) {
$error = true;
echo "\e[31mMissing Functions: ";
echo "\e[33mMissing Functions:\n\n";
foreach($neededFunctionsInstallStatus as $function => $functionStatus){
if(!$functionStatus)
echo $function." ";
......@@ -68,8 +80,7 @@ foreach($neededConstants as $neededConstant){
}
if (in_array(false, $neededConstantsInstallStatus)) {
$error = true;
echo "\e[31mMissing Constants: ";
echo "\e[33mMissing Constants:\n\n";
foreach($neededConstantsInstallStatus as $constants => $constantsStatus){
if(!$constantsStatus)
echo $constants." ";
......@@ -89,8 +100,7 @@ foreach($neededClasses as $neededClass){
}
if (in_array(false, $neededClassesInstallStatus)) {
$error = true;
echo "\e[31mMissing Classes: ";
echo "\e[33mMissing Classes:\n\n";
foreach($neededClassesInstallStatus as $class => $classStatus){
if(!$classStatus)
echo $class." ";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment