<commit_before><?xml version="1.0" encoding="UTF-8"?>
<project name="Sonata Ecommerce" basedir="." default="build:main">

    <!-- Config files -->
    <property name="dir.config"                  value="${project.basedir}" />
    <property name="config.phpunit"              value="${dir.config}/phpunit.xml.dist" />

    <!-- Build paths -->
    <property name="dir.build"                   value="${project.basedir}/build" />
    <property name="dir.reports"                 value="${dir.build}/reports" />
    <property name="dir.reports.check"           value="${dir.reports}/check" />
    <property name="dir.reports.test"            value="${dir.reports}/test" />
    <property name="dir.reports.test.unit"       value="${dir.reports.test}/unit" />
    <property name="dir.reports.test.coverage"   value="${dir.reports.test}/coverage" />
    <property name="dir.docs"                    value="${dir.build}/docs" />
    <property name="dir.docs.api"                value="${dir.docs}/api" />
    <property name="dir.docs.rst"                value="${dir.docs}/rst" />
    <property name="dir.docs.php"                value="${dir.docs}/php" />

   <!-- Build settings -->
   <property name="file.reports.cs"              value="${dir.reports.check}/checkstyle.xml" />
   <property name="file.reports.pmd"             value="${dir.reports.check}/pmd.xml" />
   <property name="file.reports.cpd"             value="${dir.reports.check}/cpd.xml" />
   <property name="file.reports.phpunit"         value="${dir.reports.test.unit}/phpunit.xml" />
   <property name="file.reports.coverage.clover" value="${dir.reports.test.coverage}/clover.xml" />
   <property name="file.reports.coverage.html"   value="${dir.reports.test.coverage}/html" />
   <property name="option.composer.mode"         value="install --dev --prefer-source" />

    <!-- Source paths -->
    <property name="dir.src"                     value="${project.basedir}" />
    <property name="dir.src.rst"                 value="${dir.src}/Resources/doc" />

    <!-- Source fileset (used by check tasks) -->
    <fileset id="sourcecode" dir="${dir.src}">
        <include name="**/*.php" />
        <exclude name="**/*Test.php" />
        <exclude name="vendor/**/*.php" />
    </fileset>


    <!-- BUILD TASKS -->

    <!-- Main (default) task -->
    <target name="build:main"
            depends="build:clean, build:prepare, build:check, build:test, build:doc"
            description="Run all test and build everything"/>

    <!-- Clean previous build files -->
    <target name="build:clean"
            description="Clean previous build files">

        <delete dir="${dir.build}" verbose="true" />

    </target>

    <!-- Prepare build (performed by each build:* task when called as standalone) -->
    <target name="build:prepare"
            description="Prepare build">

        <mkdir dir="${dir.build}" />

    </target>

    <!-- Check Project -->
    <target name="build:check"
            description="Check source code"
            depends="build:prepare, check:prepare, check:cs, check:md, check:cpd"/>

    <!-- Test Project -->
    <target name="build:test"
            description="Perform all tests"
            depends="build:prepare, test:prepare, test:unit"/>

    <!-- Generate documentation -->
    <target name="build:doc"
            depends="build:prepare, doc:prepare, doc:api"
            description="Generate API documentation"/>

    <!-- CHECK SECTION -->

    <!-- Prepare check (performed by each check:* task when called as standalone) -->
    <target name="check:prepare"
            description="Create check directories">

        <mkdir dir="${dir.reports.check}" />

    </target>

    <!-- CodeSniffer with Symfony2 convention -->
    <target name="check:cs"
            depends="check:prepare"
            description="Generate PHP_CodeSniffer report">

        <phpcodesniffer standard="Symfony2" showSniffs="true" showWarnings="true">
            <fileset refid="sourcecode" />
            <config name="error_severity"   value="1"/>
            <config name="warning_severity" value="5"/>
            <formatter type="checkstyle" outfile="${file.reports.cs}" />
        </phpcodesniffer>

    </target>

    <!-- PHP Copy and Paste Detector -->
    <target name="check:cpd"
            description="Generate phpcpd report"
            depends="check:prepare">

        <phpcpd>
            <fileset refid="sourcecode" />
            <formatter type="pmd" outfile="${file.reports.cpd}" />
        </phpcpd>

    </target>

    <!-- PHP Mess detector -->
    <target name="check:md"
            description="Generate phpmd report"
            depends="check:prepare" >

        <!-- if config.pmd file not found, use default pmd config -->
        <if>
            <not><available file="${config.pmd}"/></not>
            <then>
                <echo msg="phpmd config file not found: ${config.pmd}" />
                <property name="config.pmd" value="codesize,unusedcode,naming,design" override="yes"/>
             </then>
        </if>

        <phpmd rulesets="${config.pmd}">
            <fileset refid="sourcecode" />
            <formatter type="xml" outfile="${file.reports.pmd}" />
        </phpmd>

    </target>

    <!-- TEST SECTION -->

    <!-- Prepare test environment (performed by each test:* task when called as standalone) -->
    <target name="test:prepare"
            description="Prepare the test environment">

        <echo msg="Prepare test report directory" />
        <mkdir dir="${dir.reports.test}" />

        <echo msg="Installing/Updating vendors..." />
        <exec command="composer ${option.composer.mode}" passthru="true"/>
    </target>

    <!-- Prepare unit test environment -->
    <target name="test:unit:prepare"
            description="Prepare the unit test environment"
            depends="test:prepare">

        <mkdir dir="${dir.reports.test.unit}" />

    </target>

    <!-- Execute unit tests and code coverage -->
    <target name="test:unit"
            description="Perform unit tests and code coverage"
            depends="test:prepare, test:unit:prepare">

        <exec executable="phpunit" logoutput="true">
            <arg line="--log-junit ${file.reports.phpunit}" />
            <arg line="-c ${config.phpunit}" />
        </exec>

    </target>

    <!-- DOCUMENTATION SECTION -->

    <!-- Prepare the documentation environment -->
    <target name="doc:prepare"
            description="Prepare the documentation">

        <mkdir dir="${dir.docs}" />

    </target>

    <!-- Prepare the Api documentation -->
    <target name="doc:api:prepare"<commit_msg>SONATA-17 - Updated build.xml (reactivating clover)<commit_after><?xml version="1.0" encoding="UTF-8"?>
