Code Formatting Considerations for Quantum Computing Applications
Develop formatting standards tailored to the unique requirements of quantum computing code.
0 likes
187 views
Rule Content
{
"rules": [
{
"name": "quantum-code-formatting",
"description": "Enforce formatting standards tailored to quantum computing code.",
"applyTo": "**/*.{qasm,qsharp,py}",
"rules": [
{
"name": "indentation",
"description": "Use 4 spaces for indentation; tabs are prohibited.",
"severity": "error"
},
{
"name": "line-length",
"description": "Limit lines to a maximum of 80 characters.",
"severity": "warning"
},
{
"name": "brace-placement",
"description": "Place opening braces on the same line as the statement.",
"severity": "error"
},
{
"name": "whitespace",
"description": "Remove trailing whitespace at the end of lines.",
"severity": "warning"
},
{
"name": "naming-conventions",
"description": "Use lowercase letters for identifiers; avoid underscores.",
"severity": "error"
},
{
"name": "comment-style",
"description": "Use single-line comments for brief explanations; multi-line comments for detailed descriptions.",
"severity": "warning"
},
{
"name": "header-comment",
"description": "Include a header comment in each file with the file name, author, and brief description.",
"severity": "warning"
},
{
"name": "function-docstrings",
"description": "Provide docstrings for all functions and methods.",
"severity": "error"
},
{
"name": "import-order",
"description": "Organize imports: standard libraries first, followed by third-party libraries, then local modules.",
"severity": "warning"
},
{
"name": "quantum-specific-conventions",
"description": "Follow quantum-specific conventions, such as using 'qreg' for quantum registers in OpenQASM.",
"severity": "error"
}
]
}
]
}