Skip to content

Commit 78f042e

Browse files
committed
ci(super-linter): switch to super-linter
1 parent b89b8ea commit 78f042e

File tree

6 files changed

+119
-49
lines changed

6 files changed

+119
-49
lines changed

.github/workflows/super-linter.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
#################################
3+
#################################
4+
## Super Linter GitHub Actions ##
5+
#################################
6+
#################################
7+
name: Lint Code Base
8+
9+
#
10+
# Documentation:
11+
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
12+
#
13+
14+
#############################
15+
# Start the job on all push #
16+
#############################
17+
on:
18+
push:
19+
pull_request:
20+
schedule:
21+
- cron: "0 0 * * 0"
22+
workflow_dispatch:
23+
24+
permissions: {}
25+
26+
###############
27+
# Set the Job #
28+
###############
29+
jobs:
30+
lint:
31+
# Name the Job
32+
name: Lint Code Base
33+
# Set the agent to run on
34+
runs-on: ubuntu-latest
35+
36+
############################################
37+
# Grant status permission for MULTI_STATUS #
38+
############################################
39+
permissions:
40+
contents: read
41+
packages: read
42+
statuses: write
43+
44+
##################
45+
# Load all steps #
46+
##################
47+
steps:
48+
##########################
49+
# Checkout the code base #
50+
##########################
51+
- name: Checkout Code
52+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
53+
with:
54+
# Full git history is needed to get a proper list of changed
55+
# files within `super-linter`
56+
fetch-depth: 0
57+
persist-credentials: false
58+
59+
################################
60+
# Run Linter against code base #
61+
################################
62+
- name: Lint Code Base
63+
uses: super-linter/super-linter@ffde3b2b33b745cb612d787f669ef9442b1339a6 # v8.1.0
64+
env:
65+
VALIDATE_ALL_CODEBASE: true
66+
LINTER_RULES_PATH: .
67+
DEFAULT_BRANCH: main
68+
ENFORCE_COMMITLINT_CONFIGURATION_CHECK: true
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/yamllint.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.jscpd.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"ignore": ["*.py"]
3+
}

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ A place to stash my quantum computing experiments
66

77
This is the simplest quantum circuit: a single input quibit goes through an Hadamard gate. The output is a qubit which if measured has a 50/50 chance to be a 0 or 1.
88

9-
https://en.wikipedia.org/wiki/Hadamard_transform#Quantum_computing_applications
9+
See [https://en.wikipedia.org/wiki/Hadamard_transform#Quantum_computing_applications](https://en.wikipedia.org/wiki/Hadamard_transform#Quantum_computing_applications)
10+
for more details.

commitlint.config.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const Configuration = {
2+
/*
3+
* Inherit rules from conventional commits.
4+
*/
5+
extends: ["@commitlint/config-conventional"],
6+
7+
/*
8+
* Any rules defined here will override rules from parent.
9+
*/
10+
rules: {
11+
"body-leading-blank": [2, "always"], // warning -> error
12+
"body-max-line-length": [1, "always", 100], // error -> warning
13+
"footer-leading-blank": [2, "always"], // warning -> error
14+
"footer-max-length": [1, "always", 100], // error -> warning
15+
"header-max-length": [1, "always", 100], // error -> warning
16+
},
17+
};
18+
19+
export default Configuration;

quantum_8ball.ipynb

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
"metadata": {},
2828
"outputs": [],
2929
"source": [
30+
"# pylint: disable=missing-module-docstring\n",
3031
"# begin with importing essential libraries for IBM Q\n",
31-
"from qiskit import IBMQ, BasicAer\n",
32-
"from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit"
32+
"from qiskit import IBMQ, BasicAer, ClassicalRegister, QuantumCircuit, QuantumRegister"
3333
]
3434
},
3535
{
@@ -122,26 +122,27 @@
122122
"metadata": {},
123123
"outputs": [],
124124
"source": [
125+
"# pylint: disable=missing-function-docstring,redefined-outer-name\n",
125126
"def answer(result):\n",
126127
" for key in result.keys():\n",
127128
" state = key\n",
128-
" print('The Quantum 8-ball says:')\n",
129-
" if state == '000':\n",
130-
" print('It is certain.')\n",
131-
" elif state == '001':\n",
132-
" print('Without a doubt.')\n",
133-
" elif state == '010':\n",
134-
" print('Yes - definitely.')\n",
135-
" elif state == '011':\n",
136-
" print('Most likely.')\n",
137-
" elif state == '100':\n",
129+
" print(\"The Quantum 8-ball says:\")\n",
130+
" if state == \"000\":\n",
131+
" print(\"It is certain.\")\n",
132+
" elif state == \"001\":\n",
133+
" print(\"Without a doubt.\")\n",
134+
" elif state == \"010\":\n",
135+
" print(\"Yes - definitely.\")\n",
136+
" elif state == \"011\":\n",
137+
" print(\"Most likely.\")\n",
138+
" elif state == \"100\":\n",
138139
" print(\"Don't count on it.\")\n",
139-
" elif state == '101':\n",
140-
" print('My reply is no.')\n",
141-
" elif state == '110':\n",
142-
" print('Very doubtful.')\n",
140+
" elif state == \"101\":\n",
141+
" print(\"My reply is no.\")\n",
142+
" elif state == \"110\":\n",
143+
" print(\"Very doubtful.\")\n",
143144
" else:\n",
144-
" print('Concentrate and ask again.')"
145+
" print(\"Concentrate and ask again.\")"
145146
]
146147
},
147148
{
@@ -175,8 +176,10 @@
175176
}
176177
],
177178
"source": [
178-
"from qiskit import execute\n",
179-
"job = execute(qc, backend=BasicAer.get_backend('qasm_simulator'), shots=1)\n",
179+
"# pylint: disable=wrong-import-position\n",
180+
"from qiskit import execute # noqa: E402\n",
181+
"\n",
182+
"job = execute(qc, backend=BasicAer.get_backend(\"qasm_simulator\"), shots=1)\n",
180183
"result = job.result().get_counts(qc)\n",
181184
"answer(result)"
182185
]
@@ -226,10 +229,12 @@
226229
}
227230
],
228231
"source": [
232+
"# pylint: disable=wrong-import-position\n",
229233
"# define the least busy device\n",
230-
"from qiskit.providers.ibmq import least_busy\n",
234+
"from qiskit.providers.ibmq import least_busy # noqa: E402\n",
235+
"\n",
231236
"backend = least_busy(IBMQ.backends(simulator=False))\n",
232-
"print(\"The least busy device:\",backend.name())"
237+
"print(\"The least busy device:\", backend.name())"
233238
]
234239
},
235240
{

0 commit comments

Comments
 (0)