eranheres / cli_snake_game_self

0 stars 0 forks source link

Sweep: change the snake head color to light green #32

Open eranheres opened 10 months ago

eranheres commented 10 months ago

Details

No response

Checklist - [X] Modify `cli_snake_game/snake.py` ✓ https://github.com/eranheres/cli_snake_game_self/commit/023714af9daa99433198a7220707e60f29839283 - [X] Check `cli_snake_game/snake.py` ✓ https://github.com/eranheres/cli_snake_game_self/commit/011eab12a80d79c9cb6752007db67cdf20c60d1e - [X] Modify `requirements.txt` ✓ https://github.com/eranheres/cli_snake_game_self/commit/33155c210c011f8aa141a347e238c0c823e5f23d - [X] Check `requirements.txt` ✓ ![Flowchart](https://raw.githubusercontent.com/eranheres/cli_snake_game_self/sweep/assets/160132242e5fbca02d88d3bee5f807e1155e1c3f3d5fe079dc0644324171eb85_32_flowchart.svg)
sweep-mine[bot] commented 10 months ago

Here's the PR! https://github.com/eranheres/cli_snake_game_self/pull/36.

💎 Sweep Pro: I'm using GPT-4. You have unlimited GPT-4 tickets.

Actions (click)

Sandbox Execution ✓

Here are the sandbox execution logs prior to making any changes:

Sandbox logs for 97139ce
trunk init 1/9 ✓
⡿ Downloading Trunk 1.17.2...
⡿ Downloading Trunk 1.17.2...
⢿ Downloading Trunk 1.17.2...
⣻ Downloading Trunk 1.17.2...
⣽ Downloading Trunk 1.17.2...
⣾ Downloading Trunk 1.17.2...
⣷ Downloading Trunk 1.17.2...
✔ Downloading Trunk 1.17.2... done
⡿ Verifying Trunk sha256...
✔ Verifying Trunk sha256... done
⡿ Unpacking Trunk...
✔ Unpacking Trunk... done

✔ 17 linters were enabled (.trunk/trunk.yaml)
  actionlint 1.6.26 (1 github-workflow file)
  bandit 1.7.5 (8 python files)
  black 23.9.1 (6 python files)
  checkov 3.0.34 (3 yaml files)
  git-diff-check (36 files)
  isort 5.12.0 (8 python files) (created .isort.cfg)
  markdownlint 0.37.0 (4 markdown files) (created .markdownlint.yaml)
  osv-scanner 1.4.3 (1 lockfile file)
  oxipng 9.0.0 (3 png files)
  prettier 3.1.0 (4 markdown, 3 yaml files)
  ruff 0.1.5 (8 python files) (created ruff.toml)
  shellcheck 0.9.0 (1 shell file) (created .shellcheckrc)
  shfmt 3.6.0 (1 shell file)
  svgo 3.0.3 (3 svg files) (created svgo.config.js)
  trivy 0.47.0 (3 yaml files)
  trufflehog 3.62.1 (36 files)
  yamllint 1.33.0 (3 yaml files) (created .yamllint.yaml)
Next Steps
 1. Read documentation
    Our documentation can be found at https://docs.trunk.io
 2. Get help and give feedback
    Join the Trunk community at https://slack.trunk.io
pip install pytest 2/9 ✓
Collecting pytest
  Downloading pytest-7.4.3-py3-none-any.whl (325 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 325.1/325.1 KB 4.8 MB/s eta 0:00:00
Requirement already satisfied: packaging in /usr/local/lib/python3.10/dist-packages (from pytest) (23.1)
Collecting pluggy<2.0,>=0.12
  Downloading pluggy-1.3.0-py3-none-any.whl (18 kB)
Requirement already satisfied: tomli>=1.0.0 in /usr/local/lib/python3.10/dist-packages (from pytest) (2.0.1)
Collecting exceptiongroup>=1.0.0rc8
  Downloading exceptiongroup-1.1.3-py3-none-any.whl (14 kB)
Collecting iniconfig
  Downloading iniconfig-2.0.0-py3-none-any.whl (5.9 kB)
Installing collected packages: pluggy, iniconfig, exceptiongroup, pytest
Successfully installed exceptiongroup-1.1.3 iniconfig-2.0.0 pluggy-1.3.0 pytest-7.4.3
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
pip install -r requirements.txt 3/9 ✓
Collecting arrow==1.3.0
  Downloading arrow-1.3.0-py3-none-any.whl (66 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 66.4/66.4 KB 1.8 MB/s eta 0:00:00
Requirement already satisfied: iniconfig==2.0.0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 2)) (2.0.0)
Collecting packaging==23.2
  Downloading packaging-23.2-py3-none-any.whl (53 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 53.0/53.0 KB 3.5 MB/s eta 0:00:00
Requirement already satisfied: pluggy==1.3.0 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 4)) (1.3.0)
Collecting pygame==2.5.2
  Downloading pygame-2.5.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (14.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 14.0/14.0 MB 31.3 MB/s eta 0:00:00
Requirement already satisfied: pytest==7.4.3 in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 6)) (7.4.3)
Collecting python-dateutil==2.8.2
  Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 247.7/247.7 KB 28.3 MB/s eta 0:00:00
