:py:mod:`buildtest.tools.stylecheck` ==================================== .. py:module:: buildtest.tools.stylecheck Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: buildtest.tools.stylecheck.run_command buildtest.tools.stylecheck.run_black buildtest.tools.stylecheck.run_isort buildtest.tools.stylecheck.run_pyflakes buildtest.tools.stylecheck.run_style_checks .. py:function:: run_command(cmd, msg) This method is a wrapper to BuildTestCommand used with running black, isort, and pyflakes during style check :param cmd: Name of command to run :type cmd: str :param msg: Message printed during style check :type msg: str .. py:function:: run_black(source_files, black_opts) This method will run `black `_ check given a set of source files and black options. If black is not available we will return immediately otherwise we run black checks and print output and error message reported by black. :param source_files: List of source files to run black check :type source_files: list :param black_opts: Specify options to black :type black_opts: str .. py:function:: run_isort(source_files, isort_opts) This method will run `isort `_ checks which performs import sorting for buildtest codebase. If `isort` is not available we return immediately. :param source_files: A list of source files to run isort :type source_files: list :param isort_opts: Specify options to isort command :type isort_opts: str .. py:function:: run_pyflakes(source_files) This method will run `pyflakes `_ checks which checks for unused imports and errors in source files. :param source_files: List of source files to apply pyflakes check :type source_files: list .. py:function:: run_style_checks(no_black, no_isort, no_pyflakes, apply_stylechecks) This method runs buildtest style checks which is invoked via ``buildtest stylecheck`` command. :param no_black: Disable black check if `no_black=True`. :type no_black: bool :param no_isort: Disable isort check if `no_isort=True`. :type no_isort: bool :param no_pyflakes: Disable pyflakes check if `no_pyflakes=True`. :type no_pyflakes: bool :param apply_stylechecks: If `apply_stylechecks=True` then black and isort stylecheck will be applied to codebase, by default these checks will report changes to codebase without applying changes. :type apply_stylechecks: bool