diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a5a4f4e4..53b191e5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -56,7 +56,7 @@ repos: # Python linting and formatting using ruff - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.6 + rev: v0.5.7 hooks: - id: ruff args: ["--fix", "--show-fixes"] @@ -107,11 +107,10 @@ repos: - pytest # Check for spelling - - repo: https://github.com/codespell-project/codespell - rev: v2.3.0 + - repo: https://github.com/crate-ci/typos + rev: v1.23.6 hooks: - - id: codespell - args: ["-L", "wille,linz", "--skip", "*.ipynb"] + - id: typos # Catch common capitalization mistakes - repo: local @@ -128,3 +127,17 @@ repos: hooks: - id: sp-repo-review additional_dependencies: ["repo-review[cli]"] + + # Check JSON schemata + - repo: https://github.com/python-jsonschema/check-jsonschema + rev: 0.29.1 + hooks: + - id: check-dependabot + - id: check-github-workflows + - id: check-readthedocs + + # Check the pyproject.toml file + - repo: https://github.com/henryiii/validate-pyproject-schema-store + rev: 2024.08.08 + hooks: + - id: validate-pyproject diff --git a/docs/source/ParameterizedCircuits.ipynb b/docs/source/ParameterizedCircuits.ipynb index 21976fb2..6ee0e664 100644 --- a/docs/source/ParameterizedCircuits.ipynb +++ b/docs/source/ParameterizedCircuits.ipynb @@ -11,7 +11,7 @@ "\n", "Variational quantum algorithms are a family of mixed quantum-classical algorithms that try to achieve a quantum advantage via low-depth circuits. This is achieved by offloading a substantial amount of computational work to a classical processor. The quantum circuits employed by variational quantum algorithms involve *parameterized gates* which depend on some a-priori uninstantiated variable.\n", "\n", - "Variational quantum algorithms try to optimize the circuit's parameters in each iteration with the classical post-processor while the quantum circuit is used to compute the cost function that is being optimized. Because recompiling the quantum circuit in each of these iterations is a costly procedure, the circuit is usually compiled in *paramterized* form in which the parameters tuned by the classical optimization routine are not bound to specific values.\n", + "Variational quantum algorithms try to optimize the circuit's parameters in each iteration with the classical post-processor while the quantum circuit is used to compute the cost function that is being optimized. Because recompiling the quantum circuit in each of these iterations is a costly procedure, the circuit is usually compiled in *parameterized* form in which the parameters tuned by the classical optimization routine are not bound to specific values.\n", "\n", "As is the case with parameter-free circuits, errors can be made during the compilation process. Therefore, verifying the correctness of compilations of parameterized quantum circuits is an important task for near-term quantum computing.\n", "\n", diff --git a/docs/source/PartialEquivalence.ipynb b/docs/source/PartialEquivalence.ipynb index ee5ff0fa..d580b364 100644 --- a/docs/source/PartialEquivalence.ipynb +++ b/docs/source/PartialEquivalence.ipynb @@ -103,7 +103,7 @@ "id": "10fff8c7-f36c-422e-8deb-796cc7637e45", "metadata": {}, "source": [ - "Aditionally, consider the following circuit, which only acts on two qubits." + "Additionally, consider the following circuit, which only acts on two qubits." ] }, { diff --git a/pyproject.toml b/pyproject.toml index 2ebf385e..2bb2b21f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -257,8 +257,21 @@ isort.required-imports = ["from __future__ import annotations"] convention = "google" +[tool.typos] +default.extend-ignore-re = [ + '"id": ".*",', + "(?Rm)^.*(#|//)\\s*spellchecker:disable-line$", # ignore line + "(?s)(#|//)\\s*spellchecker:off.*?\\n\\s*(#|//)\\s*spellchecker:on" # ignore block +] +[tool.typos.default.extend-words] +wille = "wille" +anc = "anc" +aer = "aer" + + [tool.repo-review] ignore = [ + "PC160", # "Uses codespell" -> switched to https://github.com/crate-ci/typos "PC180", # "Uses prettier" -> switched to different prettier-mirror that is not recognized by the check ] diff --git a/src/checker/EquivalenceChecker.cpp b/src/checker/EquivalenceChecker.cpp index f05e24b7..a7dbd053 100644 --- a/src/checker/EquivalenceChecker.cpp +++ b/src/checker/EquivalenceChecker.cpp @@ -10,7 +10,7 @@ #include // this function is mainly placed here in order to have an out-of-line -// virtual method definition which avoids emitting the classe's vtable in +// virtual method definition which avoids emitting the classes' vtable in // every translation unit. void ec::EquivalenceChecker::json(nlohmann::basic_json<>& j) const noexcept { j["equivalence"] = toString(equivalence); diff --git a/src/mqt/qcec/compilation_flow_profiles.py b/src/mqt/qcec/compilation_flow_profiles.py index c8c2889c..9e87b48c 100644 --- a/src/mqt/qcec/compilation_flow_profiles.py +++ b/src/mqt/qcec/compilation_flow_profiles.py @@ -265,7 +265,7 @@ def create_gate_profile_data( cost = compute_cost(qc, basis_gates, optimization_level) # add the cost to the profile data - profile_data[(gate, control)] = cost + profile_data[gate, control] = cost return profile_data @@ -360,7 +360,7 @@ def find_continuation( if next_term >= prediction_cutoff: break sequence.append(next_term) - profile_data[(gate, max_control + i + 1)] = next_term + profile_data[gate, max_control + i + 1] = next_term gate_collection_for_mode = { diff --git a/test/python/test_symbolic.py b/test/python/test_symbolic.py index bf72b748..0a0521e5 100644 --- a/test/python/test_symbolic.py +++ b/test/python/test_symbolic.py @@ -138,7 +138,7 @@ def test_non_equivalent_phase_rz_commute( assert result.equivalence == qcec.EquivalenceCriterion.not_equivalent -def test_equivalent_roation_gate_fuse( +def test_equivalent_rotation_gate_fuse( rotation_gate_fuse_lhs: QuantumCircuit, rotation_gate_fuse_rhs_correct: QuantumCircuit ) -> None: """Test a rotation gate fusion rule.""" @@ -146,7 +146,7 @@ def test_equivalent_roation_gate_fuse( assert result.equivalence == qcec.EquivalenceCriterion.equivalent -def test_non_equivalent_roation_gate_fuse( +def test_non_equivalent_rotation_gate_fuse( rotation_gate_fuse_lhs: QuantumCircuit, rotation_gate_fuse_rhs_incorrect: QuantumCircuit ) -> None: """Test an invalid rotation gate fusion rule.""" diff --git a/test/test_partial_equivalence.cpp b/test/test_partial_equivalence.cpp index 677f33c6..9ca42540 100644 --- a/test/test_partial_equivalence.cpp +++ b/test/test_partial_equivalence.cpp @@ -103,8 +103,8 @@ void addStandardOperationToCircuit(QuantumComputation& circuit, } std::vector -fiveDiffferentRandomNumbers(const qc::Qubit min, const qc::Qubit max, - std::mt19937_64& randomGenerator) { +fiveDifferentRandomNumbers(const qc::Qubit min, const qc::Qubit max, + std::mt19937_64& randomGenerator) { std::vector numbers; for (qc::Qubit i = min; i < max; i++) { @@ -202,7 +202,7 @@ StandardOperation makeRandomStandardOperation(const qc::Qubit nrQubits, const qc::Qubit min, std::mt19937_64& randomGenerator) { const auto randomNumbers = - fiveDiffferentRandomNumbers(min, min + nrQubits, randomGenerator); + fiveDifferentRandomNumbers(min, min + nrQubits, randomGenerator); // choose one of the non-compound operations, but not "None", and also // not GPhase or I or Barrier