{"id":13639556,"url":"https://github.com/tokenspice/tokenspice","last_synced_at":"2025-04-19T22:33:07.388Z","repository":{"id":39590939,"uuid":"316409874","full_name":"tokenspice/tokenspice","owner":"tokenspice","description":"EVM agent-based token simulator 🐟🌪️","archived":false,"fork":false,"pushed_at":"2023-11-14T13:25:44.000Z","size":6670,"stargazers_count":299,"open_issues_count":3,"forks_count":54,"subscribers_count":17,"default_branch":"main","last_synced_at":"2024-08-03T01:15:03.528Z","etag":null,"topics":["blockchain","ethereum","simulation","token"],"latest_commit_sha":null,"homepage":"","language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tokenspice.png","metadata":{"files":{"readme":"README-code-quality.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-11-27T05:38:48.000Z","updated_at":"2024-07-09T09:47:56.000Z","dependencies_parsed_at":"2023-11-14T14:45:08.184Z","dependency_job_id":null,"html_url":"https://github.com/tokenspice/tokenspice","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tokenspice%2Ftokenspice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tokenspice%2Ftokenspice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tokenspice%2Ftokenspice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tokenspice%2Ftokenspice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tokenspice","download_url":"https://codeload.github.com/tokenspice/tokenspice/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223810530,"owners_count":17206784,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","ethereum","simulation","token"],"created_at":"2024-08-02T01:01:02.058Z","updated_at":"2024-11-09T09:31:12.129Z","avatar_url":"https://github.com/tokenspice.png","language":"Solidity","funding_links":[],"categories":["DAO 工具","By Language","Simulation \u0026 Modeling Tools"],"sub_categories":["Solidity"],"readme":"# Code Quality: Style Guide and Tests\n\n## Table of Contents\n\n- [Style Guide](#style-guide)\n- [On Tests](#tests)\n- [Remote Tests](#remote-tests)\n- [Local Tests](#local-tests)\n- [Local Fixes](#local-fixes)\n\n## Style Guide\n\nCode and checks in TokenSPICE should strive to follow:\n- [PEP 8](https://www.python.org/dev/peps/pep-0008/) Style Guide, [PEP 20](https://www.python.org/dev/peps/pep-0020/) The Zen of Python, [PEP 484](https://www.python.org/dev/peps/pep-0484/) Type Hints, [PEP 257](https://www.python.org/dev/peps/pep-0257/) Docstring conventions\n- And, most specifically, [`google` docstring convention](https://google.github.io/styleguide/pyguide.html) [[2](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html)]. It's a good balance of compact, readable, and specific. Docstrings should include variable types if they are not explicitly type hints in code itself.\n- pydocstyle v4.0.0 supports `google` docstring convention [[ref](http://www.pydocstyle.org/en/stable/error_codes.html#default-conventions)]. This means checks for all the errors except D203, D204, D213, D215, D400, D401, D404, D406, D407, D408, D409 and D413 . \n\n\n```python\ndef myfunction(param1, param2):\n    \"\"\"Example function with types documented in the docstring.\n\n    `PEP 484`_ type annotations are supported. If attribute, parameter, and\n    return types are annotated according to `PEP 484`_, they do not need to be\n    included in the docstring:\n\n    Args:\n        address: str -- Eth address\n        agents: set of Agent -- \n        agent_ages: dict of {agent_name:str : agent_age:int} -- agent's ages\n\tcompleted: list of int --\n\n    Returns:\n        bool: Success if True\n    \"\"\"\n```\n\n## On Tests\n\nEnsure that the local tests are the same as remote; otherwise we'd end up fixing things we don't care about. \n\nCodacy supports testing across many tools at once. It's easy to run remotely. However to use locally, `codacy-cli` runs slowly and churns the CPU. There are so many unimportant tests that it obscures the important ones.\n\nTherefore, we _only_ use pylint. It's 80% of the benefit with 20% of the effort. Setup:\n- Locally: just use `pylint`, not `codacy-cli`\n- Remotely: use codacy, but only pylint is used\n- For both, ignore the checks D203, D204, etc as specified in the Style Guide above\n\n## Remote Tests\n\n[Codacy](https://www.codacy.com) is automatically run _remotely_ for each commit of each PR.\n- [Here's the Codacy TokenSPICE dashboard](https://app.codacy.com/gh/tokenspice/tokenspice/dashboard?branch=main), including links to tests. To access this, you need special permissions; ask Trent.\n- [These \"Code Patterns\" settings](https://app.codacy.com/gh/tokenspice/tokenspice/patterns/list) specify what checks are run vs ignored.\n\n## Local Tests\n\nUse `pylint`. [Here's a pylint tutorial.](https://pylint.pycqa.org/en/latest/tutorial.html).\n\nHere's an example. In the terminal:\n```console\npylint *\n```\n\nPylint auto-loads `./pylintrc` and uses its options, such as ignoring D203, D204. \n\nExample pylint output:\n```text\nengine/SimEngine.py:9:0: W0611: Unused valuation imported from util (unused-import)\nengine/AgentWallet.py:419:4: C0116: Missing function or method docstring (missing-function-docstring)\n...\n-----------------------------------\nYour code has been rated at 8.07/10\n```\n\nTo learn more about a complaint, some examples:\n```console\npylint --help-msg=unused-import\npylint --help-msg=missing-function-docstring\n```\n\n## Local Fixes\n\nThere are a couple approaches to making fixes:\n1. Use automated tools like [`black`](https://pypi.org/project/black/)\n2. Manually\n\nWe recommend to start with (1), then clean the rest with (2).\n\nUsage of black on one file:\n```console\nblack netlists/simplepool/test/test_netlist.py\n```\n\nIt will output:\n```console\nreformatted netlists/simplepool/test/test_netlist.py\nAll done! ✨ 🍰 ✨\n1 file reformatted.\n```\n\nFor maximum productivity, use black on everything:\n```console\nblack ./\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftokenspice%2Ftokenspice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftokenspice%2Ftokenspice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftokenspice%2Ftokenspice/lists"}