How to use the pyroma.ratings function in pyroma

To help you get started, we’ve selected a few pyroma examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github regebro / pyroma / pyroma / __init__.py View on Github external
logging.info("-" * 30)
    logging.info("Checking " + argument)

    if mode == "directory":
        data = projectdata.get_data(os.path.abspath(argument))
        logging.info("Found " + data.get("name", "nothing"))
    elif mode == "file":
        data = distributiondata.get_data(os.path.abspath(argument))
        logging.info("Found " + data.get("name", "nothing"))
    else:
        # It's probably a package name
        data = pypidata.get_data(argument)
        logging.info("Found " + data.get("name", "nothing"))

    rating = ratings.rate(data)

    logging.info("-" * 30)
    for problem in rating[1]:
        # XXX It would be nice with a * pointlist instead, but that requires
        # that we know how wide the terminal is and nice word-breaks, so that's
        # for later.
        logging.info(problem)
    if rating[1]:
        logging.info("-" * 30)
    logging.info("Final rating: " + str(rating[0]) + "/10")
    logging.info(ratings.LEVELS[rating[0]])
    logging.info("-" * 30)

    return rating[0]
github regebro / pyroma / pyroma / __init__.py View on Github external
# It's probably a package name
        data = pypidata.get_data(argument)
        logging.info("Found " + data.get("name", "nothing"))

    rating = ratings.rate(data)

    logging.info("-" * 30)
    for problem in rating[1]:
        # XXX It would be nice with a * pointlist instead, but that requires
        # that we know how wide the terminal is and nice word-breaks, so that's
        # for later.
        logging.info(problem)
    if rating[1]:
        logging.info("-" * 30)
    logging.info("Final rating: " + str(rating[0]) + "/10")
    logging.info(ratings.LEVELS[rating[0]])
    logging.info("-" * 30)

    return rating[0]
github jayclassless / tidypy / src / tidypy / tools / pyroma.py View on Github external
try:
    logging.basicConfig = lambda **k: None
    from pyroma import projectdata, ratings
finally:
    logging.basicConfig = old_config


# Hacks so we can get the messages of these tests without running them.
HACKS = (
    ('PythonVersion', '_major_version_specified', False),
    ('ValidREST', '_message', ''),
    ('ClassifierVerification', '_incorrect', []),
    ('Licensing', '_message', ''),
)
for clazz, attr, value in HACKS:
    if hasattr(ratings, clazz):
        setattr(getattr(ratings, clazz), attr, value)


TIDYPY_ISSUES = {
    'NOT_CALLED': (
        'SetupNotCalled',
        'setup() was not invoked.',
    ),

    'SCRIPT_FAIL': (
        'SetupFailed',
        'Execution of the setup module failed:\n%s',
    ),

    'RST_ERROR': (
        'RstProblem',
github PyCQA / prospector / prospector / tools / pyroma / __init__.py View on Github external
# problems with other 3rd party modules as everything now logs to
# stdout...
_old = logging.basicConfig
try:
    logging.basicConfig = lambda **k: None
    from pyroma import projectdata, ratings
except ImportError:
    # raise the Exception
    raise
finally:
    # always restore logging.basicConfig
    logging.basicConfig = _old


PYROMA_CODES = {
    ratings.Name: 'PYR01',
    ratings.Version: 'PYR02',
    ratings.VersionIsString: 'PYR03',
    ratings.PEPVersion: 'PYR04',
    ratings.Description: 'PYR05',
    ratings.LongDescription: 'PYR06',
    ratings.Classifiers: 'PYR07',
    ratings.PythonVersion: 'PYR08',
    ratings.Keywords: 'PYR09',
    ratings.Author: 'PYR10',
    ratings.AuthorEmail: 'PYR11',
    ratings.Url: 'PYR12',
    ratings.License: 'PYR13',
    ratings.LicenceClassifier: 'PYR14',
    ratings.ZipSafe: 'PYR15',
    ratings.SDist: 'PYR16',
    ratings.ValidREST: 'PYR18',