Comments (7)
I would propose not to just fix certain files of the project manually and hope that the repository will stay clean and well organized on its own, but introduce a dedicated GitHub CI action with some Matlab linter. It would block all pull requests that do not satisfy the agreed code style.
There are several linters and static code analysis tools available for MATLAB that you can use for GitHub CI (Continuous Integration) to ensure code quality and enforce best practices. Here are a few popular options:
-
MATLAB Code Analyzer (M-Lint): MATLAB itself provides a built-in code analysis tool called M-Lint. It helps identify potential issues and provides suggestions to improve code quality. You can run M-Lint from the MATLAB command window or integrate it into your CI workflow using the MATLAB command-line interface.
Link: https://blogs.mathworks.com/community/2008/09/08/let-m-lint-help-simplify-your-code/ -
miss_hit: MATLAB Independent, Small & Safe, High Integrity Tools - code formatter, Style Checker, Bug finding etc
GitHub repository: https://github.com/florianschanda/miss_hit
These tools can be integrated into your GitHub CI workflow by adding the necessary commands and configurations to your CI pipeline configuration file (e.g., .github/workflows/main.yml).
from zeffiro_interface.
* MATLAB Code Analyzer (M-Lint): MATLAB itself provides a built-in code analysis tool called M-Lint. It helps identify potential issues and provides suggestions to improve code quality. You can run M-Lint from the MATLAB command window or integrate it into your CI workflow using the MATLAB command-line interface. Link: https://blogs.mathworks.com/community/2008/09/08/let-m-lint-help-simplify-your-code/
There is actually a newer linter provided by MathWorks, that has superseded mlint
, called checkcode
. I've been using it to check files when not using the Matlab editor, while writing code. We should probably use that in CI instead, if we choose to stick to built-in functionality.
from zeffiro_interface.
The pull request #218 will introduce a linting action, which will be run when things are pushed to the main_development_branch
(although for testing purposes it is currently set to run when commits are pushed to the related feature branch). I might also add an action that will be run when a pull request is made towards master
.
What is still missing is a comprehensive set of linter messages we wish to disallow. The list of possible values can be found at https://se.mathworks.com/help/matlab/matlab_env/index-of-code-analyzer-checks.html.
from zeffiro_interface.
There is one concern, though: we would need to be sponsored by MathWorks to use the Matlab Actions they provide:
Sponsored License -- for use in support of a program or activity sponsored by MathWorks. Not for government, commercial or other non-sponsored organizational use.
@sampsapursiainen Are we considered to be sponsored by MathWorks?
from zeffiro_interface.
Starting from R2022b, Matlab also provides the codeIssues
function, which provides more thorough information than mlint
and checkcode
. Most importantly, it provides information related to issue severity, in the form of matlab.codeanalysis.IssueSeverity.{info, warning, error}
enumeration, per each issue discovered. The linter now uses that by default, but can also call mlint
and checkcode
if needed.
from zeffiro_interface.
I wrote a little web scraper (link), that allowed me to generate a CSV of Matlab's linter messages and their severities. The file could be loaded as a Matlab table
, which could be used with mlint
and checkcode
to block messages with a severity of error
, as long as the CSV was loaded into the repo, preferrably into the +utilities/
folder.
from zeffiro_interface.
Looks like the related pull request was merged. The linter message file mentioned above was not yet added, but since most of the linter messages seem to be related to the use of eval
, which was already in the list of unwanted warnings, I think we can close this.
from zeffiro_interface.
Related Issues (20)
- Mesh creation didn't converge HOT 2
- Reduce repository size
- Negative conductivity in graph HOT 1
- Figure transparancy does not get set HOT 1
- Allow importing electrodes to an existing project HOT 1
- Sensors/electrodes can't be deleted HOT 1
- Empty electrodes set breaks visualization
- Commit messages HOT 1
- zef_waitbar does not progress with loops with less than 500 iterations HOT 2
- zef_waitbar errors when an integer is passed in as the first argument HOT 1
- handle errors in zef_start_config HOT 1
- Issue template for enhancements and feature requests
- Frame limiter for time series visualization HOT 2
- .gitattributes currently causes Windows line endings ending up into the project index HOT 1
- Scripts related to different studies cannot be run effortlessly from the project root folder HOT 1
- Split mesh generation into proper functions HOT 1
- The function eval is being used where it is not supposed to be used
- Moving core functionality to the core package
- Consider using the new build tool and CodeIssuesTask for your CI linting
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zeffiro_interface.