Skip to content

Alien dictionary (additional task) #21

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
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

Stargazer2005
Copy link

No description provided.

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


// Helper function to capture the output of FindAlphabeticOrder
std::string CaptureOutput(const std::vector<std::string>& dictionary) {
std::ostringstream output;

Choose a reason for hiding this comment

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

warning: variable 'output' of type 'std::ostringstream' (aka 'basic_ostringstream') can be declared 'const' [misc-const-correctness]

Suggested change
std::ostringstream output;
std::ostringstream const output;


#include <stack>

#include "graph.hpp"

Choose a reason for hiding this comment

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

warning: 'graph.hpp' file not found [clang-diagnostic-error]

#include "graph.hpp"
         ^

for (const auto &neighbor : vertex->adjacent) {
std::cout << neighbor->data << " ";
}
std::cout << std::endl;

Choose a reason for hiding this comment

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

warning: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl]

Suggested change
std::cout << std::endl;
std::cout << '\n';

}

protected:
std::vector<std::shared_ptr<Vertex<T>>> vertices_;

Choose a reason for hiding this comment

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

warning: member variable 'vertices_' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  std::vector<std::shared_ptr<Vertex<T>>> vertices_;
                                          ^

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


// Helper function to capture the output of FindAlphabeticOrder
std::string CaptureOutput(const std::vector<std::string>& dictionary) {
std::ostringstream output;

Choose a reason for hiding this comment

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

warning: variable 'output' of type 'std::ostringstream' (aka 'basic_ostringstream') can be declared 'const' [misc-const-correctness]

Suggested change
std::ostringstream output;
std::ostringstream const output;

for (const auto &neighbor : vertex->adjacent) {
std::cout << neighbor->data << " ";
}
std::cout << std::endl;

Choose a reason for hiding this comment

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

warning: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl]

Suggested change
std::cout << std::endl;
std::cout << '\n';

}

protected:
std::vector<std::shared_ptr<Vertex<T>>> vertices_;

Choose a reason for hiding this comment

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

warning: member variable 'vertices_' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  std::vector<std::shared_ptr<Vertex<T>>> vertices_;
                                          ^

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 23. Check the log or trigger a new build to see more.


// Helper function to capture the output of FindAlphabeticOrder
std::string CaptureOutput(const std::vector<std::string>& dictionary) {
std::ostringstream output;

Choose a reason for hiding this comment

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

warning: variable 'output' of type 'std::ostringstream' (aka 'basic_ostringstream') can be declared 'const' [misc-const-correctness]

Suggested change
std::ostringstream output;
std::ostringstream const output;

};

template<typename T, typename VT>
concept IsVertex = std::derived_from<T, Vertex<VT>>;

Choose a reason for hiding this comment

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

warning: 'T' does not refer to a value [clang-diagnostic-error]

concept IsVertex = std::derived_from<T, Vertex<VT>>;
                                     ^
Additional context

lib/src/graph.hpp:19: declared here

template<typename T, typename VT>
                  ^

};

template<typename T, typename VT>
concept IsVertex = std::derived_from<T, Vertex<VT>>;

Choose a reason for hiding this comment

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

warning: a template declaration can only declare a single entity [clang-diagnostic-error]

concept IsVertex = std::derived_from<T, Vertex<VT>>;
                                      ^

};

template<typename T, typename VT>
concept IsVertex = std::derived_from<T, Vertex<VT>>;

Choose a reason for hiding this comment

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

warning: no member named 'derived_from' in namespace 'std' [clang-diagnostic-error]

concept IsVertex = std::derived_from<T, Vertex<VT>>;
                        ^

};

template<typename T, typename VT>
concept IsVertex = std::derived_from<T, Vertex<VT>>;

Choose a reason for hiding this comment

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

warning: unknown type name 'concept' [clang-diagnostic-error]

concept IsVertex = std::derived_from<T, Vertex<VT>>;
^

