openMSL / sl-1-0-sensor-model-repository-template

Template repository: Clone and build your ASAM OSI sensor model.
Mozilla Public License 2.0
8 stars 2 forks source link

Add simple OSMP model example with testing pipeline #20

Closed ClemensLinnhoff closed 1 year ago

ClemensLinnhoff commented 1 year ago

Reference to a related issue in the repository

16, #19

Add a description

Take this checklist as orientation for yourself, if this PR is ready for Maintainer Review

github-actions[bot] commented 1 year ago

:speech_balloon: Output from clang-tidy

src/HelloWorldSensor.cpp
/src/HelloWorldSensor.cpp:60:5: warning: [cppcoreguidelines-pro-type-member-init] > uninitialized record type: 'myaddr'

```cpp union Addrconv ^ ```

/src/HelloWorldSensor.cpp:69:12: warning: [cppcoreguidelines-pro-type-union-access] > do not access members of unions; use (boost::)variant instead

```cpp myaddr.base.lo = lo; ^ ```

/src/HelloWorldSensor.cpp:70:12: warning: [cppcoreguidelines-pro-type-union-access] > do not access members of unions; use (boost::)variant instead

```cpp myaddr.base.hi = hi; ^ ```

/src/HelloWorldSensor.cpp:71:12: warning: [cppcoreguidelines-pro-type-reinterpret-cast] > do not use reinterpret_cast

```cpp return reinterpret_cast(myaddr.address); ^ ```

/src/HelloWorldSensor.cpp:71:43: warning: [cppcoreguidelines-pro-type-union-access] > do not access members of unions; use (boost::)variant instead

```cpp return reinterpret_cast(myaddr.address); ^ ```

/src/HelloWorldSensor.cpp:82:5: warning: [cppcoreguidelines-pro-type-member-init] > uninitialized record type: 'myaddr'

```cpp union Addrconv ^ ```

/src/HelloWorldSensor.cpp:91:12: warning: [cppcoreguidelines-pro-type-union-access] > do not access members of unions; use (boost::)variant instead

```cpp myaddr.address = reinterpret_cast(ptr); ^ ```

/src/HelloWorldSensor.cpp:91:22: warning: [cppcoreguidelines-pro-type-reinterpret-cast] > do not use reinterpret_cast

```cpp myaddr.address = reinterpret_cast(ptr); ^ ```

/src/HelloWorldSensor.cpp:92:17: warning: [cppcoreguidelines-pro-type-union-access] > do not access members of unions; use (boost::)variant instead

```cpp hi = myaddr.base.hi; ^ ```

/src/HelloWorldSensor.cpp:93:17: warning: [cppcoreguidelines-pro-type-union-access] > do not access members of unions; use (boost::)variant instead

```cpp lo = myaddr.base.lo; ^ ```

/src/HelloWorldSensor.cpp:231:30: warning: [readability-convert-member-functions-to-static] > method 'DoStart' can be made static

```cpp fmi2Status HelloWorldSensor::DoStart(fmi2Boolean tolerance_defined, fmi2Real tolerance, fmi2Real start_time, fmi2Boolean stop_time_defined, fmi2Real stop_time) ^ ```

/src/HelloWorldSensor.cpp:236:30: warning: [readability-convert-member-functions-to-static] > method 'DoEnterInitializationMode' can be made static

```cpp fmi2Status HelloWorldSensor::DoEnterInitializationMode() ^ ```

/src/HelloWorldSensor.cpp:350:80: warning: [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers] > 0.866025 is a magic number; consider replacing it with a named constant

```cpp if ((distance <= actual_range) && (rel_x / distance > 0.866025)) ^ ```

/src/HelloWorldSensor.cpp:355:84: warning: [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers] > 2.0 is a magic number; consider replacing it with a named constant

```cpp obj->mutable_header()->set_existence_probability(cos((2.0 * distance - actual_range) / actual_range)); ^ ```

