Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vs/ProjectSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": null
}
Binary file added .vs/TMAP-PERF/v16/.suo
Binary file not shown.
8 changes: 8 additions & 0 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"ExpandedNodes": [
"",
"\\docs"
],
"SelectedNode": "\\docs\\oefening.md",
"PreviewInSolutionExplorer": false
}
Binary file added .vs/slnx.sqlite
Binary file not shown.
Binary file added docs/images/edit_file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/new_branch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/new_commit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/new_pull_request.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/open_pull_request.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/movies/Create_GitHub_account.mp4
Binary file not shown.
Binary file added docs/movies/Review_a_pull_request.mp4
Binary file not shown.
135 changes: 135 additions & 0 deletions docs/oefening.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Prerequisites

[github.com](https://www.github.com) acount.

[![Create account](http://img.youtube.com/vi/az17G21pmQs/0.jpg)](http://www.youtube.com/watch?v=az17G21pmQs "Create GitHub Account")


# Create pull request

1. Open the [repository](https://github.com/TMap-Community/TMAP-PERF/).
2. Create a new branch by expanding the "master" dropdown. Change your_name in your actual name.

![new branch](images/new_branch.png "create new branch")

3. Create a new file named **multiply_service.py** within the src/service directory. By pressing **Add file**.
Use the following code as contents.

```python
def multiply(string):
arguments = string.split("*")
result = int(arguments[0]) * int(arguments[1])
return result

```

Make sure you selected: **Commit directly to the ft/your_name** (your newly created branch name) and press commit changes.

open [calculation_service.py]( https://github.com/TMap-Community/TMAP-PERF/blob/master/src/service/calculation_service.py)
and press the pensil to edit the file.
![pensil](images/edit_file.png "Edit calculation_service.py")

Change the contents to the following:

```python
"""Module for the CalculationService class"""
from tkinter import StringVar
import divide_service as divide_service
import multiply_service as multiply_service


class CalculationService:
"""""Class for keeping track of, and evaluating calculations"""""

# Constructor for the class
# Initializes a String expression and a StringVar equation
# StringVar is used because it is required for the tkinter text box
def __init__(self):
print("initialized")
self.expression = ""
self.equation = StringVar()

def press(self, num):
"""Function to update the expression in the text entry box"""
# appends the new number to the existing expression
self.expression = self.expression + str(num)

# update the expression by using set method
self.equation.set(self.expression)

def equalpress(self):
"""Function to evaluate the final expression"""

# using a try/except in order to catch errors
try:

# evaluate the expression/calculation
if "/" in self.expression:
total = str(divide_service.divide(self.expression))
if "*" in self.expression:
total = str(multiply_service.multiply(self.expression))
else:
total = str(eval(self.expression))


if float(total) > 10:
total = total + " <:o)"

self.equation.set(total)

# reset the expression to the empty string
self.expression = ""

# show error on the screen after an exception is caught
except:
self.equation.set(" error ")
self.expression = ""



def clear(self):
"""Function to clear the contents of text entry box"""
self.expression = ""
self.equation.set("")

def get_expression(self):
"""get expression"""
return self.expression

def set_expression(self, newExpression):
"""set expression"""
self.expression = newExpression

def get_equation(self):
"""get equation"""
return self.equation

def set_equation(self, new_equation):
"""set equation"""
self.equation.set(new_equation)

```

Make sure you selected: **Commit directly to the ft/your_name** (your newly created branch name) and press commit changes.

4. Go to the [pull request overiew](https://github.com/TMap-Community/TMAP-PERF/pulls)
5. Press the **Compare & Pull Request** button
![compare and Pull request button](images/new_pull_request.png "Create new pull request")
6. In this overview you can write some details about the pull request or just press ***Create pull request*** to create the pull request.
![Create pull request button](images/new_pull_request.png "Create new pull request")
8. You've succesful created a pull request to merge your code changes to the main branch.


# Review pull request

[![Review Pull Request](http://img.youtube.com/vi/JD5Mb9hltlw/0.jpg)](http://www.youtube.com/watch?v=JD5Mb9hltlw "Review pull request in GitHub")

1. Go to the [pull request overiew](https://github.com/TMap-Community/TMAP-PERF/pulls)
2. Go to the newly created pull request
3. Review the change using the following review template:
- [ ] unit tests are written
- [ ] code complies to the code style guide
- [ ] public methods contain docstrings (comments starting with """)
- [ ] method names are snake case (all lowercase with underscores between the words)
- [ ] variables are snakecase
- [ ]
23 changes: 23 additions & 0 deletions docs/pull_request_review_example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Remark: The items in this pull-request template are also part of the Definition of Done.

- [ ] The pull request is made with the pull request template
- [ ] New dependencies do not break company rules (like licenses, versions, etc)
- [ ] The code coverage (decision coverage) is above 80%
- [ ] The code complies with the code style guide
- [ ] The documentation has been updated
- [ ] user manual
- [ ] release notes
- [ ] The code doesn't break the build
- [ ] The code backwards compatible (does not break existing uses of the software)
- [ ] The code complies with security
- [ ] OWASP top 10
- [ ] Authorisation
- [ ] Tooling like fortify/checkmarx, bandit did not find issues
- [ ] The feature does implement the acceptance criteria
- [ ] The code links to a product backlog item (PBI), user story or bug report
- [ ] Relevant tests are available
- [ ] The code contains sufficient comments
- [ ] The code complies with architectural principles:
- [ ] REST/SOAP
- [ ] Authentication
- [ ] Domain Driven Design
13 changes: 12 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Python Demo Application

This is a calculator demo application
This is a calculator demo application used for the TMAP: High-performance quality engineering course

## Requirements

Expand All @@ -10,3 +10,14 @@ This is a calculator demo application
In order to start this project run
"python3 calculator_application.py"
in the root directory of the project.

# Pull request

* [Exercise](https://github.com/TMap-Community/TMAP-PERF/blob/master/docs/oefening.md)
* [Review checklist](https://github.com/TMap-Community/TMAP-PERF/blob/master/docs/pull_request_review_example.md)


#### Additional information on Pull request can be found in the Github documentation

[Review pull requests](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/reviewing-changes-in-pull-requests)