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

Update flake8 and clang-tidy linters #179

Merged
merged 18 commits into from
Oct 18, 2023
Merged
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
7 changes: 2 additions & 5 deletions .devcontainer/config/sailbot_workspace.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,7 @@
// copy from https://github.com/ament/ament_lint/blob/humble/ament_flake8/ament_flake8/configuration/ament_flake8.ini
// except for import order style = google: use isort with black profile instead
"flake8.args": [
"--extend-ignore=B902,C816,D100,D101,D102,D103,D104,D105,D106,D107,D203,D212,D404,I202",
"--max-line-length=99",
"--show-source",
"--statistics",
"--config=${workspaceFolder:sailbot_workspace}/.flake8",
],
"flake8.interpreter": ["/usr/bin/python3"],
// formatter: black and isort extensions
Expand Down Expand Up @@ -372,7 +369,7 @@
"label": "clang-tidy",
"detail": "Run clang-tidy static analysis",
"type": "shell",
"command": "./run_clang-tidy.sh",
"command": "LOCAL_RUN=true .github/actions/clang-tidy/run.sh",
"problemMatcher": [],
"presentation": {
"panel": "dedicated",
Expand Down
6 changes: 6 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[flake8]
extend-ignore = B902,C816,D100,D101,D102,D103,D104,D105,D106,D107,D203,D212,D404,I202,E203
import-order-style = google
max-line-length = 99
show-source = true
statistics = true
7 changes: 6 additions & 1 deletion .github/actions/ament-lint/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ function lint {
LINTED_FILES=`eval ${FILE_SEARCH_CMD}`

if [[ ! -z ${LINTED_FILES} ]]; then
ament_${LINTER} ${LINTED_FILES}
if [[ ${LINTER} = "flake8" ]]; then
# use custom configuration file that is compatible with black formatter
ament_${LINTER} --config .flake8 ${LINTED_FILES}
else
ament_${LINTER} ${LINTED_FILES}
fi
else
warn "WARNING: No files found for ${LINTER}. Skipping ament_${LINTER}..."
fi
Expand Down
Loading