{"id":18365254,"url":"https://github.com/weechat/weechat-script-lint","last_synced_at":"2025-04-06T16:31:13.427Z","repository":{"id":62588650,"uuid":"359537191","full_name":"weechat/weechat-script-lint","owner":"weechat","description":"Static analysis tool for WeeChat scripts.","archived":false,"fork":false,"pushed_at":"2025-04-04T19:31:02.000Z","size":100,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-04T20:29:22.501Z","etag":null,"topics":["analysis","lint","script","static","weechat"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/weechat.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-19T17:06:28.000Z","updated_at":"2025-04-04T19:31:05.000Z","dependencies_parsed_at":"2024-11-05T23:13:03.485Z","dependency_job_id":"3d6a26a9-2d20-49ee-9b86-f56416ad8b6c","html_url":"https://github.com/weechat/weechat-script-lint","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weechat%2Fweechat-script-lint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weechat%2Fweechat-script-lint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weechat%2Fweechat-script-lint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weechat%2Fweechat-script-lint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/weechat","download_url":"https://codeload.github.com/weechat/weechat-script-lint/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247512535,"owners_count":20950883,"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":["analysis","lint","script","static","weechat"],"created_at":"2024-11-05T23:12:59.097Z","updated_at":"2025-04-06T16:31:13.416Z","avatar_url":"https://github.com/weechat.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# weechat-script-lint\n\n[![PyPI](https://img.shields.io/pypi/v/weechat-script-lint.svg)](https://pypi.org/project/weechat-script-lint/)\n[![Build Status](https://github.com/weechat/weechat-script-lint/workflows/CI/badge.svg)](https://github.com/weechat/weechat-script-lint/actions?query=workflow%3A%22CI%22)\n[![REUSE status](https://api.reuse.software/badge/github.com/weechat/weechat-script-lint)](https://api.reuse.software/info/github.com/weechat/weechat-script-lint)\n\nWeechat-script-lint is a static analysis tool for WeeChat scripts.\n\nIt can be used by people writing WeeChat scripts and it is automatically\nexecuted in the CI of the WeeChat official scripts repository:\n[https://github.com/weechat/scripts/](https://github.com/weechat/scripts/).\n\n## Installation\n\nThe script requires Python ≥ 3.7.\n\nIn a Python virtual environment:\n\n```bash\npip install weechat-script-lint\n```\n\n## Usage\n\nSee output of `weechat-script-lint --help`.\n\n## Checks\n\nWhen a script is checked, problems are displayed on output, with one of these\nlevels:\n\n- `error`: severe problem, the script must be fixed now (the return code of\n  command is the number of errors)\n- `warning`: a deprecated feature is used (script may break in future) or there\n  is a minor problem, the script should be fixed\n- `info`: information; no urgent fix needed.\n\n### Error: missing_email\n\n**Issue**: the e-mail is required if the script is submitted in the official\nscripts repository (error can be ignored in other cases).\n\n**How to fix**: add a contact e-mail in the header of the script.\n\n### Error: missing_infolist_free\n\n**Issue**: when an infolist is asked to WeeChat with `infolist_get`, it must\nalways be freed by a call to `infolist_free`, otherwise this causes a memory leak.\n\n**How to fix**: call `infolist_free` on each pointer returned by a call to\n`infolist_get`.\n\n### Error: python2_bin (Python script only)\n\n**Issue**: the info `python2_bin` is used to find the path to Python 2.x\ninterpreter. Since WeeChat is compiled with Python 3 and that all scripts aim\nto be compatible with Python 3, this info must not be used at all any more.\nNote that some systems may not provide Python 2 at all any more.\n\n**How to fix**: if the Python interpreter is used to run a background command,\nconsider using function [hook_process](https://weechat.org/files/doc/stable/weechat_plugin_api.en.html#_hook_process)\nor [hook_process_hashtable](https://weechat.org/files/doc/stable/weechat_plugin_api.en.html#_hook_process_hashtable).\n\n### Error: mixed_tabs_spaces (Python script only)\n\n**Issue**: mixed tabs and spaces are used for indentation.\n\n**How to fix**: replace all tabs by spaces for indentation.\n\n### Warning: sys_exit (Python script only)\n\n**Issue**: the function `sys.exit()` causes WeeChat to exit itself, so it\nmust not be used in scripts.\\\nThis is a warning and not an error because if it is used when the import of\n`weechat` fails, that means the script is not executed in WeeChat and then the\ncall to `sys.exit()` is harmless.\n\n**How to fix**: if `sys.exit()` is called when the import of weechat fails,\nconsider setting a variable instead that will prevent the call to\n`weechat.register` to be made.\n\n### Warning: deprecated_hook_completion_get_string\n\n**Issue**: the function `hook_completion_get_string` is deprecated and should\nnot be used any more since WeeChat 2.9.\n\n**How to fix**: call the function `completion_get_string`.\n\n### Warning: deprecated_hook_completion_list_add\n\n**Issue**: the function `hook_completion_list_add` is deprecated and should\nnot be used any more since WeeChat 2.9.\n\n**How to fix**: call the function `completion_list_add`.\n\n### Warning: modifier_irc_in\n\n**Issue**: the modifier `irc_in_xxx` sends the raw IRC message to the callback\nwhich may not be UTF-8 valid. This is a problem in some languages like Python.\n\n**How to fix**: use the modifier `irc_in2_xxx`. The modifier `irc_in_xxx` can\nbe used only if the callback operates on the raw IRC message and is prepared\nto receive invalid UTF-8 data.\n\n### Warning: signal_irc_out\n\n**Issue**: the signal `irc_out_xxx` sends the raw IRC message to the callback\nwhich may not be UTF-8 valid. This is a problem in some languages like Python.\n\n**How to fix**: use the signal `irc_out1_xxx`.\n\n### Warning: signal_irc_outtags\n\n**Issue**: the signal `irc_outtags_xxx` sends the raw IRC message to the callback\nwhich may not be UTF-8 valid. This is a problem in some languages like Python.\n\n**How to fix**: use the signal `irc_out1_xxx`.\n\n### Info: unneeded_shebang\n\n**Issue**: the shebang is not needed, except if the script can be called\noutside WeeChat, which is rare.\n\n**How to fix**: remove the shebang, unless it is really needed.\n\n### Info: url_weechat\n\n**Issue**: the WeeChat site URL is not the official one.\n\n**How to fix**: replace the URL by the official one: [https://weechat.org](https://weechat.org)\n(`https` and no `www`).\n\n## Example\n\nDefault output:\n\n```text\n$ weechat-script-lint script.py\n/path/to/script.py:44: info [url_weechat]: URL http://www.weechat.org should be changed to https://weechat.org\n/path/to/script.py:45: warning [sys_exit]: sys.exit() causes WeeChat to exit itself\n/path/to/script.py:98: error [python2_bin]: the info python2_bin must not be used any more\n/path/to/script.py:167: error [missing_infolist_free]: missing call to infolist_free\n/path/to/script.py: score = 44 / 100\nNot so good: 1 scripts analyzed, 1 with issues: 2 errors, 1 warnings, 1 info\nExiting with code 2\n```\n\nScripts grouped by score:\n\n```text\n$ weechat-script-lint --score --recursive /path/to/directory\n2 scripts with score 100 / 100:\n  /path/to/directory/test.py\n  /path/to/directory/example.py\n3 scripts with score 79 / 100:\n  /path/to/directory/dummy.py\n  /path/to/directory/fake.py\n  /path/to/directory/other.py\n```\n\n## Copyright\n\nCopyright © 2021-2025 [Sébastien Helleu](https://github.com/flashcode)\n\nThis program is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see \u003chttps://www.gnu.org/licenses/\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweechat%2Fweechat-script-lint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweechat%2Fweechat-script-lint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweechat%2Fweechat-script-lint/lists"}