Parsing Lint Errors in Eclipse
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?
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
- Severity: Info
- Pattern: (.) ([0-9]): Error -> Info (.*)
- File: $1
- Line: $2
- Description: $3
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.
精彩评论