Skip to main content

Stephen Lints Your Python

Project description

SLYP

PyPI - Version PyPI - Python Version


Table of Contents

Hi

:wave:

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

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.2
  hooks:
    - id: slyp

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.

Supported by

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