Skip to content

post_processor

get_post_processor(name, celt_config)

Find an available post processor based on the key provided.

Parameters:

Name Type Description Default
name str

name of the post processor

required
celt_config Configuration

The configuration to use

required

Returns:

Type Description
Res[PostProcessor]

A OneOf containing an Issue or a post processor function.

Source code in m/ci/celt/post_processor.py
def get_post_processor(
    name: str,
    celt_config: Configuration,
) -> Res[PostProcessor]:
    """Find an available post processor based on the key provided.

    Args:
        name: name of the post processor
        celt_config: The configuration to use

    Returns:
        A `OneOf` containing an `Issue` or a post processor function.
    """
    mapping: Dict[str, Transform] = {
        'eslint': eslint.read_payload,
        'pycodestyle': pycodestyle.read_payload,
        'flake8': pycodestyle.read_payload,
        'pylint': pylint.read_payload,
        'typescript': typescript.read_payload,
        'ruff': ruff.read_payload,
    }
    if name not in mapping:
        return issue(f'{name} is not a supported post processor')

    return Good(PostProcessor(name, celt_config, mapping[name]))