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

MATLAB/Octave comments #357

Closed
demsarjure opened this issue May 12, 2021 · 5 comments
Closed

MATLAB/Octave comments #357

demsarjure opened this issue May 12, 2021 · 5 comments
Labels
comment-styles Request for a new comment style, or fixing a bug with these good first issue Good for newcomers

Comments

@demsarjure
Copy link

Hi!

I just used the reuse-tool to license our code properly. The tool is great and I had no major issues when sorting things out. Thanks for preparing and maintaining the tool!

I would only recommend that you add the option of adding headers in MATLAB/Octave files (.m files). MATLAB/Octave are quite popular amongst the scientific community. I had to add headers in our code manually. I saw later from your source code that I could also use the option of adding headers to Tex files (LaTeX and MATLAB/Octave have same style of single line comments). In MATLAB/Octave single line comments start with "%", while block comments are encapsulated in

%{
...
comments block
...
%}

I think this simple addition would make your tool even better and useful for a wider audience.

Cheers, Jure

@mxmehl mxmehl added the comment-styles Request for a new comment style, or fixing a bug with these label May 12, 2021
@nicorikken
Copy link
Member

I started work in this, only to found out this is a bit more complicated. Both the # and % (and thus #{ #} and %{ %} are used for comments. From my history with Matlab and Octave I remember mainly using the %, but I did find the # syntax on GitHub as well. Some Octave documentation on the available comment syntax: https://octave.org/doc/v5.2.0/Comments.html

I'm not sure how to deal with 2 valid comment syntax in Reuse at the moment. There is a similar thing going on for the BatchFileCommentStyle for which multiple comment styles are valid. Thinking about how I would like to specify it, I would define multiple comment styles, and add them as a list to the EXTENSION_COMMENT_STYLE_MAP dictionary for a particular file extension. And the parser should then be able to select the applicable format and chose that over the others.

@mxmehl
Copy link
Member

mxmehl commented Jun 15, 2021

@nicorikken Good question! Please feel free to make a suggestion. For adding a comment, I think we could stick to one syntax. Of course, one could try to find out an already used comment syntax but that seems to be a bit overload IMHO.

For detecting used comment styles, we may only have to add % if no comment style already uses that for single-line comments. # is already used by PythonCommentStyle so the linter should find it, right?

@JoKeyser
Copy link
Contributor

JoKeyser commented Jul 18, 2022

In Matlab, # is not recognized as a comment, so % should be used to generate headers.
For generation, I would also prefer single-line comments over multi-line comments.

So I think you could just reuse (pun intended) the tex filter?
(As a workaround, I add --style tex to the reuse command.)

For detection, it would of course be nice if all valid styles are recognized.
The tool already recognizes single-line comments using %, I assume because they are identical with the tex style.

@nicorikken
Copy link
Member

Thanks @JoKeyser for sharing your insight. Then it should be easy to add support.

@nicorikken nicorikken added the good first issue Good for newcomers label Jul 20, 2022
carmenbianca added a commit that referenced this issue Jul 1, 2024
…ctave-file-support

add octave/matlab file format support #357 #604
@carmenbianca
Copy link
Member

Closed by #1015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comment-styles Request for a new comment style, or fixing a bug with these good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants