Skip to content

Commit c467f64

Browse files
authored
Merge branch 'master' into mh-fix-contributing.md
2 parents 087d411 + e897cc7 commit c467f64

13 files changed

Lines changed: 281 additions & 43 deletions

.editorconfig

Lines changed: 76 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,94 @@
1-
# Summary: coding style configuration for editors that read .editorconfig.
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16+
# Common editor configurations for this project.
217
#
318
# EditorConfig defines a file format for specifying some common coding style
4-
# parameters. Many editors recognize .editorconfig files automatically, and
5-
# there exist plugins for other editors. See https://spec.editorconfig.org/.
19+
# parameters. Many IDEs and editors read .editorconfig files, either natively
20+
# or via plugins. A few formatters also read .editorconfig; shfmt and Prettier
21+
# are two examples (as of early 2025).
22+
#
23+
# We mostly follow Google's style guides (https://google.github.io/styleguide/)
24+
# with very few deviations.
25+
#
26+
# Miscellaneous notes:
27+
#
28+
# - The EditorConfig property `max_line_length` is not set here because its
29+
# intended behavior is poorly specified. (See the discussion in the comments
30+
# at https://github.com/editorconfig/editorconfig/issues/387) It *would* have
31+
# been desirable to define a project convention for the line width here, but
32+
# we must instead use editor-specific configuration files to do that.
33+
#
34+
# - With few exceptions (e.g., shfmt), `.editorconfig` files are not read by
35+
# linters or formatters, which means the project needs separate config files
36+
# for those tools. This includes markdownlint, yamllint, and others.
37+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
638

739
root = true
840

941
[*]
1042
charset = utf-8
11-
end_of_line = lf
43+
indent_style = space
1244
insert_final_newline = true
1345
spelling_language = en-US
46+
# It would be preferable not to set tab_width, but some EditorConfig plugins
47+
# (e.g., Emacs's) set it equal to indent_size if it's not set otherwise.
48+
tab_width = 8
49+
# Trailing whitespace on lines is almost always noise. An exception is in
50+
# Markdown, where two spaces = line break; however, that's such a foot-gun in
51+
# practice that we avoid it. So, it's okay to set this next value globally.
1452
trim_trailing_whitespace = true
1553

54+
[{BUILD,*.BUILD,*.bzl,*.bazel}]
55+
# Google doesn't have a style guideline for Bazel files. Most people use 4.
56+
indent_size = 4
57+
58+
[{*.cc,*.h}]
59+
# This matches Google style guidelines.
60+
indent_size = 2
61+
62+
[{*.ts,*.js}]
63+
# This matches Google style guidelines.
64+
indent_size = 2
65+
66+
[*.json]
67+
# Not stated explicitly in Google's guidelines, but the examples use 2.
68+
indent_size = 2
69+
1670
[*.py]
71+
# This matches Google style guidelines.
1772
indent_size = 4
18-
indent_style = space
19-
max_line_length = 100
73+
74+
[*.rst]
75+
# Google doesn't have a style guideline for reStructuredText. Many people use 3.
76+
indent_size = 3
2077

