Skip to content
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

Refactor modeler code #2616

Merged
merged 10 commits into from
Feb 6, 2025
Merged

Refactor modeler code #2616

merged 10 commits into from
Feb 6, 2025

Conversation

pet-mit
Copy link
Contributor

@pet-mit pet-mit commented Feb 3, 2025

  • move "expressions" code to src/expressions
  • move optimisation sources to src/optimisatio,
  • move yml importers to src/io

Signed-off-by: Peter Mitri <[email protected]>
Signed-off-by: Peter Mitri <[email protected]>
@pet-mit pet-mit marked this pull request as ready for review February 4, 2025 15:05
@a-zakir
Copy link
Contributor

a-zakir commented Feb 5, 2025

this line must be updated in order to avoid sonar issues:

src/libs/antares/antlr-interface/**

@@ -3,7 +3,7 @@
#include <stack>
#include <vector>

namespace Antares::Solver::Nodes
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this file named pre-order.h whereas it contains declaration of class AST ?
AST seems to be the main topic here, at least the feature we should highlight.
Class ASTPreOrderIterator is an implementation detail.
Rename into ast.h ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@a-zakir opinion ?

)


add_library(expressions-iterators
Copy link
Contributor

Choose a reason for hiding this comment

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

This remark follows this one.
About expressions-iterators target : as it mainly defines class AST, and AST is central to expressions, these files should be part of expressions target.

@@ -22,11 +22,11 @@
#pragma once
#include <stdexcept>

namespace Antares::Solver::Visitors
namespace Antares::Expressions::Visitors
{
class InvalidNode: public std::invalid_argument
{
public:
explicit InvalidNode(const std::string& node_name = "");
Copy link
Contributor

@guilpier-code guilpier-code Feb 5, 2025

Choose a reason for hiding this comment

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

Dangerous to have a default argument here (node_name = "").
This means we allow :

throw InvalidNode();

without specifying any node name.
In this case, if exception is caught, associated error message will be cryptic, as we don't know which node is concerned.

{

InvalidNode::InvalidNode(const std::string& node_name):
std::invalid_argument("Antares::Expressions::Nodes Visitor: invalid node type " + node_name)
Copy link
Contributor

Choose a reason for hiding this comment

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

"Antares::Expressions::Nodes Visitor: ..."

Does user cares about hard coded namespace things when she reads the error message of an invalid node ?

"Invalid node type " + node_name

is enough

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made it more "human":

"Node visitor encountered an invalid node type: " + node_name

@guilpier-code
Copy link
Contributor

guilpier-code commented Feb 5, 2025

Attempted small changes on the current PR : see #2619

Signed-off-by: Peter Mitri <[email protected]>
@guilpier-code guilpier-code requested a review from a-zakir February 5, 2025 15:29
Copy link

sonarqubecloud bot commented Feb 5, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
D Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@pet-mit pet-mit dismissed guilpier-code’s stale review February 6, 2025 11:26

will be merging other PR into develop

@pet-mit pet-mit merged commit 38af6da into develop Feb 6, 2025
6 of 8 checks passed
@pet-mit pet-mit deleted the feature/refacto_modeler branch February 6, 2025 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants