Skip to main content

A Collection of pre-commit hooks for MATLAB

Project description

PyPI - Python Version PyPI PyPI - License pre-commit.ci status lint-and-test Code style: black

pre-commit-matlab

A collection of pre-commit hooks for MATLAB

Ok... it's just one hook so far but maybe someday there will be more 😃

Using pre-commit-matlab with pre-commit

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

-   repo: https://github.com/sco1/pre-commit-matlab
    rev: v1.1.0
    hooks:
    -   id: matlab-reflow-comments
        args: [--line-length=100]

Hooks

matlab-reflow-comments

Reflow comments (lines beginning with %) in MATLAB file(s) (*.m) to the specified line length.

Blank comment lines are passed back into the reformatted source code.

  • Specify line length with args: [--line-length=100] (Default: 75)
  • Ignore comments with inner indentation args: [--ignore-indented=True] (Default: True)
  • Use args: [--alternate-capital-handling=True] to treat comment lines that begin with a capital letter as the start of a new comment block (Default: False)

If ignore-indented is True, comments that contain inner indentation of at least two spaces is passed back into the reformatted source code as-is. Leading whitespace in the line is not considered.

For example:

    % This is not indented
% This is not indented
%  This is indented
%    This is indented

If alternate-capital-handling is True, if the line buffer has contents then a line beginning with a capital letter is treated as the start of a new comment block.

For example:

% This is a comment line
% This is a second comment line that will not be reflowed into the previous line

NOTE: As an opinionated flag, this may lead to false positives so it is off by default. If enabled, pay close attention to the resulting diff to ensure that your comments are being reflowed as desired.

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

pre-commit-matlab-1.1.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

pre_commit_matlab-1.1.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file pre-commit-matlab-1.1.0.tar.gz.

File metadata

  • Download URL: pre-commit-matlab-1.1.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

File hashes

Hashes for pre-commit-matlab-1.1.0.tar.gz
Algorithm Hash digest
SHA256 e55a3d2e1880e25bfa00743e6b7aeebbb2dfb9d8e70f455ba113eed630b07253
MD5 a08d64c6298d1fd8c373cf6fd5a2f287
BLAKE2b-256 2d6c3e34ed026b5efab634c725bac3676e60aa273eb262901cb97f0666b6726b

See more details on using hashes here.

Provenance

File details

Details for the file pre_commit_matlab-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pre_commit_matlab-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

File hashes

Hashes for pre_commit_matlab-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8dcbc2eb023e95348d571ffe50bf8e38cb433f7e954644951f4ad0d7de795b64
MD5 57778779c8a7b0dacb4912b875e75591
BLAKE2b-256 5c4cb29e42876b4ed9cfeeed721e2d967eb2e19dfe0cc5582224c1060aa7c3b6

See more details on using hashes here.

Provenance

Supported by

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