Comments on: M-Lint Live in Editor in R2006a https://blogs.mathworks.com/loren/2006/03/15/m-lint-in-r2006a/?s_tid=feedtopost Loren Shure is interested in the design of the MATLAB language. She is an application engineer and writes here about MATLAB programming and related topics. Fri, 01 Feb 2019 14:45:28 +0000 hourly 1 https://wordpress.org/?v=6.2.2 By: Li Dayong https://blogs.mathworks.com/loren/2006/03/15/m-lint-in-r2006a/#comment-12304 Thu, 21 Sep 2006 01:49:29 +0000 https://blogs.mathworks.com/loren/?p=24#comment-12304 How can configure mlint when I edit dot m file in Emacs in Linux? Every time I open a M file in Emacs, it complains that “no MLINT program available”. I find mlint in matlab/bin/glnx86, but it seems that Emacs can not use it properly.

Thanks!

]]>
By: Loren https://blogs.mathworks.com/loren/2006/03/15/m-lint-in-r2006a/#comment-157 Wed, 03 May 2006 11:50:18 +0000 https://blogs.mathworks.com/loren/?p=24#comment-157 I agree about needing to allow mlint to be customized so users can choose which messages are important for their particular work. People here are thinking hard about that issue.

]]>
By: Jette https://blogs.mathworks.com/loren/2006/03/15/m-lint-in-r2006a/#comment-156 Wed, 03 May 2006 11:47:07 +0000 https://blogs.mathworks.com/loren/?p=24#comment-156 I like mlint in the editor – but I miss the possibility to tell mlint to ignore certain types of problems. We have a number of (partially ugly) patterns in our code which we can’t change in the near future but which produce a number of mlint-messages. It is quite difficult to find the few really useful messages in between all the messages about things we know. In my opinion, marking a line with %#ok is not a solution.

]]>
By: Matthew Simoneau https://blogs.mathworks.com/loren/2006/03/15/m-lint-in-r2006a/#comment-97 Tue, 28 Mar 2006 21:07:15 +0000 https://blogs.mathworks.com/loren/?p=24#comment-97 I uploaded a submission to the File Exchange to let you compute your Code Metrics offline.

]]>
By: John D'Errico https://blogs.mathworks.com/loren/2006/03/15/m-lint-in-r2006a/#comment-92 Mon, 20 Mar 2006 17:37:13 +0000 https://blogs.mathworks.com/loren/?p=24#comment-92 Martin had an interesting idea. But instead of creating a special new variable called “unused”, why not “ans”? It is already the bit bucket that stuff gets put into anyway.

John

]]>
By: Loren https://blogs.mathworks.com/loren/2006/03/15/m-lint-in-r2006a/#comment-90 Sun, 19 Mar 2006 12:52:45 +0000 https://blogs.mathworks.com/loren/?p=24#comment-90 Josh-

I am not knowledgeable about emacs (though thankfully there are some at MathWorks). Hopefully someone who does know more can add to this thread. Here‘s one matlab mode file, but I don’t know if it includes the mlint capability.

You’ll get a good link if you search for emacslink in the MATLAB documentation. It tells you how to download it and points you to installation choices, including configuring it for an integrated mlint experience.

There is a menu item in Emacs to turn on the M-Lint warnings, or you can read the
header-comments in mlint.el to see how to configure it automatically.

]]>
By: Josh https://blogs.mathworks.com/loren/2006/03/15/m-lint-in-r2006a/#comment-89 Sat, 18 Mar 2006 22:41:51 +0000 https://blogs.mathworks.com/loren/?p=24#comment-89 Loren,

I like that M-Lint seems to find non-trivial code issues (like replacing prod(size(x)) with numel(x)), but I am not ready to give up using emacs for editting .m files.

What is the best way to use emacs with M-Lint? (I saw something about matlab-mode on your Newsletter, but it seemed unclear to me).

Thanks,
Josh

]]>
By: martin cohen https://blogs.mathworks.com/loren/2006/03/15/m-lint-in-r2006a/#comment-88 Sat, 18 Mar 2006 05:07:10 +0000 https://blogs.mathworks.com/loren/?p=24#comment-88 How about having a special variable name (such as “unused”) to indicate a variable that will not be used. It could be followed by any number of digits to allow multiple unused variables in the same expression.

So, the statement above could be

[unused , tags] = sort(x);

]]>
By: Loren https://blogs.mathworks.com/loren/2006/03/15/m-lint-in-r2006a/#comment-87 Fri, 17 Mar 2006 14:49:56 +0000 https://blogs.mathworks.com/loren/?p=24#comment-87 John-

I totally agree (and it’s still true in R2006a). MATLAB doesn’t have a nice way to mark unused variables and toss them nicely (the equivalent of /dev/null). I assume you’d like mlint to still tell you about other variables that truly aren’t used, like if I have code where I mistype a variable name. But these unused ones that are unavoidable right now and yet required by MATLAB are a real annoyance.

–Loren

]]>
By: John D'Errico https://blogs.mathworks.com/loren/2006/03/15/m-lint-in-r2006a/#comment-86 Fri, 17 Mar 2006 14:37:56 +0000 https://blogs.mathworks.com/loren/?p=24#comment-86 Loren,

One of the things that has irritated me about mlint is its tendency to
flag unused variables. Suppose you need only the tags that come from
a sort?

[junk , tags] = sort(x);

Mlint will flag junk as an unused variable. But since tags is used, there is
no way to get it without the first argument. I’ve even tried the construct

[tags , tags] = sort(x);

Mlint still flagged that first occurrence of tags as unused!

(This is in my old R14, SP1.)

John

]]>