buildtest.tools.stylecheck

Module Contents

Functions

run_command(cmd, msg)

This method is a wrapper to BuildTestCommand used with running black, isort, and pyflakes during style check

run_black(source_files, black_opts)

This method will run black check given a set of source files and black options.

run_isort(source_files, isort_opts)

This method will run isort checks which performs import sorting for buildtest

run_pyflakes(source_files)

This method will run pyflakes checks which checks for unused imports and errors

run_style_checks(no_black, no_isort, no_pyflakes, ...)

This method runs buildtest style checks which is invoked via buildtest stylecheck command.

buildtest.tools.stylecheck.run_command(cmd, msg)[source]

This method is a wrapper to BuildTestCommand used with running black, isort, and pyflakes during style check

Parameters:
  • cmd (str) – Name of command to run

  • msg (str) – Message printed during style check

buildtest.tools.stylecheck.run_black(source_files, black_opts)[source]

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.

Parameters:
  • source_files (list) – List of source files to run black check

  • black_opts (str) – Specify options to black

buildtest.tools.stylecheck.run_isort(source_files, isort_opts)[source]

This method will run isort checks which performs import sorting for buildtest codebase. If isort is not available we return immediately.

Parameters:
  • source_files (list) – A list of source files to run isort

  • isort_opts (str) – Specify options to isort command

buildtest.tools.stylecheck.run_pyflakes(source_files)[source]

This method will run pyflakes checks which checks for unused imports and errors in source files.

Parameters:

source_files (list) – List of source files to apply pyflakes check

buildtest.tools.stylecheck.run_style_checks(no_black, no_isort, no_pyflakes, apply_stylechecks)[source]

This method runs buildtest style checks which is invoked via buildtest stylecheck command.

Parameters:
  • no_black (bool) – Disable black check if no_black=True.

  • no_isort (bool) – Disable isort check if no_isort=True.

  • no_pyflakes (bool) – Disable pyflakes check if no_pyflakes=True.

  • apply_stylechecks (bool) – 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.