JavaScript Slint - Hudson 的 XML 报告

发布于 2024-12-10 05:51:35 字数 296 浏览 2 评论 0 原文

我正在使用 JavaScript Lint 来检查 JavaScript 源代码。它可以很好地进行递归分析,在命令窗口中显示结果,但我想将 JavaScript Lint 结果集成到 Hudson(从批处理文件运行 JavaScript Lint)。 如何获取保存到 XML 的 JavaScript Lint 日志? JavaScript Lint 中有输出格式配置,但这些配置是自定义错误消息的格式。

先感谢您, 安德烈

I am using JavaScript Lint for checking JavaScript source code. It's working fine with recursive analysis showing results in command window, but I would like to integrate JavaScript Lint results to Hudson (running JavaScript Lint from batch file).
How can I get log of JavaScript Lint saved to XML?
There are output format configuration in JavaScript Lint, but those customize format of error message.

Thank you in advance,
Andrey

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

临走之时 2024-12-17 05:51:35

如果有人感兴趣,这里有一个我们用来运行 JSlint 的 Maven POM 片段:

  <plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
      <execution>
        <id>jslint</id>
        <phase>test</phase>
        <goals>
          <goal>run</goal>
        </goals>
        <configuration>
          <tasks>
            <taskdef name="jslint" classname="com.googlecode.jslint4java.ant.JSLintTask" classpathref="maven.plugin.classpath" />
            <jslint encoding="UTF-8" options="indent=4,evil,laxbreak">
              <formatter type="plain" />
              <fileset dir="${basedir}/src/main/javascript" includes="**/*.js" />
            </jslint>
          </tasks>
        </configuration>
      </execution>
    </executions>
    <dependencies>
      <dependency>
        <groupId>com.googlecode.jslint4java</groupId>
        <artifactId>jslint4java-ant</artifactId>
        <version>1.3.3</version>
      </dependency>
    </dependencies>
  </plugin>

In case anyone's interested, here's a Maven POM snippet we use to run JSlint:

  <plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
      <execution>
        <id>jslint</id>
        <phase>test</phase>
        <goals>
          <goal>run</goal>
        </goals>
        <configuration>
          <tasks>
            <taskdef name="jslint" classname="com.googlecode.jslint4java.ant.JSLintTask" classpathref="maven.plugin.classpath" />
            <jslint encoding="UTF-8" options="indent=4,evil,laxbreak">
              <formatter type="plain" />
              <fileset dir="${basedir}/src/main/javascript" includes="**/*.js" />
            </jslint>
          </tasks>
        </configuration>
      </execution>
    </executions>
    <dependencies>
      <dependency>
        <groupId>com.googlecode.jslint4java</groupId>
        <artifactId>jslint4java-ant</artifactId>
        <version>1.3.3</version>
      </dependency>
    </dependencies>
  </plugin>
仅冇旳回忆 2024-12-17 05:51:35

我已经找到了在 Hudson 中应用 Jslint 的解决方案。 jslint4java 取代了 JavaScript Lint,它以 XML 格式进行报告。
以下是分步说明:

  1. 下载 jslint4java
  2. 准备 Ant 脚本,该脚本递归地准备项目中所有 JS 文件的列表,例如:

    <项目名称=“JSlint”default=“jslint”basedir=“.”>
    <说明>
        验证JS文件
    
    
    
    <包含名称=“*.js”/>
    <排除名称=“*.min.js”/>
    
    >
    
    
    
    
    
    
  3. 在 Hudson 中应用 Ant 脚本进行作业,并在“报告违规”中选择 Jslint 输出文件名 (jslint.xml) '

鸣谢:这是我在这个主题上发现的有用的帖子

I have found the solution for applying Jslint in Hudson. Instead of JavaScript Lint there is jslint4java which reports in XML format.
Here is step by step instructions:

  1. Download jslint4java
  2. Prepare Ant script which prepares list of all JS files in project recursively, example:

    <project name="JSlint" default="jslint" basedir=".">
    <description>
        Verify JS files
    </description>
    <target name="jslint" description="Run the JSLint tool on JS files">
    <fileset dir="ProjectForVerification/js" id="jsfiles.raw">
    <include name="*.js" />
    <exclude name="*.min.js" />
    </fileset>
    <pathconvert pathsep=" " property="jsfiles.clean" refid="jsfiles.raw" />
    <exec executable="java" output="jslint.xml">
    <arg line="-jar jslint4java.jar --report xml ${jsfiles.clean}" />
    </exec>
    </target>
    </project>
    
  3. Apply Ant script in Hudson for a job and select Jslint output file name (jslint.xml) in 'Report Violations'

Credits: Here is useful post which I found on this topic.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文