-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a7feed8
Showing
26 changed files
with
1,695 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: CI | ||
|
||
on: | ||
- push | ||
- pull_request | ||
|
||
jobs: | ||
|
||
build: | ||
|
||
strategy: | ||
matrix: | ||
python-version: | ||
- "3.7" | ||
- "3.8" | ||
- "3.9" | ||
|
||
name: Python ${{ matrix.python-version }} | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
|
||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8 pylint mypy pytest coverage pytest-cov mock | ||
- name: Lint with flake8 | ||
run: make flake8 | ||
|
||
- name: Lint with pylint | ||
run: make pylint | ||
|
||
- name: Test with mypy | ||
run: make mypy | ||
|
||
- name: Test with pytest | ||
run: make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.coverage | ||
*.pyc | ||
*.pyo | ||
build/ | ||
dist/ | ||
weechat_script_lint.egg-info/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# weechat-script-lint ChangeLog | ||
|
||
## Version 0.1.0 (2021-04-19) | ||
|
||
- First release. |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# | ||
# Copyright (C) 2021 Sébastien Helleu <[email protected]> | ||
# | ||
# This file is part of weechat-script-lint. | ||
# | ||
# Weechat-script-lint is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# Weechat-script-lint is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with weechat-script-lint. If not, see <https://www.gnu.org/licenses/>. | ||
# | ||
|
||
all: check | ||
|
||
check: lint test | ||
|
||
lint: flake8 pylint mypy | ||
|
||
flake8: | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
flake8 . --count --exit-zero --max-complexity=10 --statistics | ||
|
||
pylint: | ||
pylint weechat_script_lint | ||
pylint tests/*.py | ||
|
||
mypy: | ||
mypy weechat_script_lint | ||
mypy tests/*.py | ||
|
||
test: | ||
pytest -vv --cov-report term-missing --cov=weechat_script_lint tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# weechat-script-lint | ||
|
||
[![PyPI](https://img.shields.io/pypi/v/weechat-script-lint.svg)](https://pypi.org/project/weechat-script-lint/) | ||
[![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) | ||
|
||
Weechat-script-lint is a static analysis tool for WeeChat scripts. | ||
|
||
The script just requires Python ≥ 3.7. | ||
|
||
## Installation | ||
|
||
``` | ||
$ pip install weechat-script-lint | ||
``` | ||
|
||
## Example | ||
|
||
``` | ||
$ weechat-script-lint script.py | ||
/path/to/script.py:44: info [url_weechat]: URL http://www.weechat.org should be changed to https://weechat.org | ||
/path/to/script.py:45: warning [sys_exit]: sys.exit() causes WeeChat to exit itself | ||
/path/to/script.py:98: error [python2_bin]: the info python2_bin must not be used any more | ||
/path/to/script.py:167: error [missing_infolist_free]: missing call to infolist_free | ||
``` | ||
|
||
## Copyright | ||
|
||
Copyright © 2021 [Sébastien Helleu](https://github.com/flashcode) | ||
|
||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# Copyright (C) 2021 Sébastien Helleu <[email protected]> | ||
# | ||
# This file is part of weechat-script-lint. | ||
# | ||
# Weechat-script-lint is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# Weechat-script-lint is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with weechat-script-lint. If not, see <https://www.gnu.org/licenses/>. | ||
# | ||
|
||
from codecs import open | ||
from setuptools import setup, find_packages | ||
from weechat_script_lint import __version__ as wsl_version | ||
|
||
DESCRIPTION = 'Static analysis tool for WeeChat scripts.' | ||
|
||
with open('README.md', 'r', 'utf-8') as f: | ||
readme = f.read() | ||
|
||
setup( | ||
name='weechat-script-lint', | ||
version=wsl_version, | ||
description=DESCRIPTION, | ||
long_description=readme, | ||
long_description_content_type='text/markdown', | ||
author='Sébastien Helleu', | ||
author_email='[email protected]', | ||
url='https://github.com/weechat/weechat-script-lint', | ||
license='GPL3', | ||
keywords='static analysis weechat script lint', | ||
classifiers=[ | ||
'Development Status :: 5 - Production/Stable', | ||
'Environment :: Console', | ||
'Intended Audience :: Developers', | ||
'License :: OSI Approved :: GNU General Public License v3 ' | ||
'or later (GPLv3+)', | ||
'Natural Language :: English', | ||
'Operating System :: OS Independent', | ||
'Programming Language :: Python', | ||
'Programming Language :: Python :: 3', | ||
'Topic :: Software Development', | ||
'Topic :: Utilities', | ||
], | ||
packages=find_packages(), | ||
tests_require=['pytest'], | ||
entry_points={ | ||
'console_scripts': ['weechat-script-lint=weechat_script_lint:main'], | ||
} | ||
) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This is not a WeeChat script. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# Author: Sébastien Helleu | ||
# | ||
|
||
"""A WeeChat script.""" | ||
|
||
import sys | ||
|
||
try: | ||
import weechat | ||
except ImportError: | ||
print('This script must be run under WeeChat: http://www.weechat.org') | ||
|
||
if __name__ == '__main__': | ||
if weechat.register('script', 'author', '0.1', 'GPL3', 'desc', '', ''): | ||
infolist = weechat.infolist_get('buffer', '', '') | ||
python2_bin = weechat.info_get('python2_bin', '') | ||
sys.exit(1) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# | ||
# Author: Sébastien Helleu | ||
# | ||
|
||
"""A WeeChat script.""" | ||
|
||
import weechat | ||
|
||
if __name__ == '__main__': | ||
if weechat.register('script', 'author', '0.1', 'GPL3', 'desc', '', ''): | ||
infolist = weechat.infolist_get('buffer', '', '') | ||
weechat.infolist_free(infolist) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# | ||
# Author: Sébastien Helleu <[email protected]> | ||
# | ||
|
||
"""A WeeChat script.""" | ||
|
||
import weechat | ||
|
||
if __name__ == '__main__': | ||
if weechat.register('script', 'author', '0.1', 'GPL3', 'desc', '', ''): | ||
infolist = weechat.infolist_get('buffer', '', '') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# | ||
# Author: Sébastien Helleu <[email protected]> | ||
# | ||
|
||
"""A WeeChat script.""" | ||
|
||
import weechat | ||
|
||
if __name__ == '__main__': | ||
if weechat.register('script', 'author', '0.1', 'GPL3', 'desc', '', ''): | ||
infolist = weechat.infolist_get('buffer', '', '') | ||
weechat.infolist_free(infolist) | ||
python2_bin = weechat.info_get('python2_bin', '') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# | ||
# Author: Sébastien Helleu <[email protected]> | ||
# | ||
|
||
"""A WeeChat script.""" | ||
|
||
import sys | ||
|
||
import weechat | ||
|
||
if __name__ == '__main__': | ||
if weechat.register('script', 'author', '0.1', 'GPL3', 'desc', '', ''): | ||
infolist = weechat.infolist_get('buffer', '', '') | ||
weechat.infolist_free(infolist) | ||
sys.exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# Author: Sébastien Helleu <[email protected]> | ||
# | ||
|
||
"""A WeeChat script.""" | ||
|
||
import weechat | ||
|
||
if __name__ == '__main__': | ||
if weechat.register('script', 'author', '0.1', 'GPL3', 'desc', '', ''): | ||
infolist = weechat.infolist_get('buffer', '', '') | ||
weechat.infolist_free(infolist) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# | ||
# Author: Sébastien Helleu <[email protected]> | ||
# | ||
|
||
"""A WeeChat script.""" | ||
|
||
try: | ||
import weechat | ||
except ImportError: | ||
print('This script must be run under WeeChat: http://www.weechat.org') | ||
|
||
if __name__ == '__main__': | ||
if weechat.register('script', 'author', '0.1', 'GPL3', 'desc', '', ''): | ||
infolist = weechat.infolist_get('buffer', '', '') | ||
weechat.infolist_free(infolist) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# | ||
# Author: Sébastien Helleu <[email protected]> | ||
# | ||
|
||
"""A WeeChat script.""" | ||
|
||
import weechat | ||
|
||
if __name__ == '__main__': | ||
if weechat.register('script', 'author', '0.1', 'GPL3', 'desc', '', ''): | ||
infolist = weechat.infolist_get('buffer', '', '') | ||
weechat.infolist_free(infolist) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# | ||
# Author: Sébastien Helleu <[email protected]> | ||
# | ||
|
||
"""A valid WeeChat script.""" | ||
|
||
import weechat | ||
|
||
if __name__ == '__main__': | ||
if weechat.register('script', 'author', '0.1', 'GPL3', 'desc', '', ''): | ||
infolist = weechat.infolist_get('buffer', '', '') | ||
weechat.infolist_free(infolist) |
Oops, something went wrong.