2178
[*.sh]
79+
# Google style guidelines use 2.
2280
indent_size = 4
23-
indent_style = space
24-
max_line_length = 100
81+
# The following are used by shfmt. These bring it closer to Google's style.
82+
binary_next_line = true
83+
shell_variant = bash
84+
space_redirects = true
85+
switch_case_indent = true
86+
87+
# If this repository has a "third_party" directory, ignore it entirely.
88+
# Note: shfmt also respects this if you run it with --appply-ignore.
89+
[third_party/**]
90+
ignore = true
2591

26-
[*.yml,*.yaml]
92+
[{*.yaml,*.yml}]
93+
# Google doesn't have style guidelines for YAML. Most people use indent = 2.
2794
indent_size = 2

.github/workflows/ci.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
1-
# Summary: OpenFermion continuous integration status checks.
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16+
# OpenFermion continuous integration status checks.
217
#
318
# This workflow runs various tests to verify that changes to the OpenFermion
419
# codebase pass validation and conform to project format and style standards.

.github/workflows/codeql.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
116
# Zero-configuration modular workflow to run CodeQL code scans.
217
#
318
# CodeQL is a semantic code analysis tool that finds vulnerabilities by

.github/workflows/nightly-pytest.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
1-
# Summary: reusable workflow called by nightly.yaml.
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16+
# Reusable workflow called by nightly.yaml.
217
# This workflow expects input values passed by nightly.yml.
318
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
419

.github/workflows/nightly.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
1-
# Summary: run nightly tests and scans.
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16+
# Nightly tests and scans workflow.
217
#
318
# This workflow runs nightly to run tests & scans on the OpenFermion codebase.
419
# It can also be invoked manually via the "Run workflow" button at

.github/workflows/osv-scanner.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
116
# Zero-config modular workflow to run Open Source Vulnerabilities code scans.
217
#
318
# The OSV scanner is a dependency vulnerability scanner that identifies known

.github/workflows/scorecard.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
116
# Zero-configuration modular workflow to run the OSSF Scorecard scanner.
217
#
318
# Scorecard (https://github.com/ossf/scorecard) is a repository-scanning tool

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
.DS_Store
216
*lastfailed
317

.hadolint.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
1-
# Summary: configuration for hadolint used in CI checks.
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16+
# Hadolint (Dockerfile linter) used in this project's CI checks.
217
# Info about options can be found at https://github.com/hadolint/hadolint/.
18+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
319

420
format: tty
521
no-color: false

.markdownlintrc

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,28 @@
1-
{ // Summary: markdownlint config file for Quantumlib projects -*- jsonc -*-
1+
{ // -*- jsonc -*-
2+
// Copyright 2025 Google LLC
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// https://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
16+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17+
// Markdownlint linter configuration for this project.
218
//
319
// Note: there are multiple programs programs named "markdownlint". We use
420
// https://github.com/igorshubovych/markdownlint-cli/, which is the one you
521
// get with "brew install markdownlint" on MacOS.
622
//
723
// These settings try to stay close to the Google Markdown Style as
824
// described at https://google.github.io/styleguide/docguide/style.html
25+
// with very few differences.
926
//
1027
// For a list of configuration options, see the following page:
1128
// https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
@@ -41,9 +58,13 @@
4158
"br_spaces": 0
4259
},
4360

44-
// Google style exempts some constructs from the line-length limit of 80 chars.
61+
// Google style is 80 characters.
62+
// Google style exempts some constructs from the line-length limit:
4563
// https://google.github.io/styleguide/docguide/style.html#exceptions
4664
"line-length": {
65+
"line_length": 100,
66+
"code_block_line_length": 100,
67+
"heading_line_length": 100,
4768
"code_blocks": false,
4869
"headings": false,
4970
"tables": false
@@ -67,24 +88,20 @@
6788
"no-bare-urls": false,
6889

6990
// Basic Markdown allows raw HTML. Both GitHub & PyPI support subsets of
70-
// HTML, though it's unclear what subset PyPI supports. Google's style
71-
// guide doesn't disallow using HTML, although it recommends against it. (C.f.
72-
// the bottom of https://google.github.io/styleguide/docguide/style.html)
73-
// It's worth noting, though, that Google's guidance has Google's internal
74-
// documentation system in mind, and that system extends Markdown with
75-
// constructs that make it possible to accomplish things you can't do in
76-
// Markdown. Those extensions are also not available outside Google's system.
77-
// Thus, although a goal of this markdownlint configuration is to match
78-
// Google's style guide as closely as possible, these various factors suggest
79-
// it's reasonable to relax the HTML limitation. The list below is based on
80-
// https://github.com/github/markup/issues/245#issuecomment-682231577 plus
81-
// some things found elsewhere after that was written.
91+
// HTML, though it's unclear what subset PyPI supports. Google's style guide
92+
// recommends against using raw HTML, but does allow it. (C.f. the bottom of
93+
// https://google.github.io/styleguide/docguide/style.html) Google's in-house
94+
// documentation system allows many inline and block-level tags, but strips
95+
// others that can pose security risks (e.g., <object> and standalone <svg>).
96+
// The list below tries to capture the intersection of what GitHub allows
97+
// (c.f. https://github.com/github/markup/issues/245#issuecomment-682231577),
98+
// what PyPI seems to allow, what Google allows, and what seems likely to be
99+
// most useful in situations where someone needs to reach for HTML.
82100
"html": {
83101
"allowed_elements": [
84102
"a",
85103
"abbr",
86104
"b",
87-
"bdo",
88105
"blockquote",
89106
"br",
90107
"caption",
@@ -106,8 +123,6 @@
106123
"h4",
107124
"h5",
108125
"h6",
109-
"h7",
110-
"h8",
111126
"hr",
112127
"i",
113128
"img",
@@ -120,16 +135,10 @@
120135
"picture",
121136
"pre",
122137
"q",
123-
"rp",
124-
"rt",
125-
"ruby",
126138
"s",
127139
"samp",
128140
"small",
129-
"source",
130-
"span",
131141
"span",
132-
"strike",
133142
"strong",
134143
"sub",
135144
"summary",
@@ -145,7 +154,6 @@
145154
"tt",
146155
"ul",
147156
"var",
148-
"video",
149157
"wbr"
150158
]
151159
}

0 commit comments

Comments
 (0)