Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
88be4a1
agregando configuracion de integracion con github y sonarcloud
nelsonortfan Nov 2, 2024
b1097fb
agregando linea de exclusion de test
nelsonortfan Nov 2, 2024
5a8672c
linea de ejemplo de print
nelsonortfan Nov 2, 2024
6fd918a
limpiando archivos de cobertura
nelsonortfan Nov 2, 2024
d0e342f
Algunos cambios y deshabilitar SCM en SonarCloud
nelsonortfan Nov 2, 2024
a04e0b5
modificando flujo
nelsonortfan Nov 2, 2024
d5a29d9
removiendo linea de ejemplo
nelsonortfan Nov 2, 2024
996ff81
comando directo sobre pruebas
nelsonortfan Nov 2, 2024
8a030e4
prueba desde archivo
nelsonortfan Nov 2, 2024
7f7eeb2
cambios archivo properties2
nelsonortfan Nov 2, 2024
48d398c
cambio orden de propiedades
nelsonortfan Nov 2, 2024
e3f6ee2
agregando otro folder
nelsonortfan Nov 2, 2024
f9185ea
agregando python v3.7
nelsonortfan Nov 2, 2024
3d3346c
agregando linea de prueba para validar nuevo perfil
nelsonortfan Nov 2, 2024
64588ab
removiendo valor de K para eliminar bug en archivo index.html
nelsonortfan Nov 3, 2024
d54b2d1
removiendo issue de bug de alt en img archivo index.html
nelsonortfan Nov 3, 2024
39e0535
Corrigiendo complejidad ciclomatica smell code
nelsonortfan Nov 3, 2024
ec0f9db
eliminando nuevo issue para evitar fuga de agua en index.html
nelsonortfan Nov 3, 2024
6515305
Agregando var a la variable changes_plot code smell
nelsonortfan Nov 3, 2024
f64b0d0
Cambiando mensaje repetido a constante para remediar code smell
nelsonortfan Nov 3, 2024
b459379
agregando una excepcion generica para atrapar cualquier error en code…
nelsonortfan Nov 3, 2024
bb21f22
removiendo variable e para evitar fuga de agua en code smell de excep…
nelsonortfan Nov 3, 2024
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
28 changes: 0 additions & 28 deletions .coveragerc

This file was deleted.

41 changes: 41 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Verificar version de Python
run: |
python --version
- name: Instalación de librerías y dependencias
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: pruebas+coverage
id: pruebas
run: |
pwd
ls
python -m coverage run -m unittest discover -s tests -v
echo 'Miramos el reporte'
coverage report
echo 'Guardamos archivo'
python -m coverage xml -i
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
28 changes: 0 additions & 28 deletions .github/workflows/test.yml

This file was deleted.

Binary file added __pycache__/setup.cpython-310.pyc
Binary file not shown.
Binary file added aplicacion.sqlite
Binary file not shown.
6 changes: 2 additions & 4 deletions reports/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1222,8 +1222,6 @@
// middle point has same y
points[k + 1] = points[k - ps + 1];

// we've added a point, better reflect that
k += ps;
}
}
}
Expand Down Expand Up @@ -4417,9 +4415,9 @@
<p>Statistical information for the repository 'MISW-4101-Practicas-TutorialCancionesTags' was gathered on 2021/02/16.<br>The output has been generated by <a href="https://github.com/ejwa/gitinspector">gitinspector</a> 0.5.0dev. The statistical analysis tool for git repositories.</p>
</div></div>

