Skip to content

Commit

Permalink
Merge branch 'develop' into feature/logic_bot
Browse files Browse the repository at this point in the history
  • Loading branch information
Sobodazh authored Sep 13, 2023
2 parents 1312a0c + abaa9cc commit 986aa7c
Show file tree
Hide file tree
Showing 27 changed files with 988 additions and 122 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/codestyle_linters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Python linters

on:
push:
branches:
- '**'
pull_request:
branches:
- develop

jobs:
lint:
name: Check the code with python linters
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install dependencies
run: |
pip install isort black flake8 flake8-docstrings
- name: Check with isort
run: isort . --check --profile black --skip migrations --skip-glob "*settings*"

- name: Check with black
run: black . --check --line-length 79 --exclude migrations --exclude "settings"

- name: Check with flake8
run: flake8 .
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,4 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.idea/
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ repos:
hooks:
- id: black
args: ['--line-length=79']
exclude: ^(migrations/|.*settings(\.py|/)?)
exclude: ^(migrations/|.*settings(\.py|/)?)
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ Random Coffee bot for the Telegram
# Содержание


1. [БРИФ]()
1. [БРИФ](#brief)

1.1 [Инструкции и ритуалы на проекте]()

1.2 [ER - диаграмма сущностей]()
1.2 [ER - диаграмма сущностей](#er)

2. [Структура проекта](#structure)
3. [Подготовка к запуску](#start)
Expand All @@ -31,6 +31,12 @@ Random Coffee bot for the Telegram

<br><br>

# 1. БРИФ <a id="brief"></a>

## 1.2. ER - диаграмма сущностей<a id="er"></a>:
ER диаграммы расположены в директории /docs в двух удобных форматах [.drowio, .jpg]
![ER Диаграмма](/docs/RandomCoffeeER.jpg)

# 2. Структура проекта <a id="structure"></a>

| Имя | Описание |
Expand Down Expand Up @@ -303,12 +309,6 @@ make filldb
самостоятельно основные функции бота, функции отправки и получения сообщений,
функции перенаправления на сторонние или внутренние ресурсы.







#### Рекомендации к написанию кода [Codestyle](https://github.com/Studio-Yandex-Practicum/RandomCoffeeBotTelegram/tree/develop/docs/codestyle.md)

#### Диаграмма логики работы бота [Diagram](https://github.com/Studio-Yandex-Practicum/RandomCoffeeBotTelegram/tree/develop/docs/Diagram_of_logic_bot.jpg)
435 changes: 435 additions & 0 deletions docs/RandomCoffeeER.drawio

Large diffs are not rendered by default.

Binary file added docs/RandomCoffeeER.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 11 additions & 11 deletions docs/codestyle.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

+ Имена переменных должны быть snake_case и в нижнем регистре `first_name`

+ Используйте информативные описательные имена, которые легко читаются.
+ Используйте информативные описательные имена, которые легко читаются.

```python
# Не рекомендуется
au = 105

# Рекомендуется
# Рекомендуется
active_users = 105
```

Expand All @@ -23,10 +23,10 @@
# Не рекомендуется
def roll_dice():
return random.randint(0, 4) # what is 4 supposed to represent?

# Рекомендуется
DICE_SIDES = 4

def roll_dice():
return random.randint(0, DICE_SIDES)
```
Expand All @@ -41,8 +41,8 @@ DICE_SIDES = 4

# Не рекомендуется
def roll_dice_using_randint():
return random.randint(0, DICE_SIDES)
return random.randint(0, DICE_SIDES)

# Рекомендуется
def roll_dice():
return random.randint(0, DICE_SIDES)
Expand All @@ -51,7 +51,7 @@ def roll_dice():

Максимальная длина строки. Постарайтесь ограничить свои строки примерно 79 символами, что является рекомендацией, приведенной в руководстве по стилю [PEP 8](https://pythonworld.ru/osnovy/pep-8-rukovodstvo-po-napisaniyu-koda-na-python.html?ysclid=lmajzjrf9x736916353#section-5)

### Аннотация типов
### Аннотация типов

Чтобы держать типизацию под контролем — применяют аннотации типов данных `Type Hints`. Это явное указание типа ожидаемых данных при объявлении переменных, классов и функций.

Expand Down Expand Up @@ -109,10 +109,10 @@ def send_email(subject: str, body: str, recipients: List[str], cache: Dict[str,s
"""Можно перенести
так.
"""

def muddy_func():
"""
А можно -
А можно -
так.
"""
```
Expand All @@ -124,7 +124,7 @@ def send_email(subject: str, body: str, recipients: List[str], cache: Dict[str,s

### F строка
+ f-строки должны использовать только простой доступ к переменным и свойствам с предварительным назначением локальной переменной для более сложных случаев:

```python
# Разрешено
f'hello {user}'
Expand Down Expand Up @@ -185,4 +185,4 @@ from django.views import View
вместо:
```python
from django.views.generic.base import View
```
```
Loading

0 comments on commit 986aa7c

Please sign in to comment.