Skip to content

Commit 4bdf21f

Browse files
mhuckapavoljuhas
andauthored
Add missing license files & do minor updates to dot files (#7161)
* Add missing license headers Apparently I misread guidance somewhere, and license headers are required for these sorts of files after all. * Revise to address comments in review This removes unnecessary or unused content, in response to review comments on PR #7161. * Change copyright to refer to Cirq Developers * 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. * Change copyright to refer to Cirq Developers * Add temp max_line_length value for TS linter The typescript linter looks at max_line_length and takes it into account if it finds a value. This is causing CI checks to fail. We need to reformat the sources in question and then we can remove this setting again * Shorten the file header --------- Co-authored-by: Pavol Juhas <[email protected]>
1 parent 2bfa1cd commit 4bdf21f

File tree

6 files changed

+138
-42
lines changed

6 files changed

+138
-42
lines changed

.editorconfig

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,54 @@
1-
# Summary: coding style configuration for editors that read .editorconfig.
1+
# Copyright 2025 The Cirq Developers
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+
[{*.ts,*.js}]
35+
# Google style guidelines use 2.
36+
indent_size = 2
37+
# TODO: remove the next setting after reformatting TypeScript code.
38+
max_line_length = 0
39+
40+
[*.json]
41+
# Not stated explicitly in Google's guidelines, but the examples use 2.
42+
indent_size = 2
1543

1644
[*.py]
45+
# Google style guidelines use 4.
1746
indent_size = 4
18-
indent_style = space
19-
max_line_length = 100
2047

2148
[*.sh]
49+
# Google style guidelines use 2.
2250
indent_size = 4
23-
indent_style = space
24-
max_line_length = 100
2551

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

.github/workflows/first-interaction.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
1-
# Summary: add a welcoming comment to first-time contributors' issues & PRs.
1+
# Copyright 2025 The Cirq Developers
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+
# Add a welcoming comment to first-time contributors' issues & PRs.
217
# This is written in a generic way so that we can use the same workflow
318
# in all our quantumlib repos.
419
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.github/workflows/pytest-debug.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
1+
# Copyright 2025 The Cirq Developers
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
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2-
# Summary: GitHub workflow for manually running pytest with debug flags.
16+
# GitHub workflow for manually running pytest with debug flags.
317
#
418
# This workflow can only be executed manually, e.g., using the "Run workflow"
519
# button on https://github.com/quantumlib/Cirq/actions/workflows/debug.yaml

.github/workflows/stale.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
1-
# Summary: perform scheduled handling of stale issues and PRs.
2-
# For more info, see https://github.com/actions/stale/.
1+
# Copyright 2025 The Cirq Developers
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+
# Perform scheduled handling of stale issues and PRs.
17+
# For info about possible config options, see https://github.com/actions/stale/.
18+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
319

420
name: "Stale issues & PRs handler"
521

.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 Cirq -*- jsonc -*-
1+
{ // -*- jsonc -*-
2+
// Copyright 2025 The Cirq Developers
23
//
3-
// Note: there are multiple programs programs named "markdownlint". For
4-
// Cirq, we use https://github.com/igorshubovych/markdownlint-cli/, which is
5-
// 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 for Cirq.
1+
# Copyright 2025 The Cirq Developers
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)