<project name="Sonata Ecommerce" basedir="." default="build:main">

    <!-- Config files -->
    <property name="dir.config"                  value="${project.basedir}" />
    <property name="config.phpunit"              value="${dir.config}/phpunit.xml.dist" />

    <!-- Build paths -->
    <property name="dir.build"                   value="${project.basedir}/build" />
    <property name="dir.reports"                 value="${dir.build}/reports" />
    <property name="dir.reports.check"           value="${dir.reports}/check" />
    <property name="dir.reports.test"            value="${dir.reports}/test" />
    <property name="dir.reports.test.unit"       value="${dir.reports.test}/unit" />
    <property name="dir.reports.test.coverage"   value="${dir.reports.test}/coverage" />
    <property name="dir.docs"                    value="${dir.build}/docs" />
    <property name="dir.docs.api"                value="${dir.docs}/api" />
    <property name="dir.docs.rst"                value="${dir.docs}/rst" />
    <property name="dir.docs.php"                value="${dir.docs}/php" />

   <!-- Build settings -->
   <property name="file.reports.cs"              value="${dir.reports.check}/checkstyle.xml" />
   <property name="file.reports.pmd"             value="${dir.reports.check}/pmd.xml" />
   <property name="file.reports.cpd"             value="${dir.reports.check}/cpd.xml" />
   <property name="file.reports.phpunit"         value="${dir.reports.test.unit}/phpunit.xml" />
   <property name="file.reports.coverage.clover" value="${dir.reports.test.coverage}/clover.xml" />
   <property name="file.reports.coverage.html"   value="${dir.reports.test.coverage}/html" />
   <property name="option.composer.mode"         value="install --dev --prefer-source" />

    <!-- Source paths -->
    <property name="dir.src"                     value="${project.basedir}" />
    <property name="dir.src.rst"                 value="${dir.src}/Resources/doc" />

    <!-- Source fileset (used by check tasks) -->
    <fileset id="sourcecode" dir="${dir.src}">
        <include name="**/*.php" />
        <exclude name="**/*Test.php" />
        <exclude name="vendor/**/*.php" />
    </fileset>


    <!-- BUILD TASKS -->

    <!-- Main (default) task -->
    <target name="build:main"
            depends="build:clean, build:prepare, build:check, build:test, build:doc"
            description="Run all test and build everything"/>

    <!-- Clean previous build files -->
    <target name="build:clean"
            description="Clean previous build files">

        <delete dir="${dir.build}" verbose="true" />

    </target>

    <!-- Prepare build (performed by each build:* task when called as standalone) -->
    <target name="build:prepare"
            description="Prepare build">

        <mkdir dir="${dir.build}" />

    </target>

    <!-- Check Project -->
    <target name="build:check"
            description="Check source code"
            depends="build:prepare, check:prepare, check:cs, check:md, check:cpd"/>

    <!-- Test Project -->
    <target name="build:test"
            description="Perform all tests"
            depends="build:prepare, test:prepare, test:unit"/>

    <!-- Generate documentation -->
    <target name="build:doc"
            depends="build:prepare, doc:prepare, doc:api"
            description="Generate API documentation"/>

    <!-- CHECK SECTION -->

    <!-- Prepare check (performed by each check:* task when called as standalone) -->
    <target name="check:prepare"
            description="Create check directories">

        <mkdir dir="${dir.reports.check}" />

    </target>

    <!-- CodeSniffer with Symfony2 convention -->
    <target name="check:cs"
            depends="check:prepare"
            description="Generate PHP_CodeSniffer report">

        <phpcodesniffer standard="Symfony2" showSniffs="true" showWarnings="true">
            <fileset refid="sourcecode" />
            <config name="error_severity"   value="1"/>
            <config name="warning_severity" value="5"/>
            <formatter type="checkstyle" outfile="${file.reports.cs}" />
        </phpcodesniffer>

    </target>

    <!-- PHP Copy and Paste Detector -->
    <target name="check:cpd"
            description="Generate phpcpd report"
            depends="check:prepare">

        <phpcpd>
            <fileset refid="sourcecode" />
            <formatter type="pmd" outfile="${file.reports.cpd}" />
        </phpcpd>

    </target>

    <!-- PHP Mess detector -->
    <target name="check:md"
            description="Generate phpmd report"
            depends="check:prepare" >

        <!-- if config.pmd file not found, use default pmd config -->
        <if>
            <not><available file="${config.pmd}"/></not>
            <then>
                <echo msg="phpmd config file not found: ${config.pmd}" />
                <property name="config.pmd" value="codesize,unusedcode,naming,design" override="yes"/>
             </then>
        </if>

        <phpmd rulesets="${config.pmd}">
            <fileset refid="sourcecode" />
            <formatter type="xml" outfile="${file.reports.pmd}" />
        </phpmd>

    </target>

    <!-- TEST SECTION -->

    <!-- Prepare test environment (performed by each test:* task when called as standalone) -->
    <target name="test:prepare"
            description="Prepare the test environment">

        <echo msg="Prepare test report directory" />
        <mkdir dir="${dir.reports.test}" />

        <echo msg="Installing/Updating vendors..." />
        <exec command="composer ${option.composer.mode}" passthru="true"/>
    </target>

    <!-- Prepare unit test environment -->
    <target name="test:unit:prepare"
            description="Prepare the unit test environment"
            depends="test:prepare">

        <mkdir dir="${dir.reports.test.unit}" />

    </target>

    <!-- Execute unit tests and code coverage -->
    <target name="test:unit"
            description="Perform unit tests and code coverage"
            depends="test:prepare, test:unit:prepare">

        <exec executable="phpunit" logoutput="true">
            <arg line="--log-junit ${file.reports.phpunit}" />
            <arg line="--coverage-clover ${file.reports.coverage.clover}" />
            <arg line="--coverage-html ${file.reports.coverage.html}" />
            <arg line="-c ${config.phpunit}" />
        </exec>

    </target>

    <!-- DOCUMENTATION SECTION -->

    <!-- Prepare the documentation environment -->
    <target name="doc:prepare"
            description="Prepare the documentation">

        <mkdir dir="${dir.docs}" />

    </target>

    <!-- Prepare the Api documentation -->
    <target name="doc:api:prepare"
{'fraction_non_alphanumeric': 0.17247774480712166, 'fraction_numerical': 0.0011869436201780415, 'mean_word_length': 2.2952823270593985, 'pattern_counts': {'":': 0, '<': 233, '<?xml version=': 2, '>': 231, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 17}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2292331', 'n_tokens_mistral': 3865, 'n_tokens_neox': 3676, 'n_words': 783}