PC Lint for incremental build - with error from latest code - lint

I am having a CI setup with incremental build. As part of the static checking, I am planning to configure a incremental PC Lint report - This report ignoring all other previous Lint report should provide the errors induced in the new code only. Is there any tool which would do this?
Any hint on the relative area to explore would help us.
I tried report diff'ing. But since the line number would vary from last check-in, would not get the actual incremental error introduced.
I am using Linux for my project build, and using Windows for PC Lint report generation.
Regards,

Wouldn't it be easier to just fix all the reported errors, and have a strict policy against creating new ones? That way you don't need to worry about diffs which by the nature of the problem is going to be hard to impossible.

You could write a script that takes the warnings from lint, removes the line numbers and adds a few lines from the source code around where the warning occurs. Diffing this would show all new lint warnings. One flaw in this, is that it would also show any warnings where source was modified near an existing warning without fixing the warning. On the other hand, this might actually be useful.
Years ago, I saw a utility on BDS Unix that would take your compiler errors and stuff them into your source code as comments. Which might be useful for this exercise. Unfortunately I can't remember what it was called.

Related

Why would building a program fail sometimes but not others, without any changes to the source or settings? Possibly defective hardware?

I recently built a large-ish open source program in Visual Studio 2013. Initially the build failed due to a couple errors (a C1900 and a LNK2019). These errors were quite puzzling since I was following clear, simple instructions for building the program. The main developer couldn't think of any good reasons why they would occur.
I turned off my laptop overnight and the next morning I reattempted the build with the intention of reproducing the errors. But to my great surprise, no errors. I did not change any of the source or any compiler settings, etc.
Later that day I decided to do another build, and I got the same errors as before. I shut down my laptop for a minute or so, turned it back on, tried building again and it worked.
Clearly this is really strange. I have reason to suspect that there is some faulty hardware in my laptop. Could that cause these mysterious disappearing errors?
Try this on another machine and see if you get the same results. If you do, you'll know it's not a hardware issue.
It's more probable that you don't have complete build steps provided by the other developer. If he only built/tested it on his computer, then he may have added/installed (and not documented) some other tools/scripts/libraries necessary for a successful build - that he doesn't even remember about. There could also be circular dependencies between the projects which prevent you from building in one step.
You should try and identify the relationships between the projects and then build them separately, until you find where the problem is. You start with those projects not having references on any other ones, and so on. Eventually, you'll find the 'problem' project, and it'll be easier to fix.

Encountered Strange Error: " & ErrorName

New to VisualStudio 2015, but not to programming. Have searched both Google and here for a lead on this, but considering the available search terms, I might not immediately uncover them.
I was looking into porting an old VB6 (200k+ LoC) to VB.Net in VS2015. Mostly just poking around to determine viability. Using a project converter, and have resolved most of the initial errors, and am familiar with how the Error List works.
However, it is throwing a new one at me. It now only has two lines of error, both showing the same thing. They both say:
" & ErrorName
That's a Quote, Ampersand, and ErrorName. That's all that show up on the error list line. No file. No line number. Double click on them does nothing.
I thought perhaps the project was corrupted, so I completely re-created it, adding all the modules, forms, classes, etc again, and it found a lot more errors to fix, which I fixed, and now these two lines show up again.
Does anyone have any indication where this is coming from, or, better yet, how to fix?
I've seen VB programmers report this misbehavior before, never with a good lead to explain the problem. It is specific to VS2015, the Roslyn integration caused many issues. In general a very buggy release, be sure to apply all available Updates, currently up to Update 3. If you have a license that includes an MSDN subscription then I recommend you install VS2012, the last "good" version of VS that was not yet affected by Microsoft's new focus on agile development.
I think the underlying issue is caused by the IDE simply not parsing the compiler error message correctly. Probably having to do with the statement with the error getting quoted in the message. Getting only part of the statement text and it fumbling quotes is a pretty good hint that this is where it went wrong.
So look at the actual output of the compiler, decent odds you'll now see the full error text. Use Tools > Options > Project and Solutions > Build and Run. Change the "MSBuild output build output verbosity" setting to Normal. After the failed build, use View > Output to see the compiler output. You'll probably have a lot of messages, consider copy/pasting the content.

xcode - Need suggestion comment in source file

I started adding comments to the code while i am developing the app (objective-c). The bad thing which i am noticing is the breakpoints and warning or error reporting, it is actually showing a wrong line number or pointing to incorrect line number, is there a solution for this problem. Thanks.
This is usually a problem with your Derived Data, the build products that are cached after each build so they don't have to be rebuilt if they aren't changed. The problem is, sometimes Xcode doesn't recognize a change, and what you see in the editor no longer matches the build product. Clean your product with Shift Command K to do a full rebuild. This should fix the inconsistencies you're seeing.

grunt lesslint how to prevent output from being written to console