/src/HelloWorldSensor.cpp:428:30: warning: [readability-convert-member-functions-to-static] > method 'DoTerm' can be made static

```cpp fmi2Status HelloWorldSensor::DoTerm() ^ ```

/src/HelloWorldSensor.cpp:439:1: warning: [cppcoreguidelines-pro-type-member-init] > constructor does not initialize these fields: boolean_vars_, integer_vars_, real_vars_

```cpp HelloWorldSensor::HelloWorldSensor(fmi2String theinstance_name, ^ ```

/src/HelloWorldSensor.cpp:506:5: warning: [cppcoreguidelines-owning-memory] > initializing non-owner 'HelloWorldSensor *' with a newly created 'gsl::owner<>'

```cpp auto* myc = new HelloWorldSensor(instance_name, fmu_type, fmu_guid, fmu_resource_location, functions, visible, logging_on); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ```

/src/HelloWorldSensor.cpp:531:9: warning: [cppcoreguidelines-owning-memory] > deleting a pointer through a type that is not marked 'gsl::owner<>'; consider using a smart pointer instead

```cpp delete myc; ^ ~~~ /home/runner/work/sl-1-0-sensor-model-repository-template/sl-1-0-sensor-model-repository-template/src/HelloWorldSensor.cpp:506:5: note: variable declared here auto* myc = new HelloWorldSensor(instance_name, fmu_type, fmu_guid, fmu_resource_location, functions, visible, logging_on); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ```

/src/HelloWorldSensor.cpp:599:24: warning: [cppcoreguidelines-pro-bounds-constant-array-index] > do not use array subscript when the index is not an integer constant expression

```cpp value[i] = real_vars_[vr[i]]; ^ ```

/src/HelloWorldSensor.cpp:623:24: warning: [cppcoreguidelines-pro-bounds-constant-array-index] > do not use array subscript when the index is not an integer constant expression

```cpp value[i] = integer_vars_[vr[i]]; ^ ```

/src/HelloWorldSensor.cpp:640:24: warning: [cppcoreguidelines-pro-bounds-constant-array-index] > do not use array subscript when the index is not an integer constant expression

```cpp value[i] = boolean_vars_[vr[i]]; ^ ```

/src/HelloWorldSensor.cpp:657:24: warning: [cppcoreguidelines-pro-bounds-constant-array-index] > do not use array subscript when the index is not an integer constant expression

```cpp value[i] = string_vars_[vr[i]].c_str(); ^ ```

/src/HelloWorldSensor.cpp:674:13: warning: [cppcoreguidelines-pro-bounds-constant-array-index] > do not use array subscript when the index is not an integer constant expression

```cpp real_vars_[vr[i]] = value[i]; ^ ```

/src/HelloWorldSensor.cpp:691:13: warning: [cppcoreguidelines-pro-bounds-constant-array-index] > do not use array subscript when the index is not an integer constant expression

```cpp integer_vars_[vr[i]] = value[i]; ^ ```

/src/HelloWorldSensor.cpp:708:13: warning: [cppcoreguidelines-pro-bounds-constant-array-index] > do not use array subscript when the index is not an integer constant expression

```cpp boolean_vars_[vr[i]] = value[i]; ^ ```

/src/HelloWorldSensor.cpp:725:13: warning: [cppcoreguidelines-pro-bounds-constant-array-index] > do not use array subscript when the index is not an integer constant expression

```cpp string_vars_[vr[i]] = value[i]; ^ ```

/src/HelloWorldSensor.cpp:815:5: warning: [cppcoreguidelines-owning-memory] > deleting a pointer through a type that is not marked 'gsl::owner<>'; consider using a smart pointer instead

```cpp delete myc; ^ ~~~ /home/runner/work/sl-1-0-sensor-model-repository-template/sl-1-0-sensor-model-repository-template/src/HelloWorldSensor.cpp:813:5: note: variable declared here auto* myc = (HelloWorldSensor*)c; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ```