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

Uploaded Python 3

File details

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

File metadata

  • Download URL: precommitmatlablint-1.0.11.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","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.11.tar.gz
Algorithm Hash digest
SHA256 acb3d019c0eb9d1c961c70d4bea6f7464f09f7be7cdeaaa1cec0a65a0530bd38
MD5 cdbbf6ca69cb1baa556629de1f5bf9a4
BLAKE2b-256 53cdc213db99dc435c78df12b2c1fef85a8e9fb97cd8a3009ac2031116cd8300

See more details on using hashes here.

File details

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

File metadata

  • Download URL: precommitmatlablint-1.0.11-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","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.11-py3-none-any.whl
Algorithm Hash digest
SHA256 21f25d6068b8365bc2350725247ba50e8fcbb6c958882cb4b57915dcc9a38cc0
MD5 de8d4f847023924bb851cccdbff33b80
BLAKE2b-256 8f3309f021daf0e51163082acb9f41dda4960b5fea7c684fed576d4c3bee10e1

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