diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 34b2f96837..32aeb5438e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ default_language_version: exclude: ^(.github/|tests/test_data/abinit/) repos: - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.4.10 + rev: v0.5.2 hooks: - id: ruff args: [--fix] @@ -17,7 +17,7 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/asottile/blacken-docs - rev: 1.16.0 + rev: 1.18.0 hooks: - id: blacken-docs additional_dependencies: [black] @@ -30,7 +30,7 @@ repos: - id: rst-directive-colons - id: rst-inline-touching-normal - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.10.0 + rev: v1.10.1 hooks: - id: mypy files: ^src/ diff --git a/pyproject.toml b/pyproject.toml index c2fccbb839..7182b8368f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -193,6 +193,7 @@ ignore = [ "PTH", # prefer Pathlib to os.path "RUF013", # implicit-optional "S324", # use of insecure hash function + "S603", # use of insecure subprocess "S507", # paramiko auto trust "TD", # TODOs "TRY003", # long message outside exception class diff --git a/src/atomate2/abinit/run.py b/src/atomate2/abinit/run.py index 8137c57ba2..45874b1aa5 100644 --- a/src/atomate2/abinit/run.py +++ b/src/atomate2/abinit/run.py @@ -49,7 +49,7 @@ def run_abinit( command.append(INPUT_FILE_NAME) with open(LOG_FILE_NAME, "w") as stdout, open(STDERR_FILE_NAME, "w") as stderr: - process = subprocess.Popen(command, stdout=stdout, stderr=stderr) # noqa: S603 + process = subprocess.Popen(command, stdout=stdout, stderr=stderr) if wall_time is not None: while True: diff --git a/src/atomate2/aims/run.py b/src/atomate2/aims/run.py index 1d2294f55e..ab3554f1fd 100644 --- a/src/atomate2/aims/run.py +++ b/src/atomate2/aims/run.py @@ -40,7 +40,7 @@ def run_aims( aims_cmd = expandvars(aims_cmd) logger.info(f"Running command: {aims_cmd}") - return_code = subprocess.call(["/bin/bash", "-c", aims_cmd], env=os.environ) # noqa: S603 + return_code = subprocess.call(["/bin/bash", "-c", aims_cmd], env=os.environ) logger.info(f"{aims_cmd} finished running with return code: {return_code}") diff --git a/src/atomate2/amset/run.py b/src/atomate2/amset/run.py index 7cf0e3a8af..1c3c49e290 100644 --- a/src/atomate2/amset/run.py +++ b/src/atomate2/amset/run.py @@ -17,7 +17,7 @@ def run_amset() -> None: # Run AMSET using the command line as calling from python can cause issues # with multiprocessing with open("std_out.log", "w") as f_std, open("std_err.log", "w") as f_err: - subprocess.call(["amset", "run"], stdout=f_std, stderr=f_err) # noqa: S603, S607 + subprocess.call(["amset", "run"], stdout=f_std, stderr=f_err) # noqa: S607 def check_converged( diff --git a/src/atomate2/cli/dev.py b/src/atomate2/cli/dev.py index 6b1bcbf1b5..de9e0cfa79 100644 --- a/src/atomate2/cli/dev.py +++ b/src/atomate2/cli/dev.py @@ -602,13 +602,13 @@ def save_abinit_maker(maker: Maker) -> None: author_mail = None if git: name = subprocess.run( - "git config user.name".split(), # noqa: S603 + "git config user.name".split(), capture_output=True, encoding="utf-8", check=True, ) mail = subprocess.run( - "git config user.email".split(), # noqa: S603 + "git config user.email".split(), capture_output=True, encoding="utf-8", check=True, diff --git a/src/atomate2/vasp/builders/elastic.py b/src/atomate2/vasp/builders/elastic.py index 2e9eae92c7..12503b53a0 100644 --- a/src/atomate2/vasp/builders/elastic.py +++ b/src/atomate2/vasp/builders/elastic.py @@ -148,9 +148,9 @@ def process_item(self, tasks: list[dict]) -> list[ElasticDocument]: grouped = _group_deformations(tasks, self.structure_match_tol) elastic_docs = [] - for tasks in grouped: + for group in grouped: elastic_doc = _get_elastic_document( - tasks, self.symprec, self.fitting_method + group, self.symprec, self.fitting_method ) elastic_docs.append(elastic_doc) diff --git a/tests/forcefields/test_utils.py b/tests/forcefields/test_utils.py index e8d3d53f9f..474edd2680 100644 --- a/tests/forcefields/test_utils.py +++ b/tests/forcefields/test_utils.py @@ -142,7 +142,7 @@ def test_ext_load(force_field: str): }[force_field] calc_from_decode = ase_calculator(decode_dict) calc_from_preset = ase_calculator(str(MLFF(force_field))) - assert type(calc_from_decode) == type(calc_from_preset) + assert type(calc_from_decode) is type(calc_from_preset) assert calc_from_decode.name == calc_from_preset.name assert calc_from_decode.parameters == calc_from_preset.parameters == {}