
################################################################################
#
# * This file is part of SplashSync Project.
# *
# * Copyright (C) Splash Sync <www.splashsync.com>
# *
# * This program is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# *
# * For the full copyright and license information, please view the LICENSE
# * file that was distributed with this source code.
# *
# * @author Bernard Paquier <contact@splashsync.com>
#
################################################################################

#############################################
#   Local Config
#############################################
parameters:

    #   Path to Php Core Module
    core_dir:       "./vendor/splash/phpcore/Resources/grumphp"     
    #   Testing Mode (core|module)
    mode:           "module"
    level:          8
    # For Building Splash Module
    mod-enable:     true
    mod-src:        '/src/Resources/docs'
    mod-file:       "module"
    # For Building Splash Documentation
    doc-enable:     true
    doc-src:        '/src/Resources/docs'
    doc-contents:   ["module", "splash"]    
    # For Building Splash Manifest
    yml-enable:     true

#############################################
#   Grumphp Config
#############################################
grumphp:

    #############################################        
    #   Base Configs 
    ascii:
        failed:     "%core_dir%/grumphp-grumpy.txt"
        succeeded:  "%core_dir%/grumphp-happy.txt"
    process_timeout: 180
    
    #############################################        
    #   Tasks Configs        
    tasks:
        
        #############################################        
        #   Composer Verifications
        composer: ~

        #############################################        
        #   Syntax Errors Detection             
        phplint:
            exclude:        ['vendor']
            triggered_by:   ['php']
            
        jsonlint:
            detect_key_conflicts: true
            
        xmllint: ~
        
        yamllint: ~
            
        #############################################        
        #   Blacklist Codes Detection
        git_blacklist:
            keywords:
                - "var_dump"
                - "dump("
                - "console.log"
                - "print_r"
                - "die("
            triggered_by: [php, js, twig]
        
        #############################################        
        #   Security Checks 
        securitychecker: ~
        
        #############################################        
        #   Code Quality   
        phpcsfixer:
            allow_risky:    true
            config:         "%core_dir%/php_cs.%mode%.dist"
            
        phpcs:
            standard:       "PSR2"
            triggered_by:   ['php']
            ignore_patterns:
                - phpstan.php
                - nusoap.php
                - soap.php
                - BaseCase.php                
                - TestCase.php
        phpmd:
            ruleset:        ["%core_dir%/phpmd.xml"]
            exclude:        
                - "nusoap.php"
                - "vendor"
                
        phpcpd:
            triggered_by: []
            exclude:
                - "Components/NuSOAP"
                - "vendor"
        phpstan: 
            level:          "%level%"
            configuration:  "%core_dir%/phpstan.%mode%.neon"              
            ignore_patterns:
                - nusoap.php
                - server.inc.php
                
        build-module: 
            enabled:        "%mod-enable%"
            source_folder:  "%mod-src%"
            target_folder:  "/build"
            build_folder:   ""
            build_file:     "%mod-file%"
            
        build-docs: 
            enabled:            "%doc-enable%"
            local_folder:       "%doc-src%"
            generic_contents:   "%doc-contents%"
            
        build-manifest: 
            enabled:            "%yml-enable%"
        
    extensions:
        - Splash\Console\Extension\Loader
        
    #############################################        
    #   Testsuites Configs
    #   => Travis   >>  Base Test Suite for All PHP Versions
    #   => PhpStan  >>  Only for PHP Versions > PHP7.1
    testsuites:
        travis:
            tasks:
                - composer
                - phplint
                - jsonlint
                - xmllint
                - yamllint
                - git_blacklist
                - phpcs 
                - phpmd
                - phpcpd

        csfixer:
            tasks: 
                - phpcsfixer
                
        phpstan:
            tasks: 
                - phpstan 
                
        splash:
            tasks:
                - build-manifest
                - build-module   
                - build-docs                
