How to use the pyroma.ratings.ALL_TESTS 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 jayclassless / tidypy / src / tidypy / tools / pyroma.py View on Github external
err = capture.get_stderr()
                        if err:
                            issues.append(PyromaIssue(
                                TIDYPY_ISSUES['SCRIPT_FAIL'][0],
                                TIDYPY_ISSUES['SCRIPT_FAIL'][1] % (err,),
                                filepath,
                            ))
                        else:
                            issues.append(PyromaIssue(
                                TIDYPY_ISSUES['NOT_CALLED'][0],
                                TIDYPY_ISSUES['NOT_CALLED'][1],
                                filepath,
                            ))
                        continue

                    for test in ratings.ALL_TESTS:
                        name = test.__class__.__name__
                        if name in self.disabled:
                            continue

                        if test.test(data) is False:
                            issues.append(PyromaIssue(
                                name,
                                test.message(),
                                filepath,
                            ))

                    err = capture.get_stderr()
                    if err:
                        if err.startswith(':'):
                            issues.append(PyromaIssue(
                                TIDYPY_ISSUES['RST_ERROR'][0],
github PyCQA / prospector / prospector / tools / pyroma / __init__.py View on Github external
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',
}


PYROMA_TEST_CLASSES = [t.__class__ for t in ratings.ALL_TESTS]


class PyromaTool(ToolBase):

    def __init__(self, *args, **kwargs):
        super(PyromaTool, self).__init__(*args, **kwargs)
        self.ignore_codes = ()

    def configure(self, prospector_config, found_files):
        self.ignore_codes = prospector_config.get_disabled_messages('pyroma')

    def run(self, found_files):
        messages = []
        for module in found_files.iter_module_paths(include_ignored=True):
            dirname, filename = os.path.split(module)
            if filename != 'setup.py':