Collecting python-time==0.3.0
  Downloading python-time-0.3.0.tar.gz (2.6 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting six==1.16.0
  Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting types-python-dateutil==2.8.19.14
  Downloading types_python_dateutil-2.8.19.14-py3-none-any.whl (9.4 kB)
Requirement already satisfied: exceptiongroup>=1.0.0rc8 in /usr/local/lib/python3.10/dist-packages (from pytest==7.4.3->-r requirements.txt (line 6)) (1.1.3)
Requirement already satisfied: tomli>=1.0.0 in /usr/local/lib/python3.10/dist-packages (from pytest==7.4.3->-r requirements.txt (line 6)) (2.0.1)
Building wheels for collected packages: python-time
  Building wheel for python-time (setup.py): started
  Building wheel for python-time (setup.py): finished with status 'done'
  Created wheel for python-time: filename=python_time-0.3.0-py3-none-any.whl size=2778 sha256=84c13f8ba5a16be1836b9ac1a6915204356e4cbc56ed0c8add148c5d57ebd132
  Stored in directory: /root/.cache/pip/wheels/85/52/46/37a3e8822ab091294b0335e12ebe76e04d19f07be1bd519918
Successfully built python-time
Installing collected packages: types-python-dateutil, six, pygame, packaging, python-dateutil, arrow, python-time
  Attempting uninstall: packaging
    Found existing installation: packaging 23.1
    Uninstalling packaging-23.1:
      Successfully uninstalled packaging-23.1
Successfully installed arrow-1.3.0 packaging-23.2 pygame-2.5.2 python-dateutil-2.8.2 python-time-0.3.0 six-1.16.0 types-python-dateutil-2.8.19.14
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
trunk fmt requirements.txt || return 0 4/9 ✓
Found no applicable linters for the requested path
trunk check --fix --print-failures requirements.txt 5/9 ✓
Checked 1 file
✔ No issues
pytest 6/9 ✓
============================= test session starts ==============================
platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.3.0
rootdir: /repo
collected 4 items
tests/test_empty.py .                                                    [ 25%]
tests/test_food.py ...                                                   [100%]
============================== 4 passed in 0.03s ===============================
trunk fmt requirements.txt || return 0 7/9 ✓
Found no applicable linters for the requested path
trunk check --fix --print-failures requirements.txt 8/9 ✓
Checked 1 file
✔ No issues
pytest 9/9 ✓
============================= test session starts ==============================
platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.3.0
rootdir: /repo
collected 4 items
tests/test_empty.py .                                                    [ 25%]
tests/test_food.py ...                                                   [100%]
============================== 4 passed in 0.03s ===============================

Sandbox passed on the latest main, so sandbox checks will be enabled for this issue.


Step 1: 🔎 Searching

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I looked at (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/eranheres/cli_snake_game_self/blob/97139ce52e3f71f358d3aa454c80abcf51a40ecc/cli_snake_game/snake.py#L1-L32 https://github.com/eranheres/cli_snake_game_self/blob/97139ce52e3f71f358d3aa454c80abcf51a40ecc/requirements.txt#L1-L9

Step 2: ⌨️ Coding

trunk fmt cli_snake_game/snake.py || return 0 1/19 ✓
 ✔ Formatted cli_snake_game/snake.py
Re-checking autofixed files...

Checked 1 file
✔ No issues
trunk check --fix --print-failures cli_snake_game/snake.py 2/19 ✓
  ISSUES  
cli_snake_game/snake.py:7:30
  7:30  high  Do not use mutable data structures for argument defaults                                 ruff/B006  
 43:0   low   Standard pseudo-random generators are not suitable for security/cryptographic purposes.  bandit/B311
Checked 1 file
2 existing issues (1 auto-fixable)
pytest 3/19 ✓
============================= test session starts ==============================
platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.3.0
rootdir: /repo
collected 4 items
tests/test_empty.py .                                                    [ 25%]
tests/test_food.py ...                                                   [100%]
============================== 4 passed in 0.04s ===============================
trunk fmt cli_snake_game/snake.py || return 0 4/19 ❌ (`2`)
 ✔ Formatted cli_snake_game/snake.py
Re-checking autofixed files...

  FAILURES  
 black  cli_snake_game/snake.py  .trunk/out/xiUl4.yaml
 black  cli_snake_game/snake.py  .trunk/out/LrAQV.yaml
  NOTICES  
 Some tools failed to run. You can open the details yaml files for more information.
Checked 1 file
✖ No issues, 2 failures
bash: line 1: return: can only `return' from a function or sourced script
trunk fmt cli_snake_game/snake.py || return 0 5/19 ✓
 ✔ Formatted cli_snake_game/snake.py
Re-checking autofixed files...

 ✔ Formatted cli_snake_game/snake.py
Re-checking autofixed files...

Checked 1 file
✔ No issues
trunk check --fix --print-failures cli_snake_game/snake.py 6/19 ❌ (`1`)
 ✔ Auto-fixed cli_snake_game/snake.py
Re-checking autofixed files...

  ISSUES  
cli_snake_game/snake.py:75:7
  9:30  high  Do not use mutable data structures for argument defaults                                 ruff/B006  
 47:0   low   Standard pseudo-random generators are not suitable for security/cryptographic purposes.  bandit/B311
 75:7   high  Redefinition of unused `Food` from line 42                                               ruff/F811  
 80:0   low   Standard pseudo-random generators are not suitable for security/cryptographic purposes.  bandit/B311
Checked 1 file
2 existing issues (1 auto-fixable)
✖ 2 new issues
trunk fmt cli_snake_game/snake.py || return 0 7/19 ✓
 ✔ Formatted cli_snake_game/snake.py
Re-checking autofixed files...

 ✔ Formatted cli_snake_game/snake.py
Re-checking autofixed files...

Checked 1 file
✔ No issues
trunk check --fix --print-failures cli_snake_game/snake.py 8/19 ❌ (`1`)
 ✔ Auto-fixed cli_snake_game/snake.py
Re-checking autofixed files...

  ISSUES  
cli_snake_game/snake.py:73:7
 45:0  low   Standard pseudo-random generators are not suitable for security/cryptographic purposes.  bandit/B311
 73:7  high  Redefinition of unused `Food` from line 40                                               ruff/F811  
 78:0  low   Standard pseudo-random generators are not suitable for security/cryptographic purposes.  bandit/B311
Checked 1 file
1 existing issue
✖ 2 new issues
trunk fmt cli_snake_game/snake.py || return 0 9/19 ✓
 ✔ Formatted cli_snake_game/snake.py
Re-checking autofixed files...

 ✔ Formatted cli_snake_game/snake.py
Re-checking autofixed files...

Checked 1 file
✔ No issues
trunk check --fix --print-failures cli_snake_game/snake.py 10/19 ❌ (`1`)
 ✔ Auto-fixed cli_snake_game/snake.py
Re-checking autofixed files...

  ISSUES  
cli_snake_game/snake.py:73:7
 45:0  low   Standard pseudo-random generators are not suitable for security/cryptographic purposes.  bandit/B311
 73:7  high  Redefinition of unused `Food` from line 40                                               ruff/F811  
 78:0  low   Standard pseudo-random generators are not suitable for security/cryptographic purposes.  bandit/B311
Checked 1 file
1 existing issue
✖ 2 new issues
trunk fmt cli_snake_game/snake.py || return 0 11/19 ✓
 ✔ Formatted cli_snake_game/snake.py
Re-checking autofixed files...

 ✔ Formatted cli_snake_game/snake.py
Re-checking autofixed files...

Checked 1 file
✔ No issues
trunk check --fix --print-failures cli_snake_game/snake.py 12/19 ❌ (`1`)
 ✔ Auto-fixed cli_snake_game/snake.py
Re-checking autofixed files...

  ISSUES  
cli_snake_game/snake.py:47:26
 47:26  high  Undefined name `secrets`                                                                 ruff/F821  
 47:54  high  Undefined name `secrets`                                                                 ruff/F821  
 75:7   high  Redefinition of unused `Food` from line 40                                               ruff/F811  
 80:0   low   Standard pseudo-random generators are not suitable for security/cryptographic purposes.  bandit/B311
Checked 1 file
1 existing issue
✖ 3 new issues
trunk fmt cli_snake_game/snake.py || return 0 13/19 ❌ (`2`)
 ✔ Formatted cli_snake_game/snake.py
Re-checking autofixed files...

  FAILURES  
 black  cli_snake_game/snake.py  .trunk/out/8bofd.yaml
 black  cli_snake_game/snake.py  .trunk/out/FgXPN.yaml
  NOTICES  
 Some tools failed to run. You can open the details yaml files for more information.
Checked 1 file
✖ No issues, 2 failures
bash: line 1: return: can only `return' from a function or sourced script
trunk fmt cli_snake_game/snake.py || return 0 14/19 ❌ (`2`)
 ✔ Formatted cli_snake_game/snake.py
Re-checking autofixed files...

  FAILURES  
 black  cli_snake_game/snake.py  .trunk/out/tembR.yaml
 black  cli_snake_game/snake.py  .trunk/out/ycdaj.yaml
  NOTICES  
 Some tools failed to run. You can open the details yaml files for more information.
Checked 1 file
✖ No issues, 2 failures
bash: line 1: return: can only `return' from a function or sourced script
trunk fmt cli_snake_game/snake.py || return 0 15/19 ✓
 ✔ Formatted cli_snake_game/snake.py
Re-checking autofixed files...

 ✔ Formatted cli_snake_game/snake.py
Re-checking autofixed files...

Checked 1 file
✔ No issues
trunk check --fix --print-failures cli_snake_game/snake.py 16/19 ❌ (`1`)
 ✔ Auto-fixed cli_snake_game/snake.py
Re-checking autofixed files...

  ISSUES  
cli_snake_game/snake.py:49:7
 49:7  high  Redefinition of unused `Food` from line 40  ruff/F811
Checked 1 file
✖ 1 new issue
trunk fmt cli_snake_game/snake.py || return 0 17/19 ✓
 ✔ Formatted cli_snake_game/snake.py
Re-checking autofixed files...

 ✔ Formatted cli_snake_game/snake.py
Re-checking autofixed files...

Checked 1 file
✔ No issues
trunk check --fix --print-failures cli_snake_game/snake.py 18/19 ✓
 ✔ Auto-fixed cli_snake_game/snake.py
Re-checking autofixed files...

Checked 1 file
✔ No issues
pytest 19/19 ✓
============================= test session starts ==============================
platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.3.0
rootdir: /repo
collected 4 items
tests/test_empty.py .                                                    [ 25%]
tests/test_food.py ...                                                   [100%]
============================== 4 passed in 0.03s ===============================

trunk fmt requirements.txt || return 0 1/6 ✓
Found no applicable linters for the requested path
trunk check --fix --print-failures requirements.txt 2/6 ✓
Checked 1 file
✔ No issues
pytest 3/6 ✓
============================= test session starts ==============================
platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.3.0
rootdir: /repo
collected 4 items
tests/test_empty.py .                                                    [ 25%]
tests/test_food.py ...                                                   [100%]
============================== 4 passed in 0.05s ===============================
trunk fmt requirements.txt || return 0 4/6 ✓
Found no applicable linters for the requested path
trunk check --fix --print-failures requirements.txt 5/6 ✓
Checked 1 file
✔ No issues
pytest 6/6 ✓
============================= test session starts ==============================
platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.3.0
rootdir: /repo
collected 4 items
tests/test_empty.py .                                                    [ 25%]
tests/test_food.py ...                                                   [100%]
============================== 4 passed in 0.04s ===============================


Step 3: 🔁 Code Review

I have finished reviewing the code for completeness. I did not find errors for sweep/add-light-green-color-support.


🎉 Latest improvements to Sweep:


💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request. Join Our Discord