<div><div class="box"><p>The following historical commit information, by author, was found.</p><div><table id="changes" class="git"><thead><tr> <th>Author</th> <th>Commits</th> <th>Insertions</th> <th>Deletions</th> <th>% of changes</th></tr></thead><tbody><tr ><td><img src="https://www.gravatar.com/avatar/a2516bd03c82602d5c6e73218532fc37?default=identicon&size=20"/>avargas20</td><td>33</td><td>2514</td><td>124</td><td>100.00</td></tr><tfoot><tr> <td colspan="5">&nbsp;</td> </tr></tfoot></tbody></table><div class="chart" id="changes_chart"></div></div><script type="text/javascript"> changes_plot = $.plot($("#changes_chart"), [{label: "avargas20", data: 100.00}], { series: { pie: { innerRadius: 0.4, show: true, combine: { threshold: 0.01, label: "Minor Authors" } } }, grid: { hoverable: true } });</script></div></div>
<div><div class="box"><p>The following historical commit information, by author, was found.</p><div><table id="changes" class="git"><thead><tr> <th>Author</th> <th>Commits</th> <th>Insertions</th> <th>Deletions</th> <th>% of changes</th></tr></thead><tbody><tr ><td><img src="https://www.gravatar.com/avatar/a2516bd03c82602d5c6e73218532fc37?default=identicon&size=20"/>avargas20</td><td>33</td><td>2514</td><td>124</td><td>100.00</td></tr><tfoot><tr> <td colspan="5">&nbsp;</td> </tr></tfoot></tbody></table><div class="chart" id="changes_chart"></div></div><script type="text/javascript"> var changes_plot = $.plot($("#changes_chart"), [{label: "avargas20", data: 100.00}], { series: { pie: { innerRadius: 0.4, show: true, combine: { threshold: 0.01, label: "Minor Authors" } } }, grid: { hoverable: true } });</script></div></div>
<div><div id="timeline" class="box"><p>The following history timeline has been gathered from the repository. (Green = Additions , Red = Deletions)</p>
<table class="git full"><thead><tr><th>Author</th><th>08/02 - 14/02</th></tr></thead><tbody><tr><td><img src="https://www.gravatar.com/avatar/a2516bd03c82602d5c6e73218532fc37?default=identicon&size=20"/>avargas20</td><td><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div></td></tr><tfoot><tr><td><strong>Modified Rows:</strong></td><td>2638</td></tr></tfoot></tbody></table>
<table class="git full"><thead><tr><th>Author</th><th>08/02 - 14/02</th></tr></thead><tbody><tr><td><img src="https://www.gravatar.com/avatar/a2516bd03c82602d5c6e73218532fc37?default=identicon&size=20" alt="figura color naranja como un sol" />avargas20</td><td><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div><div class="insert">&nbsp;</div></td></tr><tfoot><tr><td><strong>Modified Rows:</strong></td><td>2638</td></tr></tfoot></tbody></table>
</div></div>
<div><div id="archivosxusuarios" class="box"><p>The following file participation percentage table, by author, was calculated.</p>
<table class="git full" border=1 frame=void rules=rows><thead><tr><th>File</th> <th>Author</th> <th>Percentage</th></tr></thead><tbody><tr><td rowspan="+1+">docs/conf.py</td><td> avargas20</td><td>100.0%</td></tr><tr class="odd"><td rowspan="+1+">src/__main__.py</td><td> avargas20</td><td>100.0%</td></tr><tr><td rowspan="+1+">setup.py</td><td> avargas20</td><td>100.0%</td></tr><tr class="odd"><td rowspan="+1+">src/modelo/album.py</td><td> avargas20</td><td>100.0%</td></tr><tr><td rowspan="+1+">src/modelo/cancion.py</td><td> avargas20</td><td>100.0%</td></tr><tr class="odd"><td rowspan="+1+">src/logica/coleccion.py</td><td> avargas20</td><td>100.0%</td></tr><tr><td rowspan="+1+">src/modelo/interprete.py</td><td> avargas20</td><td>100.0%</td></tr><tr class="odd"><td rowspan="+1+">src/modelo/declarative_base.py</td><td> avargas20</td><td>100.0%</td></tr><tr><td rowspan="+1+">src/vista/interfaz_coleccion.py</td><td> avargas20</td><td>100.0%</td></tr><tr class="odd"><td rowspan="+1+">src/vista/vista_album.py</td><td> avargas20</td><td>100.0%</td></tr><tr><td rowspan="+1+">src/vista/vista_busqueda.py</td><td> avargas20</td><td>100.0%</td></tr><tr class="odd"><td rowspan="+1+">src/vista/vista_cancion.py</td><td> avargas20</td><td>100.0%</td></tr><tr><td rowspan="+1+">tests/test_album.py</td><td> avargas20</td><td>100.0%</td></tr><tr class="odd"><td rowspan="+1+">src/vista/vista_lista_cancion.py</td><td> avargas20</td><td>100.0%</td></tr><tr><td rowspan="+1+">src/vista/vista_lista_album.py</td><td> avargas20</td><td>100.0%</td></tr><tr class="odd"><td rowspan="+1+">tests/test_cancion.py</td><td> avargas20</td><td>100.0%</td></tr><tr><td rowspan="+1+">tests/test_interprete.py</td><td> avargas20</td><td>100.0%</td></tr></tbody></table>
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
coverage==5.4
Faker==5.8.0
PyQt5==5.15.2
#PyQt5==5.15.2
SQLAlchemy==1.3.22
16 changes: 16 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
sonar.projectKey=nelsonortfan_TutorialCancionesTags
sonar.organization=nelsonortfan

