不久前,我写了一篇关于 使用 lint 的博客eclipse,现在我想最终让错误解析工作起来,以便我可以单击 lint 信息/警告/错误行并让它跳转到代码中的该位置。似乎有一些标准方法,但我无法让它们发挥作用。我愿意接受以下问题之一的一般答案或具体答案。
-
使用 makefile 而不是外部工具。我使用了托管构建,但我已经接近了,现在在我的托管构建中,我有一个尝试运行 lint 而不是进行构建的配置。唯一的问题是 Eclipse 中的某些内容不断向命令添加“-k”选项,这会导致 lint 失败。有谁知道如何阻止 Eclipse 添加 -k 选项? (如果我删除它,它就会回来)。
-
另一种方法是解析控制台窗口的输出。我发现了一个名为 ErrorLink 的插件,它看起来很完美。不幸的是,要么我无法构建符合要求的正则表达式,要么我没有配置该工具以正确运行 lint。相当稀疏的指示说明将您的 exe 添加到 .xml 文件中。我找到了xml文件并添加了
>>
然后我尝试了一个简单的正则表达式,例如 (SomeFileName`.cpp),我确保 SomeFileName.cpp 出现在结果中,但没有生成链接。我无法判断 ErrorLink 插件是否实际运行,但我猜它没有运行。那么有人用过这个插件吗?关于如何让它与 lint 一起工作有什么提示吗?
A while back I wrote a blog on using lint in eclipse, now I would like to finally get the error parsing to work so that I can click on the lint info/warning/error line and have it jump to that location in code. There seem to be a couple of standard approaches but I can't get them to work. I'm open to a general answer or a specific answer to one of the questions below.
-
Using a makefile instead of an external tool. I used managed builds but I've gotten close and now in my managed build I have a configuration that attempts to run lint instead of doing a build. The only problem is that something in Eclipse keeps adding the "-k" option to the command, which causes lint to fail. Does anyone know how to keep Eclipse from adding that -k option? (If I delete it, it just comes back).
-
The other approach is to parse the output to the console window. I found a plug-in called ErrorLink that seemed perfect. Unfortunately, either I can't construct a conforming regular expression or I'm not configuring the tool to run correctly for lint. The rather sparse directions say to add your exe to the .xml file. I found the xml file and added
<consoleLineTracker class="net.sourceforge.sunshade.errorlink.RegexpLineTracker" processType="lint-nt" id="regexpLineTracker"
></consoleLineTracker
>
Then I tried a simple regex like (SomeFileName`.cpp) where I made sure SomeFileName.cpp showed up in the results, but no links are generated. I can't tell if the ErrorLink plug-in actually ran but I'm guessing it didn't. So has anyone ever used this plug-in? Any hints on how to get it to work with lint?
发布评论
评论(1)
转到“行为”选项卡,取消选中“干净”,在那里添加您的 lint 选项(这为我解决了这个问题)
转到:
菜单栏:窗口|偏好设置
导航树:C/C++ |构建
选择选项卡:“错误解析器”
单击解析器列表右侧的“添加”,将其命名为“my Funky PCLint RegEX”并选择它
单击下面“错误解析器选项”框中的“添加”
例如,一个不完美的列表
和
- 严重性:警告
- 模式:(.) ([0-9]):错误 ->警告 (。*)
- 文件:1 美元
- 线路:2 美元
- 描述:$3
警告和信息几乎相同。欢迎任何调整正则表达式的人。
Go to the Behaviour Tab, uncheck "clean", add your lint options there (that solved this issue for me)
Go to:
Menu-bar: Window | Preferences
navigation tree: C/C++ | Build
choose the tab: "Error Parsers"
Click "Add" right to the parser list, and name it like "my Funky PCLint RegEX" and select it
Click "Add" in the "Error Parser Options" box below
For example a non perfect List
and
- Severity: Warning
- Pattern: (.) ([0-9]): Error -> Warning (.*)
- File: $1
- Line: $2
- Description: $3
Warning and Info are pretty mouch the same. anyone tweaking the regex is welcome.