diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..1bc33a0 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,6 @@ +{ + "recommendations": [ + "charliermarsh.ruff", + "ms-python.mypy-type-checker" + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 29b52c5..c117f5b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,4 @@ { - "python.formatting.provider": "black", "files.exclude": { "**/env": true, "**/__pycache__": true, @@ -12,14 +11,13 @@ "**/_version.py": true, "**/.eggs": true }, - "python.linting.pylintEnabled": true, "files.watcherExclude": { "**/target": true }, "editor.formatOnSave": true, "[python]": { "editor.formatOnPaste": false, - "editor.defaultFormatter": "ms-python.black-formatter" + "editor.defaultFormatter": "charliermarsh.ruff" }, "python.languageServer": "Pylance", "python.analysis.typeCheckingMode": "basic", diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 44e0283..ba8b3da 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,6 +5,4 @@ If you want to talk about a contribution before you start writing code & making In order to maintain a good level of quality, please ensure that your code: -* Is formatted using black (https://github.com/psf/black) - -* Passes linting with pylint (https://www.pylint.org/) \ No newline at end of file +* Is formatted and linted using [ruff](https://docs.astral.sh/ruff/) \ No newline at end of file diff --git a/locust_swarm/swarm.py b/locust_swarm/swarm.py index 2596eb2..a5baeb3 100644 --- a/locust_swarm/swarm.py +++ b/locust_swarm/swarm.py @@ -1,5 +1,5 @@ try: - import svs_locust # pylint: disable=import-outside-toplevel + import svs_locust except ModuleNotFoundError: # svs-locust is a library that is only used internally at Svenska Spel, please ignore it # We need to import it here to get some variables and the path to the installed package @@ -190,7 +190,7 @@ def check_output_multiple(list_of_commands): for process in running_procs: retcode = process.poll() if retcode is not None: # Process finished. - running_procs.remove(process) # pylint: disable=modified-iterating-list + running_procs.remove(process) if retcode != 0: raise Exception(f"Bad return code {retcode} from command: {process.args}") break @@ -371,7 +371,7 @@ def main(): locustfile = args.locustfile or "locustfile.py" if "/" in locustfile: - parser.error( # pylint: disable=not-callable + parser.error( "Locustfile (-f) must be a file in the current directory (I'm lazy and havent fixed support for this yet)" ) @@ -523,7 +523,7 @@ def get_available_servers_and_lock_them(): if max_run_time + args.exit_timeout < time.time() - start_time: logging.error( f"Locust exceeded the run time specified ({max_run_time}) by more than 30 seconds, giving up" - ) # pylint: disable=raise-missing-from + ) master_proc.send_signal(1) except KeyboardInterrupt: pass diff --git a/pyproject.toml b/pyproject.toml index 55ec8d7..6dbd43f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,2 +1,2 @@ -[tool.black] +[tool.ruff] line-length = 120 diff --git a/tox.ini b/tox.ini index ce5668e..e6c4622 100644 --- a/tox.ini +++ b/tox.ini @@ -3,10 +3,9 @@ envlist = py{38,39,310,311} [testenv] deps = - black - pylint + ruff locust-plugins # not strictly a requirement, but probably better to have it than not commands = - pylint locust_swarm/ - black --check locust_swarm/ + ruff check + ruff format --check swarm --help