Skip to content

Conversation

LightAboveFighter
Copy link
Contributor

Simple class performing the functions of a directed graph with path lengths and point names/

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

TEST(Test, Simple) {
ASSERT_EQ(1, 1); // Stack []
#include "../lib/src/graph.h"
#include "./main.cpp"

Choose a reason for hiding this comment

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

warning: suspicious #include of file with '.cpp' extension [bugprone-suspicious-include]

#include "./main.cpp"
          ^

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

lib/src/graph.h Outdated
@@ -0,0 +1,74 @@
#ifndef __GRAPH_H__
#define __GRAPH_H__

Choose a reason for hiding this comment

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

warning: declaration uses identifier 'GRAPH_H', which is a reserved identifier [bugprone-reserved-identifier]

Suggested change
#define __GRAPH_H__
#define GRAPH_H_

st.push(start_name);

while (!st.empty()) {
int v = st.top();

Choose a reason for hiding this comment

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

warning: variable 'v' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int v = st.top();
int const v = st.top();

bool found_parent;
for (int i = 0; i < order.size(); ++i) {
for (int j = i + 1; j < order.size(); ++j) {
found_parent = false;

Choose a reason for hiding this comment

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

warning: Value stored to 'found_parent' is never read [clang-analyzer-deadcode.DeadStores]

      found_parent = false;
      ^
Additional context

task_01/src/test.cpp:9: Value stored to 'found_parent' is never read

      found_parent = false;
      ^

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

TEST(Test, Simple) {
ASSERT_EQ(1, 1); // Stack []
#include "../../lib/src/graph.h"
#include "main.cpp"

Choose a reason for hiding this comment

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

warning: suspicious #include of file with '.cpp' extension [bugprone-suspicious-include]

#include "main.cpp"
          ^

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

#include <stdexcept>

#include "../../lib/src/graph.h"
#include "main.cpp"

Choose a reason for hiding this comment

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

warning: suspicious #include of file with '.cpp' extension [bugprone-suspicious-include]

#include "main.cpp"
          ^

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 15 out of 16. Check the log or trigger a new build to see more.


try {
topological_sort_dfs_rec(g);
} catch (std::runtime_error) {

Choose a reason for hiding this comment

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

warning: catch handler catches by value; should catch by reference instead [misc-throw-by-value-catch-by-reference]

  } catch (std::runtime_error) {
           ^


try {
topological_sort_dfs_rec(g);
} catch (std::runtime_error) {

Choose a reason for hiding this comment

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

warning: catch handler catches by value; should catch by reference instead [misc-throw-by-value-catch-by-reference]

  } catch (std::runtime_error) {
           ^

{{5, 4}, 9},
{{4, 5}, 9},
});
bool passed = (std::map<int, double>(

Choose a reason for hiding this comment

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

warning: variable 'passed' of type 'bool' can be declared 'const' [misc-const-correctness]

Suggested change
bool passed = (std::map<int, double>(
bool const passed = (std::map<int, double>(

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions


try {
topological_sort_dfs_rec(g);
} catch (std::runtime_error) {

Choose a reason for hiding this comment

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

warning: catch handler catches by value; should catch by reference instead [misc-throw-by-value-catch-by-reference]

  } catch (std::runtime_error) {
           ^


try {
topological_sort_dfs_rec(g);
} catch (std::runtime_error) {

Choose a reason for hiding this comment

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

warning: catch handler catches by value; should catch by reference instead [misc-throw-by-value-catch-by-reference]

  } catch (std::runtime_error) {
           ^

visited[v] = true;
tin[v] = fup[v] = time++;
for (size_t i = 0; i < g.adjacents[v].size(); ++i) {
int to = g.adjacents[v][i].name;

Choose a reason for hiding this comment

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

warning: variable 'to' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int to = g.adjacents[v][i].name;
int const to = g.adjacents[v][i].name;

}

std::vector<std::pair<int, int>> get_bridges_taryan(Graph& g) {
int time = 0;

Choose a reason for hiding this comment

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

warning: variable 'time' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int time = 0;
int const time = 0;

}

std::vector<int> get_cut_verts_taryan(Graph& g) {
int time = 0;

Choose a reason for hiding this comment

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

warning: variable 'time' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int time = 0;
int const time = 0;

#include <vector>

class Graph {
struct vert_neigh {
Copy link
Contributor

Choose a reason for hiding this comment

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

хотяб VertNeighbour


int size() const { return adjacents.size(); }

void add_vert() { adjacents.push_back({}); }
Copy link
Contributor

Choose a reason for hiding this comment

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

имена методов не по кодстайлу


bool error_occured = false;

try {
Copy link
Contributor

Choose a reason for hiding this comment

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

есть ASSERT_THROW и другие похожие макросы


try {
topological_sort_dfs_rec(g);
} catch (std::runtime_error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

тут анализатор прав


#include "../../lib/src/graph.h"

std::vector<int>* topological_sort_dfs_rec(Graph& g);
Copy link
Contributor

Choose a reason for hiding this comment

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

и тут будет утечка(

}
}
return dists;
} No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

утечет то что хранится в top_order(((

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants