简体   繁体   English

JSHint为Checkstyle Reporter显示无错误

[英]JSHint shows non-errors for checkstyle reporter

I am running JSHint as part of the Checkstyle plugin for Jenkins. 我正在将JSHint作为Jenkins的Checkstyle插件的一部分运行。 So far, this works good, but there is one issue. 到目前为止,这很好,但是有一个问题。 I call JSHint using: 我使用以下命令调用JSHint:

jshint --verbose --reporter=checkstyle foo > checkstyle-jshint.xml || exit 0

and this works, but it automatically runs JSHint using the --show-non-errors option - which is definitely not what I want. 并且可以正常工作,但是它会使用--show-non-errors选项自动运行JSHint-绝对不是我想要的。 I have seen that this is an official JSHint issue , hence it seems wrong on the one hand, but (at the moment) official behavior of JSHint. 我已经看到这是JSHint的官方问题 ,因此,一方面似乎是错误的,但是(目前)是JSHint的官方行为。

Does anybody have an idea of how to workaround this, so that the Checkstyle report only inlcudes the errors JSHint would report on the console when running it without the --show-non-errors parameter? 是否有人知道如何解决此问题,以便Checkstyle报告仅包含JSHint在没有--show-non-errors参数的情况下运行时在控制台上报告--show-non-errors

Okay, I found a workaround myself: Using the --reporter parameter, besides using the pre-defined values jslint and checkstyle you can also specify a .js file which implements a custom reporter . 好的,我自己找到了一种解决方法:使用--reporter参数,除了使用预定义的值jslintcheckstyle您还可以指定一个实现自定义报告器.js文件。

So what I did was basically write my own custom reporter that outputs a valid checkstyle-conform .xml file. 因此,我所做的基本上是编写自己的自定义报告程序,该报告程序输出有效的checkstyle-conform .xml文件。 This way it works as expected. 这样,它可以按预期工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM