Skip to content

Commit

Permalink
transfering latest development from RFEM to RSTAB
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalO committed Jul 4, 2024
1 parent b282231 commit ce4522c
Show file tree
Hide file tree
Showing 39 changed files with 471 additions and 189 deletions.
40 changes: 40 additions & 0 deletions REVIEW_BEST_PRACTICES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Review Best Practices

## Best practice for the author
* Before submitting the code for review, the code author should perform the review himself. Read the entire code several times carefully. Code should have good structure, documentation and needs to be functional.
* It is a good practice to also check the diff if all changes are in US/Bugfix scope. The diff helps to spot temporary code.
* There needs to be a good reason for modifying code outside of scope.
* It is better to review several small changes than one big change. Smaller changes are easier to navigate and better revised.
* Have the code checked with linter or other type of static code analysis tool before code review.
* On the review board, a brief description of changes, new functions and any notes on the solution needs to be added. The reviewer then finds his way around and understands the code way faster.
* When correcting the code, the author must make changes himself to learn from the mistakes.

## Best practice for reviewer
* New objections to the code can only be raised in the first round of corrections, in the next round of corrections it is possible to raise objections only to what was changed in the given round.
* Ignore who is the author of the code. Even a senior programmer makes mistakes.

## Who should do the review?
* In addition to monitoring the quality of the code, code review has the advantage that at least two programmers have gone through each part of the code and are familiar with it (have awareness).
* It is advisable that the revisions are evenly distributed among the programmers in the team.
* It is advisable that I junior do the revision

## Division of objections into three categories:
* Nitpick - this category includes everything that is not important. Comment formatting etc.
* Blocking - serious offenses that can cause the application to crash, break the existing code, do not meet the requirements of OOP.
* To discuss – Category between Nitpick and Blocking. The code will work correctly even without fixing them. Bad use of libraries, incomplete adherence to architecture, bad naming of things, code structure.
The author must fix all blocking comments, To discuss can be skipped, but he must create a bugfix for them when he fixes them in the future. A nitpick is fine to fix, but not required.

## What to check (in order of priority):
* Serious errors like memory leak, unhandled exceptions, etc.
* Isolation of changes – if the changes do not break some piece of code that is not changed.
* Offenses against PPE and encapsulation, DRY
* Offenses against the coding standard
* Unclear or wrong naming of variables, methods, classes...
* Unnecessarily complex code
* Documentation: whether the more complex parts of the code are properly commented
* Typos in comments and line breaks in the code (cases that are not described in the coding standard

## Communication:
* Be constructive. If you criticize some part of the change, then in addition to the reason why it is good to write how the given thing could be done better and what will be solved by it.
* Don't get personal. Always talk about the code, not the other person's skills. It is better to ask questions than to directly criticize. Because it is very difficult to know all the connections and reasons that led to writing a given piece of code, and there is a greater chance that the author knows it better than you. Even if you're sure, it's better to ask what the reason for this modification is than to just say it's unnecessary. It happens to the other person too, and then he takes it partially as his own idea, and most of all, he doesn't feel that he is being blamed for anything.
* Don't be afraid to brag :-)
1 change: 1 addition & 0 deletions RSTAB/BasicObjects/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def __init__(self,
# Delete None attributes for improved performance
deleteEmptyAttributes(clientObject)


# Add Node to client model
model.clientModel.service.set_node(clientObject)

Expand Down
5 changes: 3 additions & 2 deletions RSTAB/Loads/memberLoad.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,9 @@ def Force(
if 'eccentricity_horizontal_alignment' or 'eccentricity_vertical_alignment' or 'eccentricity_section_middle' or 'is_eccentricity_at_end_different_from_start' or 'eccentricity_y_at_end' or 'eccentricity_y_at_start' or 'eccentricity_z_at_end' or 'eccentricity_z_at_start':
pass
else:
for key in params:
clientObject[key] = params[key]
if params:
for key in params:
clientObject[key] = params[key]

# Delete None attributes for improved performance
deleteEmptyAttributes(clientObject)
Expand Down
5 changes: 3 additions & 2 deletions RSTAB/Loads/membersetload.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,9 @@ def Force(
if 'eccentricity_horizontal_alignment' or 'eccentricity_vertical_alignment' or 'eccentricity_section_middle' or 'is_eccentricity_at_end_different_from_start' or 'eccentricity_y_at_end' or 'eccentricity_y_at_start' or 'eccentricity_z_at_end' or 'eccentricity_z_at_start':
pass
else:
for key in params:
clientObject[key] = params[key]
if params:
for key in params:
clientObject[key] = params[key]

# Delete None attributes for improved performance
deleteEmptyAttributes(clientObject)
Expand Down
17 changes: 10 additions & 7 deletions RSTAB/Loads/nodalLoad.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,9 @@ def Force(
if 'specific_direction' or 'force_eccentricity' or 'force_eccentricity' in params.keys():
pass
else:
for key in params:
clientObject[key] = params[key]
if params:
for key in params:
clientObject[key] = params[key]

# Delete None attributes for improved performance
deleteEmptyAttributes(clientObject)
Expand Down Expand Up @@ -317,8 +318,9 @@ def Moment(
if 'specific_direction' or 'force_eccentricity' in params.keys():
pass
else:
for key in params:
clientObject[key] = params[key]
if params:
for key in params:
clientObject[key] = params[key]

# Delete None attributes for improved performance
deleteEmptyAttributes(clientObject)
Expand All @@ -336,7 +338,7 @@ def Components(
force_eccentricity: bool= False,
shifted_display: bool= False,
comment: str= '',
params: dict= None,
params: dict = None,
model = Model):
"""
Args:
Expand Down Expand Up @@ -454,8 +456,9 @@ def Components(
if 'specific_direction' or 'force_eccentricity' or 'force_eccentricity' in params.keys():
pass
else:
for key in params:
clientObject[key] = params[key]
if params:
for key in params:
clientObject[key] = params[key]

# Delete None attributes for improved performance
deleteEmptyAttributes(clientObject)
Expand Down
6 changes: 3 additions & 3 deletions RSTAB/SpecialObjects/nodalRelease.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ def __init__(self,
params (dict, optional): Any WS Parameter relevant to the object and its value in form of a dictionary
model (RSTAB Class, optional): Model to be edited
'''
# Client model | Node
# Client model | Nodal Release
clientObject = model.clientModel.factory.create('ns0:nodal_release')

# Clears object atributes | Sets all atributes to None
clearAttributes(clientObject)

# Node No.
# Nodal Release No.
clientObject.no = no

# Assigned Node
# Assigned Nodes
clientObject.nodes = ConvertToDlString(nodes)

# Nodal Release Type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,3 @@ def __init__(self,

# Add Global Parameters to Client Model
model.clientModel.service.set_timber_design_sls_configuration(clientObject)

1 change: 0 additions & 1 deletion RSTAB/TimberDesign/timberUltimateConfigurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,3 @@ def __init__(self,

# Add Global Parameters to Client Model
model.clientModel.service.set_timber_design_uls_configuration(clientObject)

4 changes: 2 additions & 2 deletions RSTAB/Tools/GetObjectNumbersByType.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from suds.sax.text import Text
import sys

class GetObjectNumbersByType:
class GetObjectNumbersByType():

def __new__(cls,
ObjectType = ObjectTypes.E_OBJECT_TYPE_NODE,
Expand Down Expand Up @@ -41,7 +41,7 @@ def __new__(cls,

return ObjectNumberList

class GetAllObjects:
class GetAllObjects():
"""
Returns tuple of 2 lists containing all objects and their parameters and list of imports needed to facilitate re-creating theese.
Args:
Expand Down
Loading

0 comments on commit ce4522c

Please sign in to comment.