Skip to main content

A pre-commit hook to validate MATLAB code.

Project description

pre-commit-matlab-lint

License Version on GitHub CodeFactor Created with Tyrannosaurus pre-commit Security Status Code Style: Black

A pre-commit hook for validating MATLAB code.

Available Hook

lint-matlab

Validate MATLAB files by analyzing them with MATLAB's checkcode 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.
  • 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

- 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. New issues and pull requests are welcome. Please refer to the contributing guide and security policy. Generated with Tyrannosaurus and converted to use uv.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

precommitmatlablint-1.0.9.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

precommitmatlablint-1.0.9-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file precommitmatlablint-1.0.9.tar.gz.

File metadata

  • Download URL: precommitmatlablint-1.0.9.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for precommitmatlablint-1.0.9.tar.gz
Algorithm Hash digest
SHA256 40dd783de4e4fa9fba0afc8b3d4316e1823fdea02a8536f36463e771f7b41eb3
MD5 48d28fd003eb470d26554887f5863b63
BLAKE2b-256 2b7bbf4463b2962a004d070efa96b2526371e1b4062161dd17844ca69c728251

See more details on using hashes here.

File details

Details for the file precommitmatlablint-1.0.9-py3-none-any.whl.

File metadata

  • Download URL: precommitmatlablint-1.0.9-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for precommitmatlablint-1.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 efa5e4fa6b928dea76b3e3e93023141737ae32a51deee801d34d9f2fd104b49a
MD5 a1afefb8e545fff3bd1ec61a91f88055
BLAKE2b-256 8ddce23cbb6094464958fbe6b077138f238fce40d6d5e1a3372bf45d06fdf0d9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page