sonar.coverage.exclusions=**tests/**,**src/vista/**,**src/recursos/**,**docs/**,**setup.py**
sonar.python.coverage.reportPaths=coverage.xml
# This is the name and version displayed in the SonarCloud UI.
#sonar.projectName=TutorialCancionesTags
#sonar.projectVersion=1.0


# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
#sonar.sources=.

# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8
# This is a comment
2 changes: 1 addition & 1 deletion src/logica/coleccion.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def eliminar_interprete(self, interprete_id):
session.delete(interprete)
session.commit()
return True
except:
except Exception:
return False

def dar_interpretes(self):
Expand Down
8 changes: 5 additions & 3 deletions src/vista/interfaz_coleccion.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class App(QApplication):
Clase principal de la interfaz
'''

MENSAJE_ERROR = "Error al buscar álbum"

def __init__(self, sys_argv, logica):
'''
Constructor de la interfaz
Expand Down Expand Up @@ -190,7 +192,7 @@ def mostrar_resultados_albumes(self, nombre_album):
if len(albumes) == 0:
mensaje_error = QMessageBox()
mensaje_error.setIcon(QMessageBox.Critical)
mensaje_error.setWindowTitle("Error al buscar álbum")
mensaje_error.setWindowTitle(self.MENSAJE_ERROR)
mensaje_error.setText("No hay álbumes con el título " + nombre_album)
mensaje_error.setStandardButtons(QMessageBox.Ok)
mensaje_error.exec_()
Expand All @@ -204,7 +206,7 @@ def mostrar_resultados_canciones(self, nombre_cancion):
if len(canciones) == 0:
mensaje_error = QMessageBox()
mensaje_error.setIcon(QMessageBox.Critical)
mensaje_error.setWindowTitle("Error al buscar álbum")
mensaje_error.setWindowTitle(self.MENSAJE_ERROR)
mensaje_error.setText("No hay canciones con el título " + nombre_cancion)
mensaje_error.setStandardButtons(QMessageBox.Ok)
mensaje_error.exec_()
Expand All @@ -218,7 +220,7 @@ def mostrar_resultados_interpretes(self, nombre_interprete):
if len(interpretes) == 0:
mensaje_error = QMessageBox()
mensaje_error.setIcon(QMessageBox.Critical)
mensaje_error.setWindowTitle("Error al buscar álbum")
mensaje_error.setWindowTitle(self.MENSAJE_ERROR)
mensaje_error.setText("No hay canciones con el interprete " + nombre_interprete)
mensaje_error.setStandardButtons(QMessageBox.Ok)
mensaje_error.exec_()
Expand Down
64 changes: 40 additions & 24 deletions src/vista/vista_cancion.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,37 +199,53 @@ def guardar_cancion(self):
self.interfaz.crear_cancion({"titulo":self.texto_cancion.text(),"minutos":self.texto_minutos.text(), "segundos":self.texto_segundos.text(), "compositor":self.texto_compositor.text()}, self.interpretes, id_album=self.id_album)
else:
#Si ya hay una canción actual, se debe actualizar
for id in self.interpretes_a_eliminar:
self.actualizar_cancion_actual()

self.regresar_album_definido()

def actualizar_interprete_eliminar(self):
for id in self.interpretes_a_eliminar:
if id != "n":
self.interfaz.eliminar_interprete(id)
self.interpretes_a_eliminar = []
self.cancion_actual["titulo"]=self.texto_cancion.text()
self.cancion_actual["minutos"]=self.texto_minutos.text()
self.cancion_actual["segundos"]=self.texto_segundos.text()
self.cancion_actual["compositor"]=self.texto_compositor.text()
if self.cancion_actual["titulo"] == "" or self.cancion_actual["minutos"] == "" or self.cancion_actual["segundos"] == "":
mensaje_error = QMessageBox()
mensaje_error.setIcon(QMessageBox.Critical)
mensaje_error.setWindowTitle("Error al guardar canción")
mensaje_error.setText("Ningún campo debe estar vacio")
mensaje_error.setStandardButtons(QMessageBox.Ok)
mensaje_error.exec_()
elif int(self.cancion_actual["minutos"]) == 0 and int(self.cancion_actual["segundos"]) < 10:
mensaje_error = QMessageBox()
mensaje_error.setIcon(QMessageBox.Critical)
mensaje_error.setWindowTitle("Error al guardar canción")
mensaje_error.setText("La duración de la canción debe ser mínimo de 10 sg")
mensaje_error.setStandardButtons(QMessageBox.Ok)
mensaje_error.exec_()
else:
self.interfaz.guardar_cancion(self.cancion_actual, self.interpretes)

if self.id_album != -1:

def validar_tiempo_cancion(self):
return self.cancion_actual["titulo"] == "" or self.cancion_actual["minutos"] == "" or self.cancion_actual["segundos"] == ""

def validar_tiempo_cancion_10_segundos(self):
return int(self.cancion_actual["minutos"]) == 0 and int(self.cancion_actual["segundos"]) < 10

def regresar_album_definido(self):
if self.id_album != -1:
#Si hay un album definido, se regresa a la vista del album, de lo contrario, se creo la canción sola.
self.hide()
self.interfaz.mostrar_ventana_album(self.id_album)
self.id_album = -1

def actualizar_cancion_actual(self):
#Si ya hay una canción actual, se debe actualizar
self.actualizar_interprete_eliminar()
self.interpretes_a_eliminar = []
self.cancion_actual["titulo"]=self.texto_cancion.text()
self.cancion_actual["minutos"]=self.texto_minutos.text()
self.cancion_actual["segundos"]=self.texto_segundos.text()
self.cancion_actual["compositor"]=self.texto_compositor.text()
if self.validar_tiempo_cancion():
mensaje_error = QMessageBox()
mensaje_error.setIcon(QMessageBox.Critical)
mensaje_error.setWindowTitle("Error al guardar canción")
mensaje_error.setText("Ningún campo debe estar vacio")
mensaje_error.setStandardButtons(QMessageBox.Ok)
mensaje_error.exec_()
elif self.validar_tiempo_cancion_10_segundos():
mensaje_error = QMessageBox()
mensaje_error.setIcon(QMessageBox.Critical)
mensaje_error.setWindowTitle("Error al guardar canción")
mensaje_error.setText("La duración de la canción debe ser mínimo de 10 sg")
mensaje_error.setStandardButtons(QMessageBox.Ok)
mensaje_error.exec_()
else:
self.interfaz.guardar_cancion(self.cancion_actual, self.interpretes)

def eliminar_interprete(self, n_interprete):
'''
Método para eliminar intérpretes de la ventana
Expand Down
Binary file added tests/__pycache__/test_album.cpython-310.pyc
Binary file not shown.
Binary file added tests/__pycache__/test_cancion.cpython-310.pyc
Binary file not shown.
Binary file added tests/__pycache__/test_interprete.cpython-310.pyc
Binary file not shown.