Skip to main content

Stephen Lints Your Python

Project description

SLYP

Stephen Lints Your Python

PyPI - Version PyPI - Python Version


Table of Contents

Hi

:wave:

I'm Stephen. I'm going to lint your Python code.

I wrote this linter because nothing else out there implemented these rules, and some of them needed CST (rather than AST), so there was no plugin framework (e.g. flake8 plugins) which I could use. I hope it helps you catch slyp-ups.

Installation

slyp is a python package and can be run as a pre-commit hook.

On supported python versions, it should be installed with

pip install slyp

Usage

Either use it as a CLI tool:

slyp src/

Or as a pre-commit hook using the following pre-commit-config.yaml:

- repo: https://github.com/sirosen/slyp
  rev: 0.0.3
  hooks:
    - id: slyp

Options and Arguments

[files...]: If passed positional arguments, slyp will treat them as filenames to check. Otherwise, it will search the current directory for python files.

-v/--verbose: Enable more verbose output

--use-git-ls: Find files to check by doing a git ls-files call and filtering the results to files which appear to be python. This is mutually exclusive with any filename arguments.

--disable CODES: Pass a comma-delimited list of codes to turn off.

Implemented Rules

E100

'unnecessary string concat'

x = "foo " "bar"

E101

'unparenthesized multiline string concat in keyword arg'

foo(
    bar="alpha "
    "beta"
)

E102

'unparenthesized multiline string concat in dict value'

{
    "foo": "alpha "
    "beta"
}

E103

'unparenthesized multiline string concat in collection type'

x = (  # a tuple, set or list
    "alpha "
    "beta",
    "gamma"
)
x = {  # e.g. a set
    "alpha "
    "beta",
}

W200

'two AST branches have identical contents'

if x is True:
    return y + 1
else:
    # some comment
    return y + 1

License

slyp is distributed under the terms of the MIT license.

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

slyp-0.0.3.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

slyp-0.0.3-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file slyp-0.0.3.tar.gz.

File metadata

  • Download URL: slyp-0.0.3.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for slyp-0.0.3.tar.gz
Algorithm Hash digest
SHA256 5373a5e25c2a1558c44f52bf0e836d6b7fab713ff84594ec7435983f3fe9d4df
MD5 51abc19927d5d4a928e19f8968c4b05a
BLAKE2b-256 1e2fb36ba5e1ed4265a692e7f100a9b09f2d01d3af94f5191199254aab9d7184

See more details on using hashes here.

Provenance

File details

Details for the file slyp-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: slyp-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for slyp-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f7f39952c36ae9ed2a09058ee2263b83554ced0782ab8ef20d5f0549e0c284ef
MD5 c33dc5cb9a3a0f6b939ceba272980794
BLAKE2b-256 78532d1ef0ae72138c632ed192f103546a366c2d7017ac6080e596ec4d02c3a1

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