-
Notifications
You must be signed in to change notification settings - Fork 13
Small changes for alpha4 #35
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
Open
MaximilianToe
wants to merge
2
commits into
eclipse-uprotocol:main
Choose a base branch
from
MaximilianToe:small_changes_for_alpha4
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| #!/bin/bash | ||
|
|
||
| PROJECT_ROOT="$(realpath "$(dirname "$0")/../")" | ||
|
|
||
| if [ -n "$(which clang-tidy-13)" ]; then | ||
| # NOTE: Using clang-tidy-13 in CI system, too | ||
| LINTER=clang-tidy-13 | ||
| elif [ -n "$(which clang-tidy)" ]; then | ||
| echo "Did not find clang-tidy-13. Trying clang-tidy. Results may not" | ||
| echo "match formatting in GitHub CI process." | ||
| LINTER=clang-tidy | ||
| else | ||
| echo "Could not find clang-tidy. Please make sure it is installed" 1>&2 | ||
| exit 2 | ||
| fi | ||
|
|
||
| usage() { | ||
| echo "$(basename "$0") path/to/compile_commands.json [source_to_lint]" 1>&2 | ||
| echo 1>&2 | ||
| echo " compile_commands.json" 1>&2 | ||
| echo " Produced during a cmake build when configured with the" 1>&2 | ||
| echo " -DCMAKE_EXPORT_COMPILE_COMMANDS=yes flag" 1>&2 | ||
| echo 1>&2 | ||
| echo " source_to_lint (optional)" 1>&2 | ||
| echo " Source file to run clang-tidy against. If not specified," 1>&2 | ||
| echo " all source files in the repo will be scanned." 1>&2 | ||
| } | ||
|
|
||
| if [ "$1" == "-h" ] || [ "$1" == "--help" ] || [ "$1" == "/h" ] || [ "$1" == "/?" ]; then | ||
| usage | ||
| exit | ||
| fi | ||
|
|
||
| compile_database="$1" | ||
|
|
||
| if [ -z "$compile_database" ]; then | ||
| echo "No compile database specified. Make sure cmake was configured" 1>&2 | ||
| echo "with '-DCMAKE_EXPORT_COMPILE_COMMANDS=yes' and re-run the build" 1>&2 | ||
| echo 1>&2 | ||
| echo "Usage:" 1>&2 | ||
| usage | ||
| exit 1 | ||
| elif [ ! -f "$compile_database" ]; then | ||
| echo "Compile database file not found. Make sure cmake was configured" 1>&2 | ||
| echo "with '-DCMAKE_EXPORT_COMPILE_COMMANDS=yes' and re-run the build" 1>&2 | ||
| echo 1>&2 | ||
| echo "Usage:" 1>&2 | ||
| usage | ||
| exit 1 | ||
| fi | ||
|
|
||
| compile_database="$(realpath "$compile_database")" | ||
|
|
||
| target_source="$2" | ||
|
|
||
| if [ -z "$target_source" ]; then | ||
| echo "Running $LINTER on all files in '$PROJECT_ROOT'" | ||
| shopt -s globstar | ||
|
|
||
| pushd "$PROJECT_ROOT" > /dev/null | ||
| for f in pubsub/include/**/*.h pubsub/src/**/*.cpp rpc/include/**/*.h rpc/src/**/*.cpp; do | ||
| if [[ ! ("$f" =~ "build/") ]]; then | ||
| echo | ||
| echo "Checking file '$f'" | ||
| $LINTER -p "$(dirname "$compile_database")" "$f" | ||
| fi | ||
| done | ||
| popd > /dev/null | ||
| exit | ||
| fi | ||
|
|
||
| if [ ! -f "$target_source" ]; then | ||
| echo "Target source file '$target_source' not found." 1>&2 | ||
| echo 1>&2 | ||
| echo "Usage:" 1>&2 | ||
| usage | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Running $LINTER on '$target_source'" | ||
| $LINTER -p "$(dirname "$compile_database")" "$target_source" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,33 +9,38 @@ | |
| // | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // | ||
| #ifndef PUBSUB_COMMON_H | ||
| #define PUBSUB_COMMON_H | ||
| #ifndef COMMON_H | ||
| #define COMMON_H | ||
|
|
||
| #include <uprotocol/v1/uri.pb.h> | ||
|
|
||
| uprotocol::v1::UUri getUUri(int const resource_id) { | ||
| constexpr int DUMMY_UE_ID = 0x18002; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice 👌 |
||
| constexpr int TIMER_RESOURCE_ID = 0x8001; | ||
| constexpr int RANDOM_RESOURCE_ID = 0x8002; | ||
| constexpr int COUNTER_RESOURCE_ID = 0x8003; | ||
|
|
||
| inline uprotocol::v1::UUri getUUri(int const resource_id) { | ||
| uprotocol::v1::UUri uuri; | ||
| uuri.set_authority_name("test.app"); | ||
| uuri.set_ue_id(0x18002); | ||
| uuri.set_ue_id(DUMMY_UE_ID); | ||
| uuri.set_ue_version_major(1); | ||
| uuri.set_resource_id(resource_id); | ||
| return uuri; | ||
| } | ||
|
|
||
| uprotocol::v1::UUri const& getTimeUUri() { | ||
| static auto uuri = getUUri(0x8001); | ||
| inline uprotocol::v1::UUri const& getTimeUUri() { | ||
| static auto uuri = getUUri(TIMER_RESOURCE_ID); | ||
| return uuri; | ||
| } | ||
|
|
||
| uprotocol::v1::UUri const& getRandomUUri() { | ||
| static auto uuri = getUUri(0x8002); | ||
| inline uprotocol::v1::UUri const& getRandomUUri() { | ||
| static auto uuri = getUUri(RANDOM_RESOURCE_ID); | ||
| return uuri; | ||
| } | ||
|
|
||
| uprotocol::v1::UUri const& getCounterUUri() { | ||
| static auto uuri = getUUri(0x8003); | ||
| inline uprotocol::v1::UUri const& getCounterUUri() { | ||
| static auto uuri = getUUri(COUNTER_RESOURCE_ID); | ||
| return uuri; | ||
| } | ||
|
|
||
| #endif // PUBSUB_COMMON_H | ||
| #endif // COMMON_H | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I checked the lint step, here, I saw that it looks like this fails, but the status returned is still okay.
Am I reading the CI correctly here? Or missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me have a look. To be honest, I only looked at the status at the end of the CI and trusted that...