From f49d1a46d9bf5f6d35dd797e12b9fd0b76438681 Mon Sep 17 00:00:00 2001 From: s-weigand Date: Fri, 17 May 2024 15:46:14 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20Run=20pre-commit=20on=20all=20fi?= =?UTF-8?q?les?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.json | 25 ------------------- eslint.config.js | 27 +++++++++++++++++++++ integrationtests/prepare_tests.py | 6 ++--- integrationtests/test_common.py | 4 +-- integrationtests/test_installed_binaries.py | 4 +-- integrationtests/test_python_version.py | 8 +++--- 6 files changed, 38 insertions(+), 36 deletions(-) delete mode 100644 .eslintrc.json create mode 100644 eslint.config.js diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index d97f510..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "parser": "@typescript-eslint/parser", - "extends": ["plugin:@typescript-eslint/recommended", "prettier"], - "parserOptions": { - "ecmaVersion": 2020, - "sourceType": "module" - }, - "env": { - "es6": true, - "node": true - }, - "rules": { - "no-var": "error", - "semi": ["error", "never"], - "indent": ["error", 2], - "no-multi-spaces": "error", - "space-in-parens": "error", - "no-multiple-empty-lines": "error", - "prefer-const": "error", - "@typescript-eslint/no-unused-vars": [ - "error", - { "argsIgnorePattern": "^_" } - ] - } -} diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..a9d0b0a --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,27 @@ +module.exports = [ + { + parser: '@typescript-eslint/parser', + extends: ['plugin:@typescript-eslint/recommended', 'prettier'], + parserOptions: { + ecmaVersion: 2020, + sourceType: 'module', + }, + env: { + es6: true, + node: true, + }, + rules: { + 'no-var': 'error', + semi: ['error', 'never'], + indent: ['error', 2], + 'no-multi-spaces': 'error', + 'space-in-parens': 'error', + 'no-multiple-empty-lines': 'error', + 'prefer-const': 'error', + '@typescript-eslint/no-unused-vars': [ + 'error', + { argsIgnorePattern: '^_' }, + ], + }, + }, +] diff --git a/integrationtests/prepare_tests.py b/integrationtests/prepare_tests.py index 01f806f..866e019 100644 --- a/integrationtests/prepare_tests.py +++ b/integrationtests/prepare_tests.py @@ -4,7 +4,7 @@ def write_initial_settings(): - """Write initial settings to a file""" + """Write initial settings to a file.""" initial_settings = { "executable": sys.executable, "version_info": str(sys.version_info), @@ -15,13 +15,13 @@ def write_initial_settings(): def read_initial_settings(): - """Read initial settings to a file""" + """Read initial settings to a file.""" with open("initial_settings.json") as f: return json.load(f) def run_cmd(cmd): - """Run shell command in a python2/3 compatible way""" + """Run shell command in a python2/3 compatible way.""" process = subprocess.Popen( cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True ) diff --git a/integrationtests/test_common.py b/integrationtests/test_common.py index 5427115..11315c3 100644 --- a/integrationtests/test_common.py +++ b/integrationtests/test_common.py @@ -4,7 +4,7 @@ def test_conda_installed(): - """Conda is callable from the shell""" + """Conda is callable from the shell.""" returncode, stdout, stderr = run_cmd("conda --version") assert returncode == 0 assert stdout.startswith(b"conda") @@ -12,7 +12,7 @@ def test_conda_installed(): def test_conda_channels(): - """Conda channels are added in order""" + """Conda channels are added in order.""" returncode, stdout, stderr = run_cmd(" conda config --show channels") expected = os.environ["CONDA_CHANNELS"].split(",") channel_list = stdout.decode().partition(":")[2].split(" - ") diff --git a/integrationtests/test_installed_binaries.py b/integrationtests/test_installed_binaries.py index dc1311e..fc02e9f 100644 --- a/integrationtests/test_installed_binaries.py +++ b/integrationtests/test_installed_binaries.py @@ -4,7 +4,7 @@ def test_pandoc_installed(): - """Pandoc is callable from the shell""" + """Pandoc is callable from the shell.""" returncode, stdout, stderr = run_cmd("pandoc -v") assert returncode == 0 assert stdout.startswith(b"pandoc") @@ -12,7 +12,7 @@ def test_pandoc_installed(): def test_garphviz_installed(): - """Graphviz is installed""" + """Graphviz is installed.""" if sys.platform == "win32": returncode, stdout, stderr = run_cmd("dot.bat -V") else: diff --git a/integrationtests/test_python_version.py b/integrationtests/test_python_version.py index 95e6286..b577763 100644 --- a/integrationtests/test_python_version.py +++ b/integrationtests/test_python_version.py @@ -8,7 +8,7 @@ @pytest.mark.skipif("NOT_ACTIVATED" not in os.environ, reason="Conda python is used") def test_python_not_changed(): - """Same python as initially""" + """Same python as initially.""" initial_settings = read_initial_settings() assert initial_settings["executable"] == sys.executable assert initial_settings["version_info"] == str(sys.version_info) @@ -16,7 +16,7 @@ def test_python_not_changed(): @pytest.mark.skipif("NOT_ACTIVATED" in os.environ, reason="Conda python is not used") def test_python_from_conda(): - """Same python if from conda""" + """Same python if from conda.""" initial_settings = read_initial_settings() assert initial_settings["executable"] != sys.executable assert "miniconda" in sys.executable.lower() @@ -24,11 +24,11 @@ def test_python_from_conda(): @pytest.mark.skipif("ENV_PYTHON" not in os.environ, reason="Not a conda custom python") def test_custom_python_from_conda(): - """Same python if from conda""" + """Same python if from conda.""" assert sys.version.startswith(os.environ["ENV_PYTHON"]) @pytest.mark.skipif("PYPY_TEST" not in os.environ, reason="Not a pypy test") def test_pypy_from_conda(): - """Installed python version is PyPy""" + """Installed python version is PyPy.""" assert sys.version.splitlines()[1].startswith("[PyPy")