Metadata-Version: 2.4
Name: precommitmatlablint
Version: 1.0.8
Summary: A pre-commit hook to validate MATLAB code.
Author: Ty Cumby
Maintainer: Ty Cumby
License: MIT
Project-URL: Homepage, https://github.com/ty.cumby/pre-commit-matlab-lint
Project-URL: Repository, https://github.com/ty.cumby/pre-commit-matlab-lint
Project-URL: CI, https://github.com/ty.cumby/pre-commit-matlab-lint/actions
Project-URL: Issues, https://github.com/ty.cumby/pre-commit-matlab-lint/issues
Project-URL: Download, https://pypi.org/project/precommitmatlablint/
Keywords: matlab,pre-commit,linter
Classifier: Development Status :: 5 - Production/Stable
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Environment :: Console
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: defusedxml>=0.7
Requires-Dist: requests>=2.31
Requires-Dist: pyyaml>=6.0
Requires-Dist: tox>=4.25.0
Requires-Dist: tomlkit>=0.13.3
Dynamic: license-file

# pre-commit-matlab-lint

[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![](https://img.shields.io/badge/python-3.8%2B-blue)]()
[![Version on GitHub](https://img.shields.io/github/v/release/tcumby/pre-commit-matlab-lint?include_prereleases&label=GitHub)](https://github.com/tcumby/pre-commit-matlab-lint/releases)
[![CodeFactor](https://www.codefactor.io/repository/github/dmyersturnbull/tyrannosaurus/badge)](https://www.codefactor.io/repository/github/dmyersturnbull/tyrannosaurus)
[![Created with Tyrannosaurus](https://img.shields.io/badge/Created_with-Tyrannosaurus-0000ff.svg)](https://github.com/dmyersturnbull/tyrannosaurus)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![Security Status](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit)
[![Code Style: Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

A [pre-commit hook](https://pre-commit.com/) for validating MATLAB code.

## Available Hook

### lint-matlab

Validate MATLAB files by analyzing them with MATLAB's [checkcode](https://www.mathworks.com/help/matlab/ref/checkcode.html) function.

In order to use this hook, MATLAB must be installed and registered. There are three ways to specify which MATLAB instance should be used:

- Use `--matlab-home-path=PATH` to supply the full path to a MATLAB home directory (e.g. "/Applications/MATLAB_R2021a.app" on macOS, "C:\Program Files\MATLAB\R2021a" on Windows)
- Use `--matlab-version=VERSION` to specify a MATLAB version to locate (e.g. "9.10")
- Use `--matlab-release-name=NAME` to specify a MATLAB release to locate (e.g. "R2021a")

Other options:

- Use `--treat-warning-as-error` to fail on linter warnings, in addition to linter errors.
- Use `--enable-cyclomaticity` to enable McCabe cyclomaticity complexity calculation display for each file.
- Use `--enable-modified-cyclomaticity` to enable modified cyclomaticity complexity calculation display for each file.
- Use `--ignore-ok-pragmas` to ignore `%#ok` checkcode suppression pragmas in files.
- Use `--checkode-config-file=FILE` to specify a settings file. For instructions detail how to create the file, see [Save and Reuse Code Analyzer Message Settings](https://www.mathworks.com/help/matlab/matlab_prog/check-code-for-errors-and-warnings.html#brqxeeu-173).
- Use `--use-default-checkcode-config` to ignore any checkcode settings files and use factory defaults.

## Usage with pre-commit

Add this to your `.pre-commit-config.yaml`

```yaml
- repo: https://github.com/tcumby/pre-commit-matlab-lint
  rev: "" # Use the sha / tag you want to point at
  hooks:
    - id: lint-matlab
      args: ["--matlab_release_name=R2021a"]
```

Licensed under the terms of the [MIT License](https://spdx.org/licenses/MIT.html).
[New issues](https://github.com/tcumby/pre-commit-matlab-lint/issues) and pull requests are welcome.
Please refer to the [contributing guide](https://github.com/tcumby/pre-commit-matlab-lint/blob/main/CONTRIBUTING.md)
and [security policy](https://github.com/tcumby/pre-commit-matlab-lint/blob/main/SECURITY.md).
Generated with [Tyrannosaurus](https://github.com/dmyersturnbull/tyrannosaurus) and converted to use [uv](https://github.com/astral-sh/uv).
