buildframework/helium/tools/quality/lint.ant.xml
changeset 628 7c4a911dc066
child 645 b8d81fa19e7d
equal deleted inserted replaced
588:c7c26511138f 628:7c4a911dc066
       
     1 <?xml version="1.0" encoding="UTF-8"?>
       
     2 <!-- 
       
     3 ============================================================================ 
       
     4 Name        : lint.ant.xml 
       
     5 Part of     : Helium 
       
     6 
       
     7 Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     8 All rights reserved.
       
     9 This component and the accompanying materials are made available
       
    10 under the terms of the License "Eclipse Public License v1.0"
       
    11 which accompanies this distribution, and is available
       
    12 at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    13 
       
    14 Initial Contributors:
       
    15 Nokia Corporation - initial contribution.
       
    16 
       
    17 Contributors:
       
    18 
       
    19 Description:
       
    20 
       
    21 ============================================================================
       
    22 -->
       
    23 <project name="lint" xmlns:hlm="http://www.nokia.com/helium"
       
    24                      xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
       
    25 
       
    26     <!-- Run AntLint on project Ant XML files. -->
       
    27     <target name="antlint">
       
    28         <delete dir="${helium.build.dir}/jep"/>
       
    29         <delete dir="${helium.build.dir}/python"/>
       
    30         <delete dir="${helium.build.dir}/beanshell"/>
       
    31         <delete file="${helium.build.dir}/test_jython.xml"/>
       
    32         <mkdir dir="${helium.build.dir}/report/antlint" />
       
    33         <hlm:antlint>
       
    34             <fileset dir="${helium.dir}/tools">
       
    35                 <include name="**/*.ant.xml"/>
       
    36                 <include name="**/build.xml"/>
       
    37                 <include name="**/*.antlib.xml"/>
       
    38                 <exclude name="tests/**"/>
       
    39                 <exclude name="**/test/test_*.xml"/>
       
    40                 <exclude name="external/**"/>
       
    41                 <exclude name="**/tests/data/**"/>
       
    42                 <exclude name="build/**"/>
       
    43             </fileset>
       
    44             <hlm:checkTabCharacter severity="error" enabled="true"/>
       
    45             <hlm:checkPropertyName severity="warning" enabled="true" regexp="([a-z0-9[\\d\\_\\.\\@\\{\\}\\$]]*)" />
       
    46             <hlm:checkTargetName severity="warning" enabled="true" regexp="([a-z0-9[\\d\\-]]*)" />
       
    47             <hlm:checkIndentation severity="error" enabled="true"/>
       
    48             <hlm:checkPresetDefMacroDefName severity="warning" enabled="true" regexp="([a-z0-9][a-zA-Z0-9]*)" />       
       
    49             <hlm:checkProjectName severity="warning" enabled="true" regexp="([a-z0-9[\\d\\.\\_\\-]]*)" />
       
    50             <hlm:checkDescription severity="warning" enabled="true"/>
       
    51             <hlm:checkFileName severity="warning" enabled="true" regexp="^build.xml$|ant.xml$|antlib.xml$" />
       
    52             <hlm:checkRunTarget severity="warning" enabled="true"/>
       
    53             <hlm:checkAntCall severity="warning" enabled="true"/>
       
    54             <hlm:checkScriptSize severity="warning" enabled="true"/>
       
    55             <hlm:checkUseOfIfInTargets severity="warning" enabled="true"/>
       
    56             <hlm:checkJythonScript severity="error" enabled="true" outputDir="${helium.build.dir}/jep"/>
       
    57             <hlm:checkScriptCondition severity="warning" enabled="true" outputDir="${helium.build.dir}/scriptcondition"/>
       
    58             <hlm:checkPythonTasks severity="warning" enabled="true" outputDir="${helium.build.dir}/python"/>
       
    59             <hlm:checkUseOfEqualsTask severity="warning" enabled="true"/>
       
    60             <hlm:checkScriptDefNameAttributes severity="error" enabled="true"/>
       
    61             <hlm:checkScriptDefStyle severity="warning" enabled="true"/>
       
    62             <hlm:checkScriptDef severity="error" enabled="true" outputDir="${helium.build.dir}/beanshell"/>
       
    63             <hlm:checkDuplicateNames severity="warning" enabled="true"/>
       
    64             
       
    65             <!-- Reporters -->
       
    66             <hlm:antlintCheckstyleReporter file="${helium.build.dir}/report/antlint/antlint_report.xml" />
       
    67             <hlm:antlintConsoleReporter />            
       
    68         </hlm:antlint>
       
    69         <fileset id="jep.files" dir="${helium.build.dir}">
       
    70             <include name="jep/**/*.py"/>
       
    71             <include name="python/**/*.py"/>
       
    72         </fileset>
       
    73         <antcall target="pylint" inheritRefs="true">
       
    74             <reference refid="jep.files" torefid="python.files" />
       
    75         </antcall>
       
    76         <cs:checkstyle config="${helium.dir}/builder/java/config/java_checkstyle_config.xml">
       
    77             <fileset dir="${helium.build.dir}/beanshell" includes="**/*.java"/>
       
    78             <formatter type="plain"/>
       
    79         </cs:checkstyle>
       
    80     </target>    
       
    81         
       
    82     
       
    83     <!-- Checks FTL files for lint issues. -->
       
    84     <target name="ftllint">
       
    85         <for param="file">
       
    86             <path>
       
    87                 <fileset dir="${helium.dir}">
       
    88                     <include name="**/*.ftl"/>
       
    89                     <include name="**/*.rst"/>
       
    90                     <exclude name="**/*.mk.ftl"/>
       
    91                     <exclude name="build/**/*"/>
       
    92                 </fileset>
       
    93             </path>
       
    94             <sequential>
       
    95                 <loadfile srcfile="@{file}" property="tabs.in.ftl">
       
    96                     <filterchain>
       
    97                         <linecontainsregexp>
       
    98                             <regexp pattern="\t"/>
       
    99                         </linecontainsregexp>
       
   100                     </filterchain>
       
   101                 </loadfile>
       
   102                 <fail if="tabs.in.ftl" message="@{file} has tabs" />
       
   103             </sequential>
       
   104         </for>
       
   105     </target>
       
   106     
       
   107     
       
   108     <target name="hlmlint" depends="antlint,ftllint"/>
       
   109     
       
   110 </project>
       
   111 
       
   112 
       
   113 
       
   114