* Add a new vertex to the graph
* @param data
*/
virtual void AddVertex(const T &data) {

Choose a reason for hiding this comment

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

warning: unknown type name 'T' [clang-diagnostic-error]

  virtual void AddVertex(const T &data) {
                               ^

vertices_.push_back(std::make_shared<VertexType>(data));
};

std::shared_ptr<VertexType> operator[](size_t index) {

Choose a reason for hiding this comment

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

warning: use of undeclared identifier 'VertexType' [clang-diagnostic-error]

  std::shared_ptr<VertexType> operator[](size_t index) {
                  ^

return vertices_[index];
}

const std::shared_ptr<VertexType> operator[](size_t index) const {

Choose a reason for hiding this comment

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

warning: use of undeclared identifier 'VertexType' [clang-diagnostic-error]

  const std::shared_ptr<VertexType> operator[](size_t index) const {
                        ^

* @param vertex
* @return size_t
*/
size_t Find(const T &vertex) const {

Choose a reason for hiding this comment

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

warning: unknown type name 'T' [clang-diagnostic-error]

  size_t Find(const T &vertex) const {
                    ^

* Remove a vertex from the graph
* @param vertex
*/
virtual void RemoveVertex(std::shared_ptr<VertexType> vertex) {

Choose a reason for hiding this comment

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

warning: use of undeclared identifier 'VertexType' [clang-diagnostic-error]

  virtual void RemoveVertex(std::shared_ptr<VertexType> vertex) {
                                            ^

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


// Helper function to capture the output of FindAlphabeticOrder
std::string CaptureOutput(const std::vector<std::string>& dictionary) {
std::ostringstream output;

Choose a reason for hiding this comment

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

warning: variable 'output' of type 'std::ostringstream' (aka 'basic_ostringstream') can be declared 'const' [misc-const-correctness]

Suggested change
std::ostringstream output;
std::ostringstream const output;

};

template <typename T, typename VT>
concept IsVertex = std::derived_from<T, Vertex<VT>>;

Choose a reason for hiding this comment

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

warning: 'T' does not refer to a value [clang-diagnostic-error]

concept IsVertex = std::derived_from<T, Vertex<VT>>;
                                     ^
Additional context

lib/src/graph.hpp:19: declared here

template <typename T, typename VT>
                   ^

/// @tparam VertexType
/// @tparam T
template <typename VertexType, typename T>
requires IsVertex<VertexType, T>

Choose a reason for hiding this comment

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

warning: expected ';' at end of declaration [clang-diagnostic-error]

Suggested change
requires IsVertex<VertexType, T>
requires IsVertex<VertexType, T>;

/// @tparam VertexType
/// @tparam T
template <typename VertexType, typename T>
requires IsVertex<VertexType, T>

Choose a reason for hiding this comment

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

warning: unknown type name 'requires' [clang-diagnostic-error]

  requires IsVertex<VertexType, T>
  ^

/// @tparam VertexType
/// @tparam T
template <typename VertexType, typename T>
requires IsVertex<VertexType, T>

Choose a reason for hiding this comment

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

warning: variable template partial specialization does not specialize any template argument; to define the primary template, remove the template argument list [clang-diagnostic-error]

Suggested change
requires IsVertex<VertexType, T>
requires IsVertex

* @param target
*/
virtual void RemoveDirEdge(std::shared_ptr<VertexType> source,
std::shared_ptr<VertexType> target) {

Choose a reason for hiding this comment

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

warning: use of undeclared identifier 'VertexType' [clang-diagnostic-error]

                             std::shared_ptr<VertexType> target) {
                                             ^

* @param vertex_1
* @param vertex_2
*/
virtual void AddEdge(std::shared_ptr<VertexType> vertex_1,

Choose a reason for hiding this comment

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

warning: use of undeclared identifier 'VertexType' [clang-diagnostic-error]

  virtual void AddEdge(std::shared_ptr<VertexType> vertex_1,
                                       ^

* @param vertex_2
*/
virtual void AddEdge(std::shared_ptr<VertexType> vertex_1,
std::shared_ptr<VertexType> vertex_2) {

Choose a reason for hiding this comment

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

warning: use of undeclared identifier 'VertexType' [clang-diagnostic-error]

                       std::shared_ptr<VertexType> vertex_2) {
                                       ^

* @param vertex_1
* @param vertex_2
*/
virtual void RemoveEdge(std::shared_ptr<VertexType> vertex_1,

Choose a reason for hiding this comment

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

warning: use of undeclared identifier 'VertexType' [clang-diagnostic-error]

  virtual void RemoveEdge(std::shared_ptr<VertexType> vertex_1,
                                          ^

}

protected:
std::vector<std::shared_ptr<VertexType>> vertices_;

Choose a reason for hiding this comment

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

warning: member variable 'vertices_' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  std::vector<std::shared_ptr<VertexType>> vertices_;
                                           ^

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


// Helper function to capture the output of FindAlphabeticOrder
std::string CaptureOutput(const std::vector<std::string>& dictionary) {
std::ostringstream output;

Choose a reason for hiding this comment

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

warning: variable 'output' of type 'std::ostringstream' (aka 'basic_ostringstream') can be declared 'const' [misc-const-correctness]

Suggested change
std::ostringstream output;
std::ostringstream const output;

/// @tparam T
template <typename VertexType, typename T>
requires IsVertex<VertexType, T>
class Graph {

Choose a reason for hiding this comment

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

warning: constructor does not initialize these fields: vertices_ [cppcoreguidelines-pro-type-member-init]

lib/src/graph.hpp:209:

-   std::vector<std::shared_ptr<VertexType>> vertices_;
+   std::vector<std::shared_ptr<VertexType>> vertices_{};

/// @tparam T
template <typename VertexType, typename T>
requires IsVertex<VertexType, T>
class Graph {

Choose a reason for hiding this comment

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

warning: destructor of 'Graph' is public and non-virtual [cppcoreguidelines-virtual-class-destructor]

class Graph {
      ^
Additional context

lib/src/graph.hpp:27: make it public and virtual

class Graph {
      ^

}

protected:
std::vector<std::shared_ptr<VertexType>> vertices_;

Choose a reason for hiding this comment

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

warning: member variable 'vertices_' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  std::vector<std::shared_ptr<VertexType>> vertices_;
                                           ^

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.

1 participant