Skip to content

Commit 93c17d9

Browse files
authored
Add configuration files for various linter programs we commonly use (#375)
* Add jsonlint config file * Add markdownlint config file * Add shellcheck config file * Add yamllint config file * qsim → ReCirq
1 parent 01d0706 commit 93c17d9

File tree

4 files changed

+197
-0
lines changed

4 files changed

+197
-0
lines changed

.jsonlintrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"comments": false,
3+
"compact": true,
4+
"continue": true,
5+
"no-duplicate-keys": true,
6+
"endOfLine": "lf",
7+
"indent": 2,
8+
"log-files": false,
9+
"patterns": ["**/*.json"],
10+
"singleQuote": false,
11+
"trailing-commas": false
12+
}

.markdownlintrc

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
{ // Summary: markdownlint config file. -*- jsonc -*-
2+
//
3+
// Note: there are multiple programs programs named "markdownlint". For
4+
// ReCirq, we use https://github.com/igorshubovych/markdownlint-cli/, which
5+
// is the one you get with "brew install markdownlint" on MacOS.
6+
//
7+
// These settings try to stay close to the Google Markdown Style as
8+
// described at https://google.github.io/styleguide/docguide/style.html
9+
//
10+
// For a list of configuration options, see the following page:
11+
// https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
12+
// (Beware that the above looks similar but is NOT the same as the page
13+
// https://github.com/markdownlint/markdownlint/blob/main/docs/RULES.md.)
14+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15+
16+
"$schema": "https://raw.githubusercontent.com/DavidAnson/markdownlint/main/schema/markdownlint-config-schema.json",
17+
18+
// Require ATX-style headings.
19+
// https://google.github.io/styleguide/docguide/style.html#atx-style-headings
20+
"headings": {
21+
"style": "atx"
22+
},
23+
24+
// Google style does not require that the first line of a file is a heading
25+
// for the title; it only states that the first heading should be a level 1.
26+
// https://google.github.io/styleguide/docguide/style.html#document-layout
27+
"first-line-heading": false,
28+
29+
// The Google style does not define what to do about trailing punctuation in
30+
// headings. The markdownlint default disallows exclamation points, which
31+
// seems likely to be more annoying than useful – I have definitely seen
32+
// people use exclamation points in headings in README files on GitHub.
33+
// This setting removes exclamation point from the banned characters.
34+
"no-trailing-punctuation": {
35+
"punctuation": ".,;:。,;:"
36+
},
37+
38+
// No trailing spaces.
39+
// https://google.github.io/styleguide/docguide/style.html#trailing-whitespace
40+
"whitespace": {
41+
"br_spaces": 0
42+
},
43+
44+
// Google style exempts some constructs from the line-length limit of 80 chars.
45+
// https://google.github.io/styleguide/docguide/style.html#exceptions
46+
"line-length": {
47+
"code_blocks": false,
48+
"headings": false,
49+
"tables": false
50+
},
51+
52+
// Google Markdown style specifies 2 spaces after item numbers, 3 spaces
53+
// after bullets, so that the text itself is consistently indented 4 spaces.
54+
// https://google.github.io/styleguide/docguide/style.html#nested-list-spacing
55+
"list-marker-space": {
56+
"ol_multi": 2,
57+
"ol_single": 2,
58+
"ul_multi": 3,
59+
"ul_single": 3
60+
},
61+
62+
"ul-indent": {
63+
"indent": 4
64+
},
65+
66+
// Bare URLs are allowed in GitHub-flavored Markdown and in Google’s style.
67+
"no-bare-urls": false,
68+
69+
// 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.
82+
"html": {
83+
"allowed_elements": [
84+
"a",
85+
"abbr",
86+
"b",
87+
"bdo",
88+
"blockquote",
89+
"br",
90+
"caption",
91+
"cite",
92+
"code",
93+
"dd",
94+
"del",
95+
"details",
96+
"dfn",
97+
"div",
98+
"dl",
99+
"dt",
100+
"em",
101+
"figcaption",
102+
"figure",
103+
"h1",
104+
"h2",
105+
"h3",
106+
"h4",
107+
"h5",
108+
"h6",
109+
"h7",
110+
"h8",
111+
"hr",
112+
"i",
113+
"img",
114+
"ins",
115+
"kbd",
116+
"li",
117+
"mark",
118+
"ol",
119+
"p",
120+
"picture",
121+
"pre",
122+
"q",
123+
"rp",
124+
"rt",
125+
"ruby",
126+
"s",
127+
"samp",
128+
"small",
129+
"source",
130+
"span",
131+
"span",
132+
"strike",
133+
"strong",
134+
"sub",
135+
"summary",
136+
"sup",
137+
"table",
138+
"tbody",
139+
"td",
140+
"tfoot",
141+
"th",
142+
"thead",
143+
"time",
144+
"tr",
145+
"tt",
146+
"ul",
147+
"var",
148+
"video",
149+
"wbr"
150+
]
151+
}
152+
}

.shellcheckrc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Summary: config file for shellcheck program.
2+
#
3+
# The following page includes information about the .shellcheckrc file:
4+
# https://github.com/koalaman/shellcheck/wiki/Directive#shellcheckrc-file
5+
#
6+
# Optional settings can be discovered by running "shellcheck --list-optional".
7+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8+
9+
# We use bash for all the scripts, so tell shellcheck to assume this dialect.
10+
shell=bash
11+
12+
# Makes shellcheck include files pointed-to by the source or . statements.
13+
external-sources=true
14+
15+
# Enable check for when a script uses "set -e" but a construct may disable it.
16+
enable=check-set-e-suppressed
17+
18+
# Enable check for tests like [ "$var" ], which are best written [ -n "$var" ].
19+
enable=avoid-nullary-conditions

.yamllint.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Summary: yamllint configuration.
2+
# See https://yamllint.readthedocs.io/ for info about configuration options.
3+
4+
rules:
5+
line-length:
6+
# YAML files (especially GitHub Actions workflows) tend to end up with
7+
# long lines. The default of 80 is pretty limiting, and besides, in Python
8+
# code linting, we set line lengths to 100. May as well follow suit here.
9+
max: 100
10+
# Another common occurrence in YAML files is long URLs. The next two
11+
# settings are not specific to URLs, but help. It saves developer time by
12+
# not requiring comment directives to disable warnings at every occurrence.
13+
allow-non-breakable-words: true
14+
allow-non-breakable-inline-mappings: true

0 commit comments

Comments
 (0)