Skip to content

Commit

Permalink
check all files in current and build directories recursively, log to …
Browse files Browse the repository at this point in the history
…style.log
  • Loading branch information
Jbsco committed Dec 18, 2023
1 parent d1d982e commit f3521cd
Showing 1 changed file with 9 additions and 40 deletions.
49 changes: 9 additions & 40 deletions redo/rules/build_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ def _build(self, redo_1, redo_2, redo_3):
filesystem.safe_makedir(style_directory)
style_log_file = style_directory + os.sep + "style.log"
style_log_file_temp = style_directory + os.sep + "style.log.temp"
codespell_py_file = style_directory + os.sep + "codespell_py.log"
codespell_yaml_file = style_directory + os.sep + "codespell_YAML.log"
redo.redo(
objects
+ ["2>&1", "|", "tee", style_log_file_temp, ">&2"]
Expand Down Expand Up @@ -87,26 +85,15 @@ def _build(self, redo_1, redo_2, redo_3):
shell.run_command(flake_cmd)
os.chdir(cwd)

# Check any python with codespell:
codespell_cmd_prefix = "codespell " + py_directory + os.sep
codespell_cmd_suffix = "*.py 1>&1 | tee "
shell.run_command(codespell_cmd_prefix
+ codespell_cmd_suffix
+ codespell_py_file)
# Note that Codespell cannot check specific filetypes
# with recursive directory checking, so check wildcard
# directories and append the log:
shell.run_command(codespell_cmd_prefix
+ "*" + os.sep
+ codespell_cmd_suffix
+ "-a "
+ codespell_py_file)
shell.run_command("codespell " + py_directory + os.sep
+ "*" + os.sep
+ "*" + os.sep
+ codespell_cmd_suffix
+ "-a "
+ codespell_py_file)
# Run codespell check:
shell.run_command("codespell --skip \"style.log\""
+ " 2>&1 | tee -a "
+ style_log_file)
shell.run_command("codespell "
+ build_directory
+ " --skip \"style.log\""
+ " 2>&1 | tee -a "
+ style_log_file)

# Finally lint any YAML files:
def _yaml_lint(filenames=[]):
Expand All @@ -119,24 +106,6 @@ def _yaml_lint(filenames=[]):
)
shell.run_command(cmd)

# Check any YAML with codespell:
codespell_cmd_prefix = "codespell " + directory + os.sep + "build" + os.sep + "yaml" + os.sep
codespell_cmd_suffix = "*.yaml 1>&1 | tee "
shell.run_command(codespell_cmd_prefix
+ codespell_cmd_suffix
+ codespell_yaml_file)
shell.run_command(codespell_cmd_prefix
+ "*" + os.sep
+ codespell_cmd_suffix
+ "-a "
+ codespell_yaml_file)
shell.run_command(codespell_cmd_prefix
+ "*" + os.sep
+ "*" + os.sep
+ codespell_cmd_suffix
+ "-a "
+ codespell_yaml_file)

yaml_files = glob.glob(directory + os.sep + "*.yaml")
yaml_files.extend(glob.glob(directory + os.sep + "build" + os.sep + "yaml" + os.sep + "*.yaml"))
if yaml_files:
Expand Down

0 comments on commit f3521cd

Please sign in to comment.