gpt4 book ai didi

jquery - Sonar 检查jquery代码错误

转载 作者:行者123 更新时间:2023-12-01 01:15:59 25 4
gpt4 key购买 nike

我使用sonar来检查jquery代码,但它总是抛出异常:

C:\Documents and Settings\user\.jenkins\workspace\ksp2\ant\sonar_web.xml:31: com.sonar.sslr.impl.LexerException: Unable to lex url: file:/C:/Documents%20and%20Settings/user/.jenkins/workspace/ksp2/WebContent/js/post/viewEditRevisions.js
Caused by: com.sonar.sslr.impl.LexerException: Unable to lex source code at line : 197 and column : 42 in file : file:/C:/Documents%20and%20Settings/user/.jenkins/workspace/ksp2/WebContent/js/post/viewEditRevisions.js
Caused by: java.lang.IllegalStateException: None of the channel has been able to handle character '"' (decimal value 34) at line 197, column 42
at org.sonar.channel.ChannelDispatcher.consume(ChannelDispatcher.java:87)
at com.sonar.sslr.impl.Lexer.lex(Lexer.java:126)

我不知道为什么。我的 jquery 文件太长,它在这一行抛出异常:

    var postTemplate = '<h3><div class="title">'+data.postResult.title+'</div></h3><p>'+data.postResult.contentPreview+'</p>'+postTags;

我很困惑,我已经将编码设置为UTF-8,但它仍然抛出异常。

最佳答案

你可以尝试这样:sonar_web.xml添加以下代码<property key="sonar.sourceEncoding" value="utf-8" />

引用:https://stackoverflow.com/a/15537832/2193246

关于jquery - Sonar 检查jquery代码错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15408199/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com