Skip to content

Commit f1446a0

Browse files
authored
Do minor updates to dot files and add license headers (#1598)
* Add license header * Update to current common version Changes: - Add license header - Add line length setting - Reduce allowed raw HTML elements This version matches the current common version of the file I've been adding to the Quantumlib repos. * Update to current common version Changes: - Add license header - Add more settings - Adjust settings to match (apparent) Qualtran project conventions Except for the changed settings, this version of the file matches the current common version of the file I've been adding to the Quantumlib repos. * Add back max_line_length setting After more discussion, the conclusion is that despite the issues with `max_line_length`, it is handled as expected in the editors that many people have been using.
1 parent b8776a5 commit f1446a0

3 files changed

Lines changed: 99 additions & 38 deletions

File tree

.editorconfig

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,64 @@
1-
# Summary: coding style configuration for editors that read .editorconfig.
1+
# Copyright 2025 Google LLC
22
#
3-
# 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/.
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.
17+
#
18+
# EditorConfig is a file format for specifying some common style parameters.
19+
# Many IDEs & editors read .editorconfig files, either natively or via plugins.
20+
# We mostly follow Google's style guides (https://google.github.io/styleguide/)
21+
# with only a few deviations for line length and indentation in some files.
22+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
623

724
root = true
825

926
[*]
1027
charset = utf-8
11-
end_of_line = lf
28+
indent_style = space
1229
insert_final_newline = true
1330
spelling_language = en-US
1431
trim_trailing_whitespace = true
32+
max_line_length = 100
33+
34+
[{BUILD,*.BUILD,*.bzl,*.bazel,.bazelrc}]
35+
# Google doesn't have a style guideline for Bazel files. Most people use 4.
36+
indent_size = 4
37+
38+
[{*.cc,*.h}]
39+
# Google style guidelines use 2.
40+
indent_size = 2
41+
42+
[{*.js,*.ts}]
43+
# Google style guidelines use 2.
44+
indent_size = 2
45+
46+
[*.json]
47+
# Not stated explicitly in Google's guidelines, but the examples use 2.
48+
indent_size = 2
1549

1650
[*.py]
51+
# Google style guidelines use 4.
1752
indent_size = 4
18-
indent_style = space
19-
max_line_length = 100
53+
54+
[*.rst]
55+
# Google doesn't have a style guideline for reStructuredText. Many people use 3.
56+
indent_size = 3
2057

2158
[*.sh]
59+
# Google style guidelines use 2.
2260
indent_size = 4
23-
indent_style = space
24-
max_line_length = 100
2561

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

.markdownlintrc

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,28 @@
1-
{ // Summary: markdownlint config file for Qualtran -*- jsonc -*-
1+
{ // -*- jsonc -*-
2+
// Copyright 2025 Google LLC
23
//
3-
// Note: there are multiple programs programs named "markdownlint". For
4-
// Qualtran, we use https://github.com/igorshubovych/markdownlint-cli/, which
5-
// is the one you get with "brew install markdownlint" on MacOS.
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.
18+
//
19+
// Note: there are multiple programs programs named "markdownlint". We use
20+
// https://github.com/igorshubovych/markdownlint-cli/, which is the one you
21+
// 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
}

.yamllint.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
1-
# Summary: yamllint configuration.
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+
# Yamllint configuration to match project settings like line length.
217
# See https://yamllint.readthedocs.io/ for info about configuration options.
18+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
319

420
rules:
521
line-length:

0 commit comments

Comments
 (0)