Skip to main content

Check Python files for repeat use of strings

Project description

ci python3.8 pypi codecov.io mit black

Check Python files for repeat use of strings

Installation

$ pip install constcheck

Usage

usage: constcheck [-h] [-f] [-n] [-v] [-c INT] [-l INT] [-p PATH] [-s STR]

optional arguments:
-h, --help

show this help message and exit

-f, --filter

filter out empty results

-n, --no-color

disable color output

-v, --version

show version and exit

-c INT, --count INT

minimum number of repeat strings

-l INT, --len INT

minimum length of repeat strings

-p PATH, --path PATH

path to check files for

-s STR, --string STR

parse a string instead of a file

constcheck will display the quantity of strings repeated for the:
  • path

  • each dir

  • individual files

The default length of strings to check for is 3

The default quantity of strings to check for repeats is also 3

>>> EXAMPLE = (
...     'STRING_1 = "Hey"'
...     'STRING_2 = "Hey"'
...     'STRING_3 = "Hey"'
...     'STRING_4 = "Hello"'
...     'STRING_5 = "Hello"'
...     'STRING_6 = "Hello"'
...     'STRING_7 = "Hello"'
...     'STRING_8 = "Hello, world!"'
...     'STRING_9 = "Hello, world!"'
...     'STRING_10 = "Hello, world!"'
...     'STRING_11 = "Hello, world!"'
...     'STRING_12 = "Hello, world!"'
... )
>>>
>>> import constcheck
>>> constcheck.main(string=EXAMPLE, no_color=True)
"3   | Hey"
"4   | Hello"
"5   | Hello, world!"

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

constcheck-0.1.0.tar.gz (8.3 kB view hashes)

Uploaded Source

Built Distribution

constcheck-0.1.0-py3-none-any.whl (8.7 kB view hashes)

Uploaded Python 3

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