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.8.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.8-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: precommitmatlablint-1.0.8.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.8.tar.gz
Algorithm Hash digest
SHA256 d8a1d6b967fd5c32f0fd3bc36aca657e7125bbd99b7a1b1e49be784652bd2c4d
MD5 e18547a10cb0489942e8078ae5b8d566
BLAKE2b-256 7e2bf1ca245e815e74f85e4df60be96bd6ebd2a8b538aefba63d91f67a29b4cb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: precommitmatlablint-1.0.8-py3-none-any.whl
  • Upload date:
  • Size: 17.1 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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 d909ac283e8ca6a93df45a2bf74f7f9c244ff6d7b8ce047c4faa88dfe166fec9
MD5 05402aab05c05d595b9cfeffd07ca40d
BLAKE2b-256 314bf070100097920c97d33465dfa5f77abef42aedc34db80227f055938b174a

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