-
Notifications
You must be signed in to change notification settings - Fork 330
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 MATLAB/Octave extension and comment recognition #126
base: master
Are you sure you want to change the base?
Conversation
Add matlab/octave comment recognition
Hi. Thank you. Would you also be willing to add support for metrics part (metrics.py) ? We have support for a lot of languages, but most of them lack metrics support. I once was pretty proficient in matlab (we had it in a few math courses), but haven't really used it since. To explain how it works; metric_eloc = Specifies the recommended maximum number of lines for a certain file type. |
@adam-waldenberg I will have a look at it, but I guess this will take some time as I'm currently a bit busy. One more question regarding the metrics:
mean? And how to handle cases like:
? Or are the comments stripped before the metrics are calculated? |
@bonanza123 That is the notation for "raw strings" in Python. The string becomes a raw string instead of a Python string. So you don't have to do for example "" to do a single backslash. r"if\s+(.*) should pick up you example (it ignores the rest). You can use something like https://regex101.com/ to test. Have fun ! :) |
@adam-waldenberg One more question: It would also be nice if you could check my modifications, in particular the |
@bonanza123 Hi. Yes, it should see a parfor with that as well. They only immediate problem I see is that "elseif\s+(.*)" is defined as both an entry and exit token. Otherwise it looks good. |
@adam-waldenberg thanks for your feedback. What do you recommend regarding the
I assumed that if we just count from Alternatively, he/she could also write a lot of |
@bonanza123 The elseif's are still counted if they are included in the token list. You should probably also add "else". So in the above case gitinspector would/should count it the following way;
Strictly speaking, each point in the if/elseif/else list is of course an exit point, but we don't really care about that. The gitinspector way of counting complexity isn't "exact". However, it doesn't have to be, as it's mainly a way to just help everybody find badly designed files, not as an exact measurement of a metric. |
After some thought, I actually think you can remove "end" from the token list. |
Looked a bit more at this... It doesn't seem complete. Does matlab require paranthesis around for loops and statements? I Seem to remember you can write similar to;
Quite a few years since I did anything in Matlab. |
Adds MATLAB/Octave extension and comment recognition