relint


Namerelint JSON
Version 3.1.1 PyPI version JSON
download
home_pageNone
SummaryWrite your own linting rules using regular expressions.
upload_time2024-03-24 12:29:22
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords regex linter
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![/(re)lint/](https://repository-images.githubusercontent.com/127479533/061e8bfe-f0e0-4f0b-857b-eae82f9df6af)

# reLint

**Regular Expression Linter**

*Write your own linting rules using regular expressions.*

[![PyPi Version](https://img.shields.io/pypi/v/relint.svg)](https://pypi.python.org/pypi/relint/)
[![Test Coverage](https://codecov.io/gh/codingjoe/relint/branch/main/graph/badge.svg)](https://codecov.io/gh/codingjoe/relint)
[![GitHub License](https://img.shields.io/github/license/codingjoe/relint)](https://raw.githubusercontent.com/codingjoe/relint/main/LICENSE)

## Installation

```shell-session
python3 -m pip install relint
```

## [Examples & Recipes – The reLint Cookbook](https://github.com/codingjoe/relint/blob/main/COOKBOOK.md)

## Usage

You can write your own regular rules in a YAML file, like so:

```yaml
- name: No ToDo
  pattern: '(?i)todo' # case insensitive flag
  hint: Get it done right away!
  filePattern: .*\.(py|js)
  error: false
```

The `name` attribute is the name of your linter, the `pattern` can be
any regular expression. The linter does lint entire files, therefore
your expressions can match multiple lines and include newlines.

You can narrow down the file types your linter should be working with,
by providing the optional `filePattern` attribute. The default is `.*`.

The optional `error` attribute allows you to only show a warning but not
exit with a bad (non-zero) exit code. The default is `true`.

The following command will lint all files in the current directory:

```shell
relint -c .relint.yml FILE FILE2 ...
```

The default configuration file name is `.relint.yml` within your working
directory, but you can provide any YAML or JSON file.

If you prefer linting changed files (cached on git) you can use the
option `--diff [-d]` or `--git-diff [-g]`:

```shell
git diff --unified=0 | relint my_file.py --diff
```

### pre-commit

You can automate the linting process by adding a
[pre-commit](https://pre-commit.com/) hook to your project. Add the
following entry to your `.pre-commit-config.yaml`:

```yaml
- repo: https://github.com/codingjoe/relint
  rev: 1.4.0
  hooks:
    - id: relint
      args: [-W]  # optional, if you want to fail on warnings during commit
```


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "relint",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "regex, linter",
    "author": null,
    "author_email": "Johannes Maron <johannes@maron.family>",
    "download_url": "https://files.pythonhosted.org/packages/2d/f5/a3e468170924022e2bddd832351ed443756c4012854fe05d803113e33a20/relint-3.1.1.tar.gz",
    "platform": null,
    "description": "![/(re)lint/](https://repository-images.githubusercontent.com/127479533/061e8bfe-f0e0-4f0b-857b-eae82f9df6af)\n\n# reLint\n\n**Regular Expression Linter**\n\n*Write your own linting rules using regular expressions.*\n\n[![PyPi Version](https://img.shields.io/pypi/v/relint.svg)](https://pypi.python.org/pypi/relint/)\n[![Test Coverage](https://codecov.io/gh/codingjoe/relint/branch/main/graph/badge.svg)](https://codecov.io/gh/codingjoe/relint)\n[![GitHub License](https://img.shields.io/github/license/codingjoe/relint)](https://raw.githubusercontent.com/codingjoe/relint/main/LICENSE)\n\n## Installation\n\n```shell-session\npython3 -m pip install relint\n```\n\n## [Examples & Recipes \u2013 The reLint Cookbook](https://github.com/codingjoe/relint/blob/main/COOKBOOK.md)\n\n## Usage\n\nYou can write your own regular rules in a YAML file, like so:\n\n```yaml\n- name: No ToDo\n  pattern: '(?i)todo' # case insensitive flag\n  hint: Get it done right away!\n  filePattern: .*\\.(py|js)\n  error: false\n```\n\nThe `name` attribute is the name of your linter, the `pattern` can be\nany regular expression. The linter does lint entire files, therefore\nyour expressions can match multiple lines and include newlines.\n\nYou can narrow down the file types your linter should be working with,\nby providing the optional `filePattern` attribute. The default is `.*`.\n\nThe optional `error` attribute allows you to only show a warning but not\nexit with a bad (non-zero) exit code. The default is `true`.\n\nThe following command will lint all files in the current directory:\n\n```shell\nrelint -c .relint.yml FILE FILE2 ...\n```\n\nThe default configuration file name is `.relint.yml` within your working\ndirectory, but you can provide any YAML or JSON file.\n\nIf you prefer linting changed files (cached on git) you can use the\noption `--diff [-d]` or `--git-diff [-g]`:\n\n```shell\ngit diff --unified=0 | relint my_file.py --diff\n```\n\n### pre-commit\n\nYou can automate the linting process by adding a\n[pre-commit](https://pre-commit.com/) hook to your project. Add the\nfollowing entry to your `.pre-commit-config.yaml`:\n\n```yaml\n- repo: https://github.com/codingjoe/relint\n  rev: 1.4.0\n  hooks:\n    - id: relint\n      args: [-W]  # optional, if you want to fail on warnings during commit\n```\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Write your own linting rules using regular expressions.",
    "version": "3.1.1",
    "project_urls": {
        "Changelog": "https://github.com/codingjoe/relint/releases",
        "Project-URL": "https://github.com/codingjoe/relint"
    },
    "split_keywords": [
        "regex",
        " linter"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b209affdd817f1f0198fd3ad4d188c4092d7dda7bb00fb3fd05fa9419c626f15",
                "md5": "2bb4201f9619fdb5498fedec9a7375ec",
                "sha256": "5da22f6c230969b179930e5cd125001de710d342556e782bd76d9178728d8b2a"
            },
            "downloads": -1,
            "filename": "relint-3.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2bb4201f9619fdb5498fedec9a7375ec",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 7736,
            "upload_time": "2024-03-24T12:29:20",
            "upload_time_iso_8601": "2024-03-24T12:29:20.771404Z",
            "url": "https://files.pythonhosted.org/packages/b2/09/affdd817f1f0198fd3ad4d188c4092d7dda7bb00fb3fd05fa9419c626f15/relint-3.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2df5a3e468170924022e2bddd832351ed443756c4012854fe05d803113e33a20",
                "md5": "1f93e2d34045ef2c7e3a68cbabf4a4ac",
                "sha256": "1e18845905485565958640e9e2f9a3b1f79994444670ed6c2450cfbe7c44844f"
            },
            "downloads": -1,
            "filename": "relint-3.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "1f93e2d34045ef2c7e3a68cbabf4a4ac",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 6425,
            "upload_time": "2024-03-24T12:29:22",
            "upload_time_iso_8601": "2024-03-24T12:29:22.410130Z",
            "url": "https://files.pythonhosted.org/packages/2d/f5/a3e468170924022e2bddd832351ed443756c4012854fe05d803113e33a20/relint-3.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-24 12:29:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "codingjoe",
    "github_project": "relint",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "relint"
}
        
Elapsed time: 0.21265s