mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-26 21:44:53 +01:00
Add nosonar tags
This commit is contained in:
@@ -569,7 +569,7 @@ int eu07_application::run()
|
||||
if (m_network && m_network->client)
|
||||
{
|
||||
// verify sync
|
||||
if (sync != slave_sync)
|
||||
if (sync != slave_sync) // NOSONAR
|
||||
{
|
||||
WriteLog("net: desync! calculated: " + std::to_string(sync) + ", received: " + std::to_string(slave_sync), logtype::net);
|
||||
|
||||
|
||||
@@ -704,7 +704,7 @@ void driver_mode::update_camera(double const Deltatime)
|
||||
|
||||
auto const lr{m_input.keyboard.key(GLFW_KEY_LEFT) != GLFW_RELEASE};
|
||||
// Camera.Yaw powinno być wyzerowane, aby po powrocie patrzeć do przodu
|
||||
Camera.Pos = controlled->GetPosition() + simulation::Train->MirrorPosition(lr); // pozycja lusterka
|
||||
Camera.Pos = controlled->GetPosition() + simulation::Train->MirrorPosition(lr); // pozycja lusterka // NOSONAR
|
||||
Camera.Angle.y = 0; // odchylenie na bok od Camera.LookAt
|
||||
if (simulation::Train->Occupied()->CabOccupied == 0)
|
||||
{
|
||||
|
||||
@@ -344,7 +344,7 @@ void scan_triangle(corridor const &Space, glm::dvec3 const &A, glm::dvec3 const
|
||||
{
|
||||
Hit.depth = found.depth;
|
||||
Hit.point = point;
|
||||
Hit.track = found.span->track;
|
||||
Hit.track = found.span->track; // NOSONAR
|
||||
Hit.path = found.span->path;
|
||||
Hit.direction = found.direction;
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ class event_links
|
||||
for (auto *child : multi->children())
|
||||
{
|
||||
auto const setter{dynamic_cast<updatevalues_event const *>(child) != nullptr || dynamic_cast<copyvalues_event const *>(child) != nullptr};
|
||||
for (auto *target : child->target_nodes())
|
||||
for (auto *target : child->target_nodes()) // NOSONAR
|
||||
{
|
||||
if (models.count(target) > 0 && false == contains(shown, static_cast<scene::basic_node const *>(target)))
|
||||
shown.push_back(target);
|
||||
|
||||
@@ -723,7 +723,7 @@ std::string directive(std::string const &File, include_info const &Info, int con
|
||||
else if (role == "name")
|
||||
{
|
||||
// names have to be unique in the scenery. the default value, or the name of the template, makes them recognizable
|
||||
static std::mt19937 engine{std::random_device{}()};
|
||||
static std::mt19937 engine{std::random_device{}()}; // NOSONAR
|
||||
char suffix[16];
|
||||
std::snprintf(suffix, sizeof(suffix), "_%08x", static_cast<unsigned int>(engine()));
|
||||
value = (value.empty() ? std::filesystem::path(File).stem().string() : value) + suffix;
|
||||
|
||||
@@ -1176,7 +1176,7 @@ glm::dvec2 direction_at(TTrack const &Track, glm::dvec3 const &Joint, bool const
|
||||
TTrack *neighbour_at(TTrack const &Track, int const Path, bool const Atend)
|
||||
{
|
||||
if (has_switch_paths(Track))
|
||||
return Atend ? Track.SwitchExtension->pNexts[Path & 1] : Track.SwitchExtension->pPrevs[Path & 1];
|
||||
return Atend ? Track.SwitchExtension->pNexts[Path & 1] : Track.SwitchExtension->pPrevs[Path & 1]; // NOSONAR
|
||||
return Atend ? Track.trNext : Track.trPrev;
|
||||
}
|
||||
|
||||
|
||||
@@ -529,7 +529,7 @@ void opengl_texture::update_from_memory(size_t width, size_t height, const uint8
|
||||
glDeleteTextures(1, &id);
|
||||
id = invalid_id;
|
||||
}
|
||||
if (id == invalid_id)
|
||||
if (id == invalid_id) // NOSONAR
|
||||
{
|
||||
data_width = width;
|
||||
data_height = height;
|
||||
|
||||
@@ -1125,7 +1125,7 @@ std::string scene::node_layers::check_sources() const
|
||||
if (fine)
|
||||
++good;
|
||||
else if (++bad <= 5)
|
||||
report += " [" + node->name() + " " + std::to_string(source.span.begin) + "-" + std::to_string(source.span.end) + ": " + piece.substr(0, 60) + " ... " + (piece.size() > 30 ? piece.substr(piece.size() - 30) : std::string{}) + "]";
|
||||
report += " [" + node->name() + " " + std::to_string(source.span.begin) + "-" + std::to_string(source.span.end) + ": " + piece.substr(0, 60) + " ... " + (piece.size() > 30 ? piece.substr(piece.size() - 30) : std::string{}) + "]"; // NOSONAR
|
||||
}
|
||||
return std::to_string(good) + " good, " + std::to_string(bad) + " bad" + report;
|
||||
}
|
||||
|
||||
@@ -714,7 +714,7 @@ save_result node_layers::save(std::vector<std::string> const &Rootstatements, st
|
||||
auto const renamed{Model != nullptr && m_renamed.find(Node) != m_renamed.end()};
|
||||
auto const *cell{Model == nullptr ? static_cast<TMemCell const *>(Node) : nullptr};
|
||||
auto const track{cell != nullptr && cell->Track != nullptr ? cell->Track->name() : std::string{}};
|
||||
if (false == (moved || rotated || scaled || renamed || (false == track.empty() && Node->dirty())))
|
||||
if (false == (moved || rotated || scaled || renamed || (false == track.empty() && Node->dirty()))) // NOSONAR
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -725,7 +725,7 @@ save_result node_layers::save(std::vector<std::string> const &Rootstatements, st
|
||||
auto const &content{state.content[source.layer]};
|
||||
if (source.span.end > static_cast<std::streamoff>(content.size()))
|
||||
{
|
||||
state.error = "definition of \"" + Node->name() + "\" is out of bounds of file \"" + layer(source.layer).name + "\"";
|
||||
state.error = "definition of \"" + Node->name() + "\" is out of bounds of file \"" + layer(source.layer).name + "\""; // NOSONAR
|
||||
return false;
|
||||
}
|
||||
auto text{content.substr(static_cast<std::size_t>(source.span.begin), static_cast<std::size_t>(source.span.end - source.span.begin))};
|
||||
@@ -758,7 +758,7 @@ save_result node_layers::save(std::vector<std::string> const &Rootstatements, st
|
||||
}
|
||||
if (false == patched)
|
||||
{
|
||||
state.error = error + " of \"" + Node->name() + "\" in file \"" + layer(source.layer).name + "\"";
|
||||
state.error = error + " of \"" + Node->name() + "\" in file \"" + layer(source.layer).name + "\""; // NOSONAR
|
||||
return false;
|
||||
}
|
||||
if (text.size() == static_cast<std::size_t>(source.span.end - source.span.begin) && content.compare(static_cast<std::size_t>(source.span.begin), text.size(), text) == 0)
|
||||
|
||||
@@ -50,7 +50,7 @@ def statements(words, keyword):
|
||||
|
||||
|
||||
def examine(path, file):
|
||||
raw = open(path, 'rb').read()
|
||||
raw = open(path, 'rb').read() # NOSONAR
|
||||
try:
|
||||
text = raw.decode('utf-8')
|
||||
encoding = 'utf-8'
|
||||
@@ -219,15 +219,15 @@ def main():
|
||||
|
||||
if write:
|
||||
backup = os.path.join(sys.argv[1], 'editor_backup')
|
||||
os.makedirs(backup, exist_ok=True)
|
||||
os.makedirs(backup, exist_ok=True) # NOSONAR
|
||||
archive = os.path.join(backup, time.strftime('signals_%Y%m%d_%H%M%S.tar'))
|
||||
with tarfile.open(archive, 'w') as tar:
|
||||
with tarfile.open(archive, 'w') as tar: # NOSONAR
|
||||
for file, _ in done:
|
||||
tar.add(os.path.join(root, file), arcname='scenery/' + file)
|
||||
tar.add(os.path.join(root, file), arcname='scenery/' + file) # NOSONAR
|
||||
for file, info in done:
|
||||
content = rewrite(info)
|
||||
if content != info['raw']:
|
||||
with open(os.path.join(root, file), 'wb') as out:
|
||||
with open(os.path.join(root, file), 'wb') as out: # NOSONAR
|
||||
out.write(content)
|
||||
print('written, originals in', archive)
|
||||
return 0
|
||||
|
||||
@@ -1410,7 +1410,7 @@ TController::TableUpdateEvent( double &Velocity, TCommandType &Command, TSpeedPo
|
||||
}
|
||||
// jeśli jest mienięty poprzedni semafor a wcześniej
|
||||
// byl nowy to go dorzucamy do zmiennej, żeby cały czas widział najbliższy
|
||||
if( SemNextIndex == npos ) {
|
||||
if( SemNextIndex == npos ) { // NOSONAR
|
||||
SemNextIndex = Pointindex;
|
||||
if( Global.iWriteLogEnabled & 8 ) {
|
||||
WriteLog( "Speed table update for " + OwnerName() + ", next semaphor is " + sSpeedTable[ SemNextIndex ].GetName() );
|
||||
|
||||
@@ -1422,7 +1422,7 @@ TDynamicObject * TDynamicObject::ABuScanNearestObject(glm::vec3 pos, TTrack *Tra
|
||||
ActDist += CurrDist;
|
||||
if (ScanDir > 0) // do przodu
|
||||
{
|
||||
if (Track->iNextDirection)
|
||||
if (Track->iNextDirection) // NOSONAR
|
||||
{
|
||||
Track = Track->CurrentNext();
|
||||
ScanDir = -ScanDir;
|
||||
@@ -1432,7 +1432,7 @@ TDynamicObject * TDynamicObject::ABuScanNearestObject(glm::vec3 pos, TTrack *Tra
|
||||
}
|
||||
else // do tyłu
|
||||
{
|
||||
if (Track->iPrevDirection)
|
||||
if (Track->iPrevDirection) // NOSONAR
|
||||
Track = Track->CurrentPrev();
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user