Skip to content

Commit

Permalink
Update bash scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
qhdwight committed Sep 15, 2024
1 parent 7c6adc9 commit eaddd45
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 16 deletions.
10 changes: 5 additions & 5 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ echo -e "${GREY_BOLD}Using ${CATKIN_PATH} as ROS workspace${NC}"
readonly MROVER_PATH=${CATKIN_PATH}/src/mrover
FIRST_TIME_SETUP=false

if [ ! -d ${MROVER_PATH} ]; then
if [ ! -d "${MROVER_PATH}" ]; then
echo -e "${GREY_BOLD}Creating ROS workspace ...${NC}"
mkdir -p ${CATKIN_PATH}/src
git clone [email protected]:umrover/mrover-ros2 ${CATKIN_PATH}/src/mrover
cd ${CATKIN_PATH}/src/mrover
mkdir -p "${CATKIN_PATH}"/src
git clone [email protected]:umrover/mrover-ros2 "${CATKIN_PATH}"/src/mrover
cd "${CATKIN_PATH}"/src/mrover
FIRST_TIME_SETUP=true
fi

echo -e "${GREY_BOLD}Using Ansible to finish up ...${NC}"
${MROVER_PATH}/ansible.sh dev.yml
"${MROVER_PATH}"/ansible.sh dev.yml

if [ "${FIRST_TIME_SETUP}" ]; then
echo -e "${GREY_BOLD}All done! Welcome to MRover!${NC}"
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ colcon build \
--cmake-args -G Ninja -W no-dev -DCMAKE_BUILD_TYPE=RelWithDebInfo \
--symlink-install \
--event-handlers console_direct+ \
$@
"$@"
2 changes: 1 addition & 1 deletion build_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ colcon build \
--cmake-args -G Ninja -W no-dev -D CMAKE_BUILD_TYPE=Release -D MROVER_CI=ON \
--symlink-install \
--event-handlers console_direct+ \
$@
"$@"
52 changes: 43 additions & 9 deletions style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ function print_update_error() {
}

function find_executable() {
local readonly executable="$1"
local readonly version="$2"
local readonly path=$(which "${executable}")
local -r executable="$1"
local -r version="$2"
local -r path=$(which "${executable}")
if [ ! -x "${path}" ]; then
echo -e "${RED}[Error] Could not find ${executable}${NC}"
print_update_error
Expand All @@ -44,24 +44,58 @@ function find_executable() {

## Check that all tools are installed

readonly CLANG_FORMAT_PATH=$(find_executable clang-format-18 18.1.8)
readonly CLANG_FORMAT_PATH=$(find_executable clang-format-18 18.1)
readonly BLACK_PATH=$(find_executable black 24.8.0)
readonly MYPY_PATH=$(find_executable mypy 1.11.2)

## Run checks

# Add new directories with C++ code here:
readonly CPP_DIRS=(
./perception
./lie
./esw
./simulator
)

echo "Style checking C++ ..."
find ./perception ./lie ./esw ./simulator -regex '.*\.\(cpp\|hpp\|h\)' -exec "${CLANG_FORMAT_PATH}" "${CLANG_FORMAT_ARGS[@]}" -i {} \;
readonly CPP_FILES=$(find "${CPP_DIRS[@]}" -name "*.cpp" -o -name "*.hpp" -o -name "*.h" -o -name "*.cu")
for file in $CPP_FILES; do
"${CLANG_FORMAT_PATH}" "${CLANG_FORMAT_ARGS[@]}" -i "${file}"
done
echo "Done"

# Add new directories with Python code here:
readonly PYTHON_LINT_DIRS=(
./navigation
./localization
./scripts
./state_machine
./lie
./superstructure
)
readonly PYTHON_STYLE_DIRS=(
"${PYTHON_LINT_DIRS[@]}"
./launch
)

echo
echo "Style checking Python with black ..."
"$BLACK_PATH" "${BLACK_ARGS[@]}" . --exclude=venv
"${BLACK_PATH}" "${BLACK_ARGS[@]}" "${PYTHON_STYLE_DIRS[@]}"

echo
echo "Style checking Python with mypy ..."
# TODO(quintin): Add other subteam folders and scripts folder
"$MYPY_PATH" --config-file=mypy.ini --check ./navigation ./scripts
echo "Linting Python with mypy ..."
"${MYPY_PATH}" --config-file=mypy.ini --check "${PYTHON_LINT_DIRS[@]}"

if command -v shellcheck &> /dev/null; then
echo
echo "Linting bash scripts with shellcheck ..."
readonly SHELL_FILES=$(find . -depth 1 -name "*.sh")
for file in $SHELL_FILES; do
# SC2155 is separate declaration and command.
shellcheck "${file}" --exclude=SC2155
done
fi

if [ $# -eq 0 ] || [ "$1" != "--fix" ]; then
echo
Expand Down
3 changes: 3 additions & 0 deletions units/units_eigen.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#pragma once

// Including this file provides baseline compatibility with Eigen.
// Should be able to use unit types in Eigen matrices.

#include "units.hpp"

#include <Eigen/Core>
Expand Down

0 comments on commit eaddd45

Please sign in to comment.