-
Notifications
You must be signed in to change notification settings - Fork 1
Fixed python and pylint scripts #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
fb9e6b3
cc9793b
113a1ef
12118e3
4952664
f36b170
aeeb824
b9e9d83
577d6ed
31a4660
96d8873
1ad8449
8fdce67
595f3aa
ab9744c
b1116f6
61ec01e
1e5018a
2a328a7
f8f41ac
f91778c
99e2ffc
88602c3
8830d4f
f91f2c1
fbbcd6d
5f60966
bba2c79
d486d2a
1f2ed9d
39a5ae6
d887262
6235e32
c64f2c1
8d6066e
a75c859
02ea449
52574d7
bfe2c6f
3df20a1
c376fa3
01ce2b5
3ba50b4
b05a362
3e86335
4b292d7
733039d
b058dd3
2d01da2
f72ce3b
b6a8715
6a4d5fd
146dcc9
ef011ea
85b92cd
16fbcbf
498c679
d805bbe
8bead7b
8aada09
60d22a8
1d39b69
c39d02e
5562b5c
247d8f2
9101cc4
b87f79f
f4af6ec
abce319
ee77974
88f91f2
19f42cb
58924f7
8a684c9
574c3df
81a0097
2e40114
efef6f4
dba8032
6271cb0
19b0b55
16ba802
72c7d72
e855b37
23f6a60
14d321f
d69eb0f
469646a
6427340
453a976
1a387b2
d5c1a37
c97cf89
7ae7265
51cfa6f
0ea64ba
6acef31
c4b82d6
f3da6d5
a1afcf4
f55f10a
b9ed241
c2ebdc3
907ac91
89ad17a
4a894bf
380ba66
750e9e1
1a3ad24
c2bf619
8887062
d63e01d
cbfa3cb
d70a9ff
4ed160a
bcc85ba
a85203e
fa25162
ecea7c5
8ca0d9f
814e5dc
db5c93a
1a9c83a
f87e5e6
fae6ab8
8437a95
5058598
cba5b9e
1d1378d
57aae3b
45659a0
5efadab
d36599c
b905905
a1ec601
0ea2bbd
eed175f
226e6ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| name: Build Docs | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ "main" ] # Se ejecuta en cada push a main | ||
| workflow_dispatch: # Permite lanzarlo manualmente desde la pestaña Actions | ||
|
|
||
| jobs: | ||
| docs: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| # 1. Clonar el repositorio | ||
| - name: Checkout repo | ||
| uses: actions/checkout@v4 | ||
|
|
||
| # 2. Configurar Python (para scripts de documentación) | ||
| - name: Setup Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: '3.11' | ||
|
|
||
| # 3. Instalar dependencias necesarias | ||
| - name: Install dependencies | ||
| run: | | ||
| pip install markdown pandoc | ||
|
|
||
| # 4. Generar projects.json recorriendo carpetas y subcarpetas | ||
| - name: Generate projects.json | ||
| run: python scripts/scan_projects.py | ||
|
|
||
| # 5. Concatenar todos los README.md en un GLOBAL.md | ||
| - name: Generate GLOBAL.md | ||
| run: python scripts/concat_readmes.py | ||
|
|
||
| # 6. Convertir GLOBAL.md a PDF | ||
| - name: Install Pandoc | ||
| run: sudo apt-get update && sudo apt-get install -y pandoc | ||
| - name: Install LaTeX engine | ||
| run: sudo apt-get install -y texlive texlive-xetex texlive-fonts-recommended | ||
| - name: Convert to PDF | ||
| run: pandoc GLOBAL.md -o GLOBAL.pdf | ||
|
|
||
| # 7. Subir artefactos generados (JSON y PDF) | ||
| - name: Upload artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: portfolio-docs | ||
| path: | | ||
| projects.json | ||
| GLOBAL.pdf | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| # For most projects, this workflow file will not need changing; you simply need | ||
| # to commit it to your repository. | ||
| # | ||
| # You may wish to alter this file to override the set of languages analyzed, | ||
| # or to provide custom queries or build logic. | ||
| # | ||
| # ******** NOTE ******** | ||
| # We have attempted to detect the languages in your repository. Please check | ||
| # the `language` matrix defined below to confirm you have the correct set of | ||
| # supported CodeQL languages. | ||
| # | ||
| name: "CodeQL Advanced" | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ "main" ] | ||
| pull_request: | ||
| branches: [ "main" ] | ||
| schedule: | ||
| - cron: '16 4 * * 1' | ||
|
|
||
| jobs: | ||
| analyze: | ||
| name: Analyze (${{ matrix.language }}) | ||
| # Runner size impacts CodeQL analysis time. To learn more, please see: | ||
| # - https://gh.io/recommended-hardware-resources-for-running-codeql | ||
| # - https://gh.io/supported-runners-and-hardware-resources | ||
| # - https://gh.io/using-larger-runners (GitHub.com only) | ||
| # Consider using larger runners or machines with greater resources for possible analysis time improvements. | ||
| runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} | ||
| permissions: | ||
| # required for all workflows | ||
| security-events: write | ||
|
|
||
| # required to fetch internal or private CodeQL packs | ||
| packages: read | ||
|
|
||
| # only required for workflows in private repositories | ||
| actions: read | ||
| contents: read | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - language: actions | ||
| build-mode: none | ||
| - language: c-cpp | ||
| build-mode: autobuild | ||
| - language: javascript-typescript | ||
| build-mode: none | ||
| - language: python | ||
| build-mode: none | ||
| # CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift' | ||
| # Use `c-cpp` to analyze code written in C, C++ or both | ||
| # Use 'java-kotlin' to analyze code written in Java, Kotlin or both | ||
| # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both | ||
| # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, | ||
| # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. | ||
| # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how | ||
| # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| # Add any setup steps before running the `github/codeql-action/init` action. | ||
| # This includes steps like installing compilers or runtimes (`actions/setup-node` | ||
| # or others). This is typically only required for manual builds. | ||
| # - name: Setup runtime (example) | ||
| # uses: actions/setup-example@v1 | ||
|
|
||
| # Initializes the CodeQL tools for scanning. | ||
| - name: Initialize CodeQL | ||
| uses: github/codeql-action/init@v4 | ||
| with: | ||
| languages: ${{ matrix.language }} | ||
| build-mode: ${{ matrix.build-mode }} | ||
| # If you wish to specify custom queries, you can do so here or in a config file. | ||
| # By default, queries listed here will override any specified in a config file. | ||
| # Prefix the list here with "+" to use these queries and those in the config file. | ||
|
|
||
| # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs | ||
| # queries: security-extended,security-and-quality | ||
|
|
||
| # If the analyze step fails for one of the languages you are analyzing with | ||
| # "We were unable to automatically build your code", modify the matrix above | ||
| # to set the build mode to "manual" for that language. Then modify this step | ||
| # to build your code. | ||
| # ℹ️ Command-line programs to run using the OS shell. | ||
| # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun | ||
| - name: Run manual build steps | ||
| if: matrix.build-mode == 'manual' | ||
| shell: bash | ||
| run: | | ||
| echo 'If you are using a "manual" build mode for one or more of the' \ | ||
| 'languages you are analyzing, replace this with the commands to build' \ | ||
| 'your code, for example:' | ||
| echo ' make bootstrap' | ||
| echo ' make release' | ||
| exit 1 | ||
|
|
||
| - name: Perform CodeQL Analysis | ||
| uses: github/codeql-action/analyze@v4 | ||
| with: | ||
| category: "/language:${{matrix.language}}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # This workflow will triage pull requests and apply a label based on the | ||
| # paths that are modified in the pull request. | ||
| # | ||
| # To use this workflow, you will need to set up a .github/labeler.yml | ||
| # file with configuration. For more information, see: | ||
| # https://github.com/actions/labeler | ||
|
|
||
| name: Labeler | ||
| on: [pull_request_target] | ||
|
|
||
| jobs: | ||
| label: | ||
|
|
||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
|
|
||
| steps: | ||
| - uses: actions/labeler@v4 | ||
| with: | ||
| repo-token: "${{ secrets.GITHUB_TOKEN }}" |
| Original file line number | Diff line number | Diff line change | |||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,53 @@ | |||||||||||||||||||||||||||||
| name: Pylint + Black | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| on: | |||||||||||||||||||||||||||||
| push: | |||||||||||||||||||||||||||||
| branches: [ "main" ] # Ejecutar solo en 'main' o las ramas que definas | |||||||||||||||||||||||||||||
| pull_request: | |||||||||||||||||||||||||||||
| branches: [ "main" ] | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| jobs: | |||||||||||||||||||||||||||||
| build: | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| strategy: | |||||||||||||||||||||||||||||
| matrix: | |||||||||||||||||||||||||||||
| python-version: ["3.8", "3.9", "3.10"] | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - uses: actions/checkout@v4 # 1. Clonar el repositorio | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Set up Python ${{ matrix.python-version }} | |||||||||||||||||||||||||||||
| uses: actions/setup-python@v3 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| python-version: ${{ matrix.python-version }} | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Instalar dependencias, Pylint y Black | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| python -m pip install --upgrade pip | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| # Buscar y instalar dependencias desde requisitos.txt | |||||||||||||||||||||||||||||
| REQS=$(find . -name requisitos.txt) | |||||||||||||||||||||||||||||
| if [ -n "$REQS" ]; then | |||||||||||||||||||||||||||||
| echo "Se encontraron archivos de requisitos:" | |||||||||||||||||||||||||||||
| echo "$REQS" | |||||||||||||||||||||||||||||
| for req in $REQS; do | |||||||||||||||||||||||||||||
| echo "Instalando dependencias desde $req..." | |||||||||||||||||||||||||||||
| pip install -r "$req" | |||||||||||||||||||||||||||||
| done | |||||||||||||||||||||||||||||
| else | |||||||||||||||||||||||||||||
| echo "No se encontraron archivos requisitos.txt. Omitiendo instalación de dependencias." | |||||||||||||||||||||||||||||
| fi | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| # 2. Instalar Pylint y Black | |||||||||||||||||||||||||||||
| pip install pylint black | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Ejecutar formateador Black | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| echo "Verificando formato de código con Black..." | |||||||||||||||||||||||||||||
| black --line-length 100 . | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Analizando el código con Pylint | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| # 4. Ejecutar Pylint en todos los archivos .py rastreados por Git | |||||||||||||||||||||||||||||
| export PYTHONPATH=$PYTHONPATH:$(pwd)/unidad_7/pystock_management | |||||||||||||||||||||||||||||
| pylint $(git ls-files '*.py') | |||||||||||||||||||||||||||||
|
Comment on lines
+11
to
+53
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Copilot AutofixAI 8 months ago To fix the problem, add a
Suggested changeset
1
.github/workflows/pylint.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
Refresh and try again.
|
|||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| name: Python application | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ "main" ] | ||
| pull_request: | ||
| branches: [ "main" ] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| python-version: [ "3.8","3.9","3.10","3.11" ] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v3 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
|
|
||
| - name: Cache pip | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: ~/.cache/pip | ||
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-pip- | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install flake8 pytest pytest-cov | ||
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
|
|
||
| - name: Lint with flake8 | ||
| run: | | ||
| flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
| flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
|
|
||
| - name: Test with pytest | ||
| run: | | ||
| pip install pytest-cov | ||
| PYTHONPATH=. pytest tests/ --cov=unidad_1 --cov-report=term-missing |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| name: Summarize new issues | ||
|
|
||
| on: | ||
| issues: | ||
| types: [opened] | ||
|
|
||
| jobs: | ||
| summary: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| issues: write | ||
| models: read | ||
| contents: read | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Run AI inference | ||
| id: inference | ||
| uses: actions/ai-inference@v1 | ||
| with: | ||
| prompt: | | ||
| Summarize the following GitHub issue in one paragraph: | ||
| Title: ${{ github.event.issue.title }} | ||
| Body: ${{ github.event.issue.body }} | ||
|
|
||
| - name: Comment with AI summary | ||
| run: | | ||
| gh issue comment $ISSUE_NUMBER --body '${{ steps.inference.outputs.response }}' | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| ISSUE_NUMBER: ${{ github.event.issue.number }} | ||
| RESPONSE: ${{ steps.inference.outputs.response }} |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium