Exemple #1
0
def execute():
    output_start('phpcs')

    dirs = get_dirs()
    phpcs_standard = dirs['project']+get_value('phpcs-standard')
    check_dir = get_value('check-dir')

    exclude_dirs = []
    for exclude_dir in get_value('exclude-dirs'):
        exclude_dirs.append(exclude_dir+'/*')
    excludes = ','.join(exclude_dirs)

    if excludes != '':
        excludes = '--ignore='+excludes

    if not os.path.isfile(phpcs_standard):
        print('>>> No phpcs-standard found. Fallback is the default move-elevator/symfony-coding-standard:')
        phpcs_standard = get_value('checker-dir')+'vendor/move-elevator/symfony-coding-standard/Standards/Symfony2'

    print('>>> phpcs standard: '+phpcs_standard)
    print('>>> Excludes: '+excludes)

    code = php('phpcs', '--standard='+phpcs_standard+' --extensions=php --report-checkstyle='+check_dir+'checkstyle.xml '+excludes+' '+dirs['scan'])

    if code == 512:
        output_error('There was a error/exception while executing phpcs.')
Exemple #2
0
def execute():
    output_start('phpcs')

    dirs = get_dirs()
    phpcs_standard = dirs['project'] + get_value('phpcs-standard')
    check_dir = get_value('check-dir')

    exclude_dirs = []
    for exclude_dir in get_value('exclude-dirs'):
        exclude_dirs.append(exclude_dir + '/*')
    excludes = ','.join(exclude_dirs)

    if excludes != '':
        excludes = '--ignore=' + excludes

    if not os.path.isfile(phpcs_standard):
        print(
            '>>> No phpcs-standard found. Fallback is the default move-elevator/symfony-coding-standard:'
        )
        phpcs_standard = get_value(
            'checker-dir'
        ) + 'vendor/move-elevator/symfony-coding-standard/Standards/Symfony2'

    print('>>> phpcs standard: ' + phpcs_standard)
    print('>>> Excludes: ' + excludes)

    code = php(
        'phpcs', '--standard=' + phpcs_standard +
        ' --extensions=php --report-checkstyle=' + check_dir +
        'checkstyle.xml ' + excludes + ' ' + dirs['scan'])

    if code == 512:
        output_error('There was a error/exception while executing phpcs.')
Exemple #3
0
def execute():
    output_start('phpcpd')

    dirs = get_dirs()
    check_dir = get_value('check-dir')
    exclude_dirs = get_value('exclude-dirs')
    excludes = ''

    for exclude in exclude_dirs:
        excludes = excludes+' --exclude '+exclude

    print('>>> Excludes: '+excludes)

    php('phpcpd', excludes+' --log-pmd '+check_dir+'pmd-cpd.xml '+dirs['scan'])
Exemple #4
0
def execute():
    output_start('phpcpd')

    dirs = get_dirs()
    check_dir = get_value('check-dir')
    exclude_dirs = get_value('exclude-dirs')
    excludes = ''

    for exclude in exclude_dirs:
        excludes = excludes + ' --exclude ' + exclude

    print('>>> Excludes: ' + excludes)

    php('phpcpd',
        excludes + ' --log-pmd ' + check_dir + 'pmd-cpd.xml ' + dirs['scan'])
def execute():
    output_start('lint')

    dirs = get_dirs()
    exclude_dirs = get_value('exclude-dirs')
    forbidden_methods = get_value('forbidden-methods')

    print('>>> Excludes dirs: ', exclude_dirs)
    print('>>> Forbidden methods: ', forbidden_methods)

    for root, dirs, files in os.walk(dirs['scan']):
        for exclude in exclude_dirs:
            if exclude in dirs:
                dirs.remove(exclude)
        for file in files:
            if file.endswith(".php"):
                php_file = os.path.join(root, file)
                code = os.system(get_value('php')+' -l '+php_file)
                if code != 0:
                    output_error('PHP lint found an error in the file '+php_file)
                check_forbidden_methods(forbidden_methods, php_file)
Exemple #6
0
def execute():
    output_start('phpmd')

    dirs = get_dirs()
    phpmd_xml = dirs['project']+get_value('phpmd-xml')
    check_dir = get_value('check-dir')
    excludes = ','.join(get_value('exclude-dirs'))

    if excludes != '':
        excludes = '--exclude '+excludes

    if not os.path.isfile(phpmd_xml):
        print('>>> No phpmd-xml found. Fallback is the default phpmd.xml:')
        phpmd_xml = get_value('checker-dir')+'data/phpmd.xml.dist'

    print('>>> phpmd.xml: '+phpmd_xml)
    print('>>> Excludes: '+excludes)

    code = php('phpmd', dirs['scan']+' xml '+phpmd_xml+' --reportfile '+check_dir+'pmd.xml '+excludes)

    if code == 1:
        output_error('There was a error/exception while executing phpmd.')
Exemple #7
0
def execute():
    output_start('phpmd')

    dirs = get_dirs()
    phpmd_xml = dirs['project'] + get_value('phpmd-xml')
    check_dir = get_value('check-dir')
    excludes = ','.join(get_value('exclude-dirs'))

    if excludes != '':
        excludes = '--exclude ' + excludes

    if not os.path.isfile(phpmd_xml):
        print('>>> No phpmd-xml found. Fallback is the default phpmd.xml:')
        phpmd_xml = get_value('checker-dir') + 'data/phpmd.xml.dist'

    print('>>> phpmd.xml: ' + phpmd_xml)
    print('>>> Excludes: ' + excludes)

    code = php(
        'phpmd', dirs['scan'] + ' xml ' + phpmd_xml + ' --reportfile ' +
        check_dir + 'pmd.xml ' + excludes)

    if code == 1:
        output_error('There was a error/exception while executing phpmd.')