Skip to content

Draft: WOM-248 New dev targets to improve devcontainer usability

Jarrett Engelbrecht requested to merge wom-248-devcontainer-scripts into master

New dev targets:

  • dev-git-config is meant for devcontainers, although it can be used on the host system as well. It helps with using git inside a devcontainer without having to remember the commands everytime a devcontainer is rebuilt.

    • Sets up default editor for git in project with hard-wrap width of 72 characters.
    • Checks for git auto completion script in .bashrc in adds it if missing.
  • dev-git-hooks is renamed to dev-git-hooks-local and dev-git-hooks-make is added which enables two hooks in the .make submodule itself:

    • pre-commit hook for python projects that runs make python-lint. (can help new and forgetful developers)

    • prepare-commit-msg hook that pre-populates the subject line with the Jira number matched from the branch name and reminds users to add a blank line before the body of a commit message. For example:

      #WOM-248: 
      
      # Body (optional):
      
      # How to Write a Git Commit Message: https://cbea.ms/git-commit/#seven-rules

      Combined with a hard-wrap limit of 72 characters in the chosen git editor, it helps with writing good commit messages.

  • dev-make-completion adds custom makefile auto completion script that parses the main targets and VARS from make help output. Makefile completion does not work by default in a devcontainer, and it’s better than the default makefile completion in Ubuntu that lists all possible targets. Tabbing make python- it will only list:

    python-build python-format python-lint python-publish python-scan python-set-release python-test
  • dev-vscode is renamed to dev-vscode-local and dev-vscode-python is added. It uses jq to only rewrite the VS code settings and extensions keys in the local project’s devcontainer.json from a generic configurationg for python projects in the .make module itself. The idea is to help with correct linting, formatting and extensions for VS code and keeping said settings consistent and up to date between python projects. It will not change any other custom settings or the Dockerfile. This could use some finer refinement and will require keeping the python-project.json file up to date in the module.

Edited by Diogo Vala

Merge request reports