Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce pre-commit in ArduPilot #24683

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/test_scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,18 @@ jobs:
python-cleanliness,
astyle-cleanliness,
validate_board_list,
pre-commit-cleanliness,
Ryanf55 marked this conversation as resolved.
Show resolved Hide resolved
]
steps:
# git checkout the PR
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: install pre-commit
shell: bash
run: |
pre-commit install
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why need this ? we don't run git command on CI, so the install isn't need normally, or I miss something ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure that shouldn't be pip install pre-commit instead ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK i have checked and we got pre-commit into the docker image already so we are fine. the pre-commit install is just to install the git hook so that isn't need on CI

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are conflating installation of the pre-commit tool in the environment and installation of the git hooks into the repo.
https://pre-commit.com/#3-install-the-git-hook-scripts

We need both at some point before calling pre-commit run in ArduPilot.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope you don't need to install the git hook to use precommit.

if: ${{ matrix.config == 'pre-commit-cleanliness' }}
- name: test ${{matrix.config}}
env:
CI_BUILD_TARGET: ${{matrix.config}}
Expand Down
2 changes: 1 addition & 1 deletion Tools/environment_install/install-prereqs-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ else
fi

# Lists of packages to install
BASE_PKGS="build-essential ccache g++ gawk git make wget valgrind screen"
BASE_PKGS="build-essential ccache g++ gawk git make wget valgrind screen libxml2-utils"
PYTHON_PKGS="future lxml pymavlink pyserial MAVProxy pexpect geocoder empy==3.3.4 ptyprocess dronecan"
PYTHON_PKGS="$PYTHON_PKGS flake8 junitparser"

Expand Down
6 changes: 6 additions & 0 deletions Tools/scripts/build_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,12 @@ for t in $CI_BUILD_TARGET; do
continue
fi

if [ "$t" == "pre-commit-cleanliness" ]; then
echo "Checking pre-commit code cleanliness"
pre-commit run --all-files --verbose --show-diff-on-failure
continue
fi

if [ "$t" == "configure-all" ]; then
echo "Checking configure of all boards"
./Tools/scripts/configure_all.py
Expand Down
Empty file modified libraries/AP_HAL_ChibiOS/hwdef/Aocoda-RC-H743Dual/defaults.parm
100755 → 100644
Empty file.
Empty file modified libraries/AP_HAL_ChibiOS/hwdef/Aocoda-RC-H743Dual/hwdef-bl.dat
100755 → 100644
Empty file.
Empty file modified libraries/AP_HAL_ChibiOS/hwdef/Aocoda-RC-H743Dual/hwdef.dat
100755 → 100644
Empty file.
88 changes: 44 additions & 44 deletions libraries/SITL/SITL_Airspeed.cpp
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
#include "SITL.h"
#if AP_SIM_ENABLED
namespace SITL {
// user settable parameters for airspeed sensors
const AP_Param::GroupInfo SIM::AirspeedParm::var_info[] = {
// user settable parameters for the 1st airspeed sensor
AP_GROUPINFO("RND", 1, AirspeedParm, noise, 2.0),
AP_GROUPINFO("OFS", 2, AirspeedParm, offset, 2013),
// @Param: FAIL
// @DisplayName: Airspeed sensor failure
// @Description: Simulates Airspeed sensor 1 failure
// @Values: 0:Disabled, 1:Enabled
// @User: Advanced
AP_GROUPINFO("FAIL", 3, AirspeedParm, fail, 0),
// @Param: FAILP
// @DisplayName: Airspeed sensor failure pressure
// @Description: Simulated airspeed sensor failure pressure
// @Units: Pa
// @User: Advanced
AP_GROUPINFO("FAILP", 4, AirspeedParm, fail_pressure, 0),
// @Param: PITOT
// @DisplayName: Airspeed pitot tube failure pressure
// @Description: Simulated airspeed sensor pitot tube failure pressure
// @Units: Pa
// @User: Advanced
AP_GROUPINFO("PITOT", 5, AirspeedParm, fail_pitot_pressure, 0),
// @Param: SIGN
// @DisplayName: Airspeed signflip
// @Description: Simulated airspeed sensor with reversed pitot/static connections
// @Values: 0:Disabled, 1:Enabled
// @User: Advanced
AP_GROUPINFO("SIGN", 6, AirspeedParm, signflip, 0),
// @Param: RATIO
// @DisplayName: Airspeed ratios
// @Description: Simulated airspeed sensor ratio
// @User: Advanced
AP_GROUPINFO("RATIO", 7, AirspeedParm, ratio, 1.99),
AP_GROUPEND
};
}
#endif // AP_SIM_ENABLED
#include "SITL.h"

#if AP_SIM_ENABLED

namespace SITL {
// user settable parameters for airspeed sensors
const AP_Param::GroupInfo SIM::AirspeedParm::var_info[] = {
// user settable parameters for the 1st airspeed sensor
AP_GROUPINFO("RND", 1, AirspeedParm, noise, 2.0),
AP_GROUPINFO("OFS", 2, AirspeedParm, offset, 2013),
// @Param: FAIL
// @DisplayName: Airspeed sensor failure
// @Description: Simulates Airspeed sensor 1 failure
// @Values: 0:Disabled, 1:Enabled
// @User: Advanced
AP_GROUPINFO("FAIL", 3, AirspeedParm, fail, 0),
// @Param: FAILP
// @DisplayName: Airspeed sensor failure pressure
// @Description: Simulated airspeed sensor failure pressure
// @Units: Pa
// @User: Advanced
AP_GROUPINFO("FAILP", 4, AirspeedParm, fail_pressure, 0),
// @Param: PITOT
// @DisplayName: Airspeed pitot tube failure pressure
// @Description: Simulated airspeed sensor pitot tube failure pressure
// @Units: Pa
// @User: Advanced
AP_GROUPINFO("PITOT", 5, AirspeedParm, fail_pitot_pressure, 0),
// @Param: SIGN
// @DisplayName: Airspeed signflip
// @Description: Simulated airspeed sensor with reversed pitot/static connections
// @Values: 0:Disabled, 1:Enabled
// @User: Advanced
AP_GROUPINFO("SIGN", 6, AirspeedParm, signflip, 0),
// @Param: RATIO
// @DisplayName: Airspeed ratios
// @Description: Simulated airspeed sensor ratio
// @User: Advanced
AP_GROUPINFO("RATIO", 7, AirspeedParm, ratio, 1.99),
AP_GROUPEND
};
}

#endif // AP_SIM_ENABLED
2 changes: 1 addition & 1 deletion modules/waf
Submodule waf updated 234 files
Loading