Skip to content

itsAiham/dice_game

Repository files navigation

Scrutinizer Code Quality Code Coverage Build Status Code Intelligence Status Documentation Status


Welcome in Dice Game!


Bellow are steps and setups you need to follow all features.

The basic goal of the project, is to reach clean, bugs free code.

Game has been developed using python OOP. The way to approach clean code with no (unaware dimensions) has been reach by writing unittest for classes used in project.


Setup you need

I am expecting you to have make installed

Have Make on your environment (in case you want to enter short command lines)

www.chocolatey.org/packages/make

Check pip by running:

on mac:

pip3 --version

on win:

pip --version

and finally

To be able to try all features, it is preferred to create Virtual Environment.


Make

To get advance of using make easily:

  • Open Makefile

    • On Windows:

      • comment line 4 and uncommnet line 5
    • On Mac:

      • comment line 5 and uncommnet line 4

Create venv

Navigate into repo if you are a windows user, use always python insteade of python3

.venv is the name of the VE you are going to create

make venv

To activate it VE in mac:

. .venv/bin/activate

To activate it on windows:

. .venv/Scripts/activate

To deactivate it on both operating system:

deactivate

Notice that if you are a windows user, use GIT-bash.

If you want to avoid creating VE. You may use command line mentioned in section bellow.


Download requirements

After activating enter the following command:

make install

check libs list

pip3 list

If the list does not have more that three lines. Then your installation faild.

You need to upgrade your pip using the following command

pip3 install pip --upgrade

pip if you are on windows

Now, let gets start

Run the game:

python main.py

Notice that you enter another terminal, and you would not exit it unless you enter q or other exit commands.

You can always press ? or help to get the introductions within game terminal.

Testing:

After you are done with the game, let us trying tests some code.

Enter:

To run unittest and get the report about testing.

make coverage

To get a visual report about which lines have been covered and which not.

make html

A new folder is created htmlcov. You find the reports in it

Run flake8, code cleaner.

make flake8

Run code analysis.

make pylint

Run both tests.

make test

UML

Create uml for whole the package.

make pyreverse

Follow doc/ where you can find separate subfolders, each include UMLs

Documentation:

You can read the Documentation from here

Also, you can create the documentation locally, navigate to dice_game/docs/ and enter

make html

And by now, the documentation for the project has been created to open it:

cd _build/html

you need to open index.html

If you are on windows:

start index.html

mac:

open index.html

Manualy comman lines

If you do not have choco

Inside dice_game folder:

To test all module within the pachage:

coverage  run -m unittest discover . “test_*.py”

Create report AFTER running tests:

coverage report -m

Create HTML report:

coverage html

Run flake8:

 flake8

To run pylint on all file:

pylint *.py