Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mlint bear #2352

Closed
palash25 opened this issue Mar 17, 2018 · 13 comments
Closed

Add mlint bear #2352

palash25 opened this issue Mar 17, 2018 · 13 comments

Comments

@palash25
Copy link
Member

For MATLAB code

https://in.mathworks.com/help/matlab/ref/mlint.html?requestedDomain=true

@gitmate-bot
Copy link
Collaborator

GitMate.io thinks possibly related issues are #201 (Add TSLint Bear), #2152 (Add ktlint Bear), #2346 (Add slim-lint bear), #2339 (Add isort bear), and #2297 (Add vale lint bear).

@li-boxuan
Copy link
Member

Hi, I get a bit confused. Mlint is just a function that can be run in MATLAB. How can we write a bear for it since a lint bear needs an executable?

@palash25
Copy link
Member Author

maybe we can somehow use the MATLAB compiler for static code analysis using the mlint function. Something like what's been proposed in #2011

@palash25
Copy link
Member Author

But in that case it wouldn't be a difficulty/low issue imo
@li-boxuan

@li-boxuan
Copy link
Member

I would like to solve it.

Some concerns:

  1. I would suggest using checkcode instead of mlint as Matlab says, mlint is not recommended. Use checkcode instead.

  2. I just drafted a lint bear, by using -nodisplay -nodesktop -r "checkcode('<filename>');" arguments. This works as it calls Matlab application to run the checkcode function. However, it takes some time for Matlab to start; if we restart Matlab every time we examine a file, it would be annoying for users as it may take too much time. Any suggestions?

@Makman2
Copy link
Member

Makman2 commented Mar 20, 2018

I would suggest using checkcode instead of mlint as Matlab says, mlint is not recommended. Use checkcode instead.

👍

However, it takes some time for Matlab to start; if we restart Matlab every time we examine a file, it would be annoying for users as it may take too much time. Any suggestions?

Yeah that's a problem. Usually you would start some background service / daemon you would reuse, but that raises the difficulty a bit. Maybe Matlab provides already something for similar purposes?

@li-boxuan
Copy link
Member

li-boxuan commented Mar 20, 2018

I don't think Matlab provide something for similar purposes (at least I cannot find one). The normal practice in Matlab is to run checkcode multiple times for each file in one program. Something like

Matlab -nodisplay -nodesktop -r "checkcode('<filename_1>'); checkcode('<filename_2>'); checkcode('<filename_3>');"

I guess coala cannot handle this case.

@li-boxuan
Copy link
Member

li-boxuan commented Mar 21, 2018

My bad, mlint is an executable (it is also a function call in Matlab). checkcode is just a wrapper for mlint. (See Gimly/vscode-matlab#26)

@Makman2 I think I can handle this issue now.

@li-boxuan
Copy link
Member

I am trying to write tests for MlintBear but I come up with a problem: MATLAB is commercial. How can it pass CI test? Only people with Matlab installed would be able to run the test.

@jayvdb
Copy link
Member

jayvdb commented Mar 22, 2018

Put your bear in new directory /bears/non-free/ , with tests in /tests/non-free/ , and delete both directories in the .CI scripts.

@jayvdb
Copy link
Member

jayvdb commented Mar 22, 2018

In quite a few cases we have rejected non-free linters, because free tools existed, even if not as good, but IMO matlab is a special case. We may end up rejecting this bear, as other maintainers will need to consider this policy question, but at least your CI should be green , and the code not intrusive to the free linters.

A middle ground might be to create a non-free-bears repos ;-)

li-boxuan added a commit to li-boxuan/coala-bears that referenced this issue Mar 22, 2018
Perform lint check on Matlab code.

Closes coala#2352
@li-boxuan li-boxuan mentioned this issue Mar 22, 2018
2 tasks
li-boxuan added a commit to li-boxuan/coala-bears that referenced this issue Mar 22, 2018
Perform lint check on Matlab code.

Closes coala#2352
li-boxuan added a commit to li-boxuan/coala-bears that referenced this issue Mar 23, 2018
Perform lint check on Matlab code.

Closes coala#2352
@saksham189
Copy link
Contributor

If the tests are never run on the CI, how can we know whether the bear is working as intended? What is the need to have a test file in this case? Is it just for the contributor to check and verify?

@jayvdb
Copy link
Member

jayvdb commented Apr 7, 2018

As these are significantly different, we're going to put them in their own repo.
This one is https://gitlab.com/coala/non-free-linter-bears/issues/1

@jayvdb jayvdb closed this as completed Apr 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

6 participants