Skip to content

Commit 7e05b2e

Browse files
author
AyslanBatista
committed
🔧 Melhorando arquitetura e corrigindo bugs
- Melhorado a arquitetura do projeto, unificando cryptcode.py no core.py - Removendo funções redundantes - Novo arquivo utils.py para funções auxiliares - [BUG] Corrigindo o tratamente de erros do arquivo core.py da função process_file - [BUG] Corrigindo erro no CLI para caminhos absolutos em --keyfile e --file - [BUG] Corrigido palavras errados no template.py
1 parent abda7f9 commit 7e05b2e

File tree

14 files changed

+342
-237
lines changed

14 files changed

+342
-237
lines changed

.github/workflows/main.yml

+8-7
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ jobs:
2929
- name: Install Project
3030
run: pip install '.[test,dev]' # instalando o programa em forma de test
3131

32-
# - name: Typing
33-
# run: mypy --ignore-missing-imports encryptdef
32+
- name: Typing
33+
run: mypy encryptdef
3434

3535
- name: Look for style erros
3636
run: pflake8 # Rodando o flake para verificar se tem erro de formatação
@@ -59,17 +59,18 @@ jobs:
5959
python-version: ${{ matrix.python-version }} # Vai utilizar os python na versão especificada
6060

6161
- name: Install Project
62-
run: pip install '.[test,dev]' # instalando o programa em forma de test
62+
run: pip install '.[test,dev]'
6363

6464
- name: Run tests
65-
run: pytest -v --cov=encryptdef --cov-report=xml --junitxml=test-results.xml # Rodando os test e gerando um arquivo como relatorio
65+
run: pytest --cov=encryptdef --cov-report=xml --cov-report=term --junitxml=test-results.xml
6666

6767
- name: Upload coverage to Codecov
68-
uses: codecov/codecov-action@v4.0.1
68+
uses: codecov/codecov-action@v4
6969
with:
70-
token: ${{ secrets.CODECOV_TOKEN }}
71-
files: ./coverage.xml
70+
files: coverage.xml
7271
fail_ci_if_error: true
72+
env:
73+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
7374

7475
- name: Publish Test Results
7576
uses: EnricoMi/publish-unit-test-result-action@v2 # publicar os test unitarios que viram no arquivo xml

encryptdef/cli.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
"""Módulo responsável por todos os comandos CLI"""
22

3-
import re
43
from importlib.metadata import version
54
from typing import Any, List, Optional
65

76
import rich_click as click
87

98
from encryptdef import core
109
from encryptdef.template import TEMPLATE_DECRYPT_KEY, TEMPLATE_ENCRYPT_KEY
10+
from encryptdef.utils import assigning_a_name_file
1111

1212
# Configurações do Rich Click
1313
click.rich_click.USE_RICH_MARKUP = True
@@ -72,10 +72,11 @@ def encrypt(
7272

7373
if message:
7474
core.encrypt_message(message, key)
75+
7576
elif file:
76-
new_file = "encrypt-" + re.sub(r"encrypt-|decrypt-", "", file)
77+
new_file = assigning_a_name_file(file, "encrypt-")
7778
data_list: List[str] = [file, key, new_file]
78-
core.encrypt_file(data_list)
79+
core.process_file(data_list, core.encrypt)
7980

8081

8182
@main.command()
@@ -106,7 +107,8 @@ def decrypt(
106107

107108
if message:
108109
core.decrypt_message(message, key)
110+
109111
elif file:
110-
new_file = "decrypt-" + re.sub(r"encrypt-|decrypt-", "", file)
112+
new_file = assigning_a_name_file(file, "decrypt-")
111113
data_list: List[str] = [file, key, new_file]
112-
core.decrypt_file(data_list)
114+
core.process_file(data_list, core.decrypt)

0 commit comments

Comments
 (0)