Skip to content

[GeoMechanicsApplication] Addressed several recently introduced code smells#11546

Merged
avdg81 merged 1 commit intomasterfrom
geo/fix-some-recent-code-smells
Sep 8, 2023
Merged

[GeoMechanicsApplication] Addressed several recently introduced code smells#11546
avdg81 merged 1 commit intomasterfrom
geo/fix-some-recent-code-smells

Conversation

@avdg81
Copy link
Contributor

@avdg81 avdg81 commented Sep 8, 2023

📝 Description
Eliminated several recently introduced code smells that have been found by SonarQube.

🆕 Changelog

  • Moved a variable declaration to inside the if statement (to limit the variable's scope as much as possible).
  • Pass some polymorphic objects by reference to const.
  • Renamed a few function parameters to comply with the Kratos Style Guide.
  • Improved the code layout.
  • Don't raise Exception, but use a more specific error class.
  • Only pass a single argument when constructing a RuntimeError.
  • Avoid having an unused loop variable (replaced i by _).
  • Use operators += and -= when appropriate.
  • Don't multiply by a hard-coded 1.
  • Moved reading of GiD output files to its own class and refactored its implementation into smaller and easy to understand methods.

- Moved a variable declaration to inside the `if` statement (to limit
  the variable's scope as much as possible).
- Pass some polymorphic objects by reference to `const`.
- Renamed a few function parameters to comply with the Kratos Style
  Guide.
- Improved the code layout.
- Don't raise `Exception`, but use a more specific error class.
- Only pass a single argument when constructing a `RuntimeError`.
- Avoid having an unused loop variable (replaced `i` by `_`).
- Use operators `+=` and `-=` when appropriate.
- Don't multiply by a hard-coded 1.
- Moved reading of GiD output files to its own class and refactored its
  implementation into smaller and easy to understand methods.
@avdg81 avdg81 added Cleanup GeoMechanics Issues related to the GeoMechanicsApplication labels Sep 8, 2023
@avdg81 avdg81 requested a review from mnabideltares September 8, 2023 08:25
@avdg81 avdg81 self-assigned this Sep 8, 2023
@avdg81 avdg81 merged commit 94127e6 into master Sep 8, 2023
@avdg81 avdg81 deleted the geo/fix-some-recent-code-smells branch September 8, 2023 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Cleanup GeoMechanics Issues related to the GeoMechanicsApplication

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants