Skip to content

luminartech/dev-tools

Repository files navigation

Dev Tools

Check pre-commit.ci status

This is a collection of Luminar's development tools. These tools are used to help developers in their day-to-day tasks.

Tools

Configure VS Code for Bazel

If you want to debug C++ Bazel targets in VS Code, you can use configure-vscode-for-bazel to generate a .vscode/launch.json file. This file then contains all targets for debugging in VS Code. To generate a defined set of targets, run

configure-vscode-for-bazel //path/to/your/target/...

This will be forwarded to a bazel query listing all cc_binary and cc_test targets. Make sure you compile with debug symbols (--compilation_mode=dbg) enabled.

Whoowns

whoowns is a tool to print the GitHub codeowner of a folder or file by parsing the .github/CODEOWNERS file. With this tool, you can easily find out who is responsible for a specific part of the codebase from the terminal. To find the owners of a file or folder, run

whoowns path/to/your/file/or/folder

# example output
# path/to/your/file/or/folder -> @owner1

Specify the --level N to see the owners of child items in the N-th directory level below your provided folder.

Hooks

check-build-file-without-extensions

Check that BUILD files have a .bazel ending. BUILD.bazel file is the recommended way to name these files.

check-snake-case

Check that all source code files are snake_case. We don't want to use camelCase or kebab-case file names.

check-cpp-and-cu-unit-test-naming-pattern

Check that all C++ and Cuda unit test files end with _test.cpp or _test.cu.

check-no-dashes

Check that markdown filenames do not use dashes

check-sys-path-append

Check that no sys.path.append is used in Python code

go-fmt

Format go files

go-imports

Order go imports

go-revive

Run Go Revive linter

check-number-of-lines-count

Check that number of lines in scripts do not exceed max-lines. Use --max-lines=<number> to set the maximum number of lines. Default is 30 for shell scripts.

check-shellscript-set-options

Check if options are set with set -euxo pipefail. Use # nolint(set_options) to ignore this check.

check-jira-reference-in-todo

Check that all TODO comments follow the same pattern and link a Jira ticket: TODO(ABC-1234):.

check-non-existing-and-duplicate-excludes

Check for non existing and duplicate paths in .pre-commit-config.yaml. Background: In a big codebase, the exclude lists can be quite long and it's easy to make a typo or forget to remove an entry when it's no longer needed.

check-ownership

Check if all folders in the CODEOWNERS file exist, there are no duplicates, and it has acceptable codeowners.

What is an acceptable codeowner? We want to make sure that every folder has a codeowner other than the team that should exclusively own the CODEOWNERS file. For this, we define a CODEOWNERS_OWNER using the --codeowners-owner argument. Your CODEOWNERS file should look as follows:

* CODEOWNERS_OWNER

# Here goes all your CODEOWNERS file content overriding the wildcard owner

# leave this at the bottom to have highest ownership priority
/.github/CODEOWNERS CODEOWNERS_OWNER

If the hook detects CODEOWNERS_OWNER owns anything else than .github/CODEOWNERS it will fail to make sure every file added has an acceptable codeowner.

Contributing

Please refer to the CONTRIBUTING.md file for information on how to contribute to this project.