We are trying to use grunt-lesslint in our project, as our UI developer is comfortable fix errors in less file. grunt-recess seems more powerful but not sure if it can point errors in less file itself. I am unable to comprehend enough from lesslint page, and there do not seem to be many examples. Does anyone know the following:
How to prevent lesslint from displaying on the console. I use formatters and the report file is generated, but it also prints on console, which I do not want to.
How to make lesslint fail only in the case of errors (not warnings). Also csslint seems to report errors also, while lesslint mostly gives warnings only, why is that so? Does lesslint throw errors as well? How to make it fail only in case of errors?
I tried using 'checkstyle-xml' formatter, but it does not seem to use it (I have used in jshint and it gives a properly formatted xml, which it does not give for lesslint).
Is it possible to compile less (many files or directories) in conjunction with lesslint? Any example?
Thanks,
Paddy
I'd say it's more of a common practice to display stdout for this kind of thing; the JSHint plugin does it, as does any other linting plugin that I've used. If you get in another developer that uses Grunt they'll probably expect stdout too. If you really want to override this, use grunt-verbosity: https://npmjs.org/package/grunt-verbosity
Again, this is a convention in Grunt; if a task has any warnings then it fails. The reason being if you lint a file and the linter flags something up it should be dealt with straight away, rather than delay it; six months time you have 500 errors that you haven't fixed and you're less likely to fix them then. Most linting plugins allow you to specify custom options (I've used CSS Lint and that is very customisable), so if you don't like a rule you can always disable it.
This should work. If there's a bug with this feature you should report it on the issue tracker, where it will be noticed by the developers of the plugin. https://github.com/kevinsawicki/grunt-lesslint/issues
Yes. You can set up a custom task that runs both your linter and compile in one step: something like grunt.registerTask('buildless', 'Lint and compile LESS files.', ['lesslint', 'less']); note that you'll have to install https://github.com/gruntjs/grunt-contrib-less to get that to work. Also note that, failing linting will not compile your LESS files; mandate that your code always passes the lint check; you'll help everyone involved in the project.

INotifyPropertyChanged.PropertyChanged implemented and not implemented; Visual Studio build error

I'm seeing a strange build bug a lot. Sometimes after typing some code we receive the following build error.
Class 'clsX' must implement 'Event PropertyChanged(sender As Object, e As PropertyChangedEventArgs)' for interface System.ComponentModel.INotifyPropertyChanged'.
And
'PropertyChanged' cannot implement 'PropertyChanged' because there is no matching event on interface 'System.ComponentModel.INotifyPropertyChanged'.
Those error should never go together! Usually we can just ignore the exception and build the solution but often enough this bug stops our build. (this happens a lot using Edit and Continue which is annoying)
We're using Vb.net and c# mixed in one big solution.
Removing the PropertyChanged event and retyping the same code! sometimes fixes this.
Question:
Has anyone else seen this problem and has some suggestions how to prevent his?
We're using a code generator that causes this error to surface but just editing some files manually triggers this exception too. This error occur's on multiple machines using various setups.
Someone had the same exact issue discussed here. It sounds like there is an issue with this build picking up an old version of a binary. I would try the following in order:
Verify all assembly references use project references where possible within the Visual Studio solution.
Disable build parallelization in case there is some weird file locking issue with concurrent project builds. Go to Tools -> Options, Projects and Solutions -> Build and Run, then set "maximum number of parrellel project builds" to 1. Not the best solution but it may help narrow down the problem.
Disable the Hosting Process in case it's locking some file causing an assembly to not get rebuilt correctly. For C# project go to Project Properties, Debug tab, and uncheck "Enable the Visual Studio hosting process". For VB.NET project you'll need to Unload Project, Edit the project file, and add <UseVSHostingProcess>false</UseVSHostingProcess> to the PropertyGroup of each configuration. Again, not the best solution but you probably won't notice a difference.
Lastly, try doing a Clean + Build to try and resolve the issue when it occurs (I know this is not a fix but it's easy enough to do), also Rebuild may be slightly different than Clean + Build so try the latter if the former doesn't work.
As I can not comment due to lack of appropriate points.
But I would like to share one of my experience:
In an aspx.cs page I was working, used to compile fine and some time gave mysterious error of a variable not defined or function not defined or sometime variable or the function defined two times. I changed possibly each and every variable and function name but there seemed no effect , but after entering a simple space or a new line at any place in the file used to solve the compile error. At one time I tried to save the file (in a different encoding as i am used to experiments) and found that the file was not saving in the correct encoding (i.e. the ansi encoding because the file had a unicode character ), I removed the unicode character and that compile error didn't bothered me again.
This unicode character problem could be (not a hard and fast rule) there so you could check it.
Nuke & restore using source control (TFS instructions here):
Make sure you have everything checked in
Exit Visual Studio
Rename the project directory to .Bak (effectively deleting it)
Reopen Visual Studio and in source control:
Get Specific Version
check 'Overwrite... not checked out' and 'Overwrite ... even if local version matches'
Re-open project
Another problem: Make sure some source files are not newer than the current date (or your date is set back). Often this happens in apps where you are doing logic that requires certain things to happen differently on certain dates. You change your clock to test it, make a revision to the source with the date advanced, set the date back, and viola, rebuild does not rebuild that file.
You say 'typing it in again' - can you try just saving? After 40 years since MULTIX the .net build still decides what has changed by checking the file timestamp.
good luck!
When you get the error, is it always on the VB calling C# side, or vice-versa, or does it work both ways?
If the answer is either of the first two situations, try building the "callee" project within the solution before building the "caller" project to see if it stops the situation.
Also, just in case it may jog something for you to think about, does this error crop up when you change a VB file or a C# file, or is there no correllation?
Oh, and sorry this looks like an answer instead of a comment, I cannot post comments yet (need 50 rep).