Why doesn't CodeSniffer exclude specified --ignore folders?

I use Jenkins (Hudson) CI and analyze the code every night using a number of retransmission tools, including Codesniffer for Checkstyle reports. I do not want to ignore the directory ./framework/*, but it insists on including it, regardless of my efforts with the parameter --ignore.

The report is created and analyzed successfully, but is not actually used for us due to the excessive number of violations of pear coding standards within the framework.

Codeniffer is called from my Ant build-script as follows:

<target name="phpcs-ci" description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server">
 <exec executable="phpcs" dir="${basedir}" output="${basedir}/build/logs/checkstyle.xml" failonerror="off">
  <arg line="--report=checkstyle --standard=${basedir}/build/phpcs.xml --extensions=php  --ignore=*/framework/* ${basedir}" />
 </exec>
</target>

I tried --ignore=framework, --ignore=framework/and the one in the line above is all of the examples I found on the Internet.

I also tried using a different line for each argument ( using < arg value"..." />), but to no avail.

Any ideas? Very much appreciated :)

Edit: The --ignore argument is now:

--ignore=${basedir}/framework/

... And yet the frame folder is on. Does anyone have a working PhpCodeSniffer configuration with --ignore argument working?

Finger crossing here

+5
source share
4 answers

Use *will not work, as the shell will expand them.

Depending on your php_codesniffer version, you need to either go the full path to the directory to ignore (older versions) or the relative path from the build directory to force it to ignore (from php_codesniffer version 1.3.6):

Excerpt from Changelog :

+3

, . , ( ).

:

/
/build.xml
/foo
/foo/bar

, build.xml

  <target name="phpcs" description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
<exec executable="phpcs">
  <arg value="--standard=${basedir}/build/phpcs.xml" />
  <arg value="--ignore=foo/bar" />
  <arg path="${basedir}" />
</exec>

, ${basedir} .

,

+6

build/phpcs.xml. .

js/facebook, js/jquery * .

<exclude-pattern>lib/facebook</exclude-pattern>
<exclude-pattern>js/jquery*</exclude-pattern>
<exclude-pattern>lib/Postmark.php</exclude-pattern>
+4

. ,

    <target name="phpcs-ci" description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server">
     <exec executable="phpcs" failonerror="off">
      <arg line="-v --report-checkstyle=${basedir}/build/logs/checkstyle.xml --standard=${basedir}/build/phpcs.xml --extensions=php --ignore=extensions,library ./protected" />
     </exec>
    </target>

!

+1

All Articles