Skip to content

Commit c5ebab2

Browse files
afq984Chromeos LUCI
authored and
Chromeos LUCI
committedFeb 7, 2023
PRESUBMIT.cfg: Add cros format
- This and black does the same thing. Remove black. - C/C++ is covered by clang_format_check for now. - This also covers Bazel BUILD files. BUG=b:245439871 TEST=repo upload Change-Id: Ib42aaa3fd410898bbe08336e34d96f390380cbe1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/4224854 Reviewed-by: Chih-Yang Hsia <[email protected]> Commit-Queue: Chih-Yang Hsia <[email protected]> Commit-Queue: Li-Yu Yu <[email protected]> Auto-Submit: Li-Yu Yu <[email protected]> Tested-by: Li-Yu Yu <[email protected]>
1 parent bf44742 commit c5ebab2

27 files changed

+124
-122
lines changed
 

‎LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2021 The ChromiumOS Authors
1+
Copyright 2021 The ChromiumOS Authors
22

33
Redistribution and use in source and binary forms, with or without
44
modification, are permitted provided that the following conditions are

‎LICENSE.DBUS

+35-30
Original file line numberDiff line numberDiff line change
@@ -171,40 +171,40 @@ license without modification. This license may not be modified without
171171
the express written permission of its copyright owner.
172172

173173

174-
--
175-
END OF ACADEMIC FREE LICENSE. The following is intended to describe the essential
176-
differences between the Academic Free License (AFL) version 1.0 and other
174+
--
175+
END OF ACADEMIC FREE LICENSE. The following is intended to describe the essential
176+
differences between the Academic Free License (AFL) version 1.0 and other
177177
open source licenses:
178178

179-
The Academic Free License is similar to the BSD, MIT, UoI/NCSA and Apache
180-
licenses in many respects but it is intended to solve a few problems with
179+
The Academic Free License is similar to the BSD, MIT, UoI/NCSA and Apache
180+
licenses in many respects but it is intended to solve a few problems with
181181
those licenses.
182-
183-
* The AFL is written so as to make it clear what software is being
184-
licensed (by the inclusion of a statement following the copyright notice
185-
in the software). This way, the license functions better than a template
182+
183+
* The AFL is written so as to make it clear what software is being
184+
licensed (by the inclusion of a statement following the copyright notice
185+
in the software). This way, the license functions better than a template
186186
license. The BSD, MIT and UoI/NCSA licenses apply to unidentified software.
187-
188-
* The AFL contains a complete copyright grant to the software. The BSD
187+
188+
* The AFL contains a complete copyright grant to the software. The BSD
189189
and Apache licenses are vague and incomplete in that respect.
190-
191-
* The AFL contains a complete patent grant to the software. The BSD, MIT,
192-
UoI/NCSA and Apache licenses rely on an implied patent license and contain
190+
191+
* The AFL contains a complete patent grant to the software. The BSD, MIT,
192+
UoI/NCSA and Apache licenses rely on an implied patent license and contain
193193
no explicit patent grant.
194-
195-
* The AFL makes it clear that no trademark rights are granted to the
196-
licensor's trademarks. The Apache license contains such a provision, but the
194+
195+
* The AFL makes it clear that no trademark rights are granted to the
196+
licensor's trademarks. The Apache license contains such a provision, but the
197197
BSD, MIT and UoI/NCSA licenses do not.
198-
199-
* The AFL includes the warranty by the licensor that it either owns the
200-
copyright or that it is distributing the software under a license. None of
201-
the other licenses contain that warranty. All other warranties are disclaimed,
198+
199+
* The AFL includes the warranty by the licensor that it either owns the
200+
copyright or that it is distributing the software under a license. None of
201+
the other licenses contain that warranty. All other warranties are disclaimed,
202202
as is the case for the other licenses.
203203

204-
* The AFL is itself copyrighted (with the right granted to copy and distribute
205-
without modification). This ensures that the owner of the copyright to the
206-
license will control changes. The Apache license contains a copyright notice,
207-
but the BSD, MIT and UoI/NCSA licenses do not.
204+
* The AFL is itself copyrighted (with the right granted to copy and distribute
205+
without modification). This ensures that the owner of the copyright to the
206+
license will control changes. The Apache license contains a copyright notice,
207+
but the BSD, MIT and UoI/NCSA licenses do not.
208208
--
209209
START OF GNU GENERAL PUBLIC LICENSE
210210
--
@@ -267,7 +267,8 @@ patent must be licensed for everyone's free use or not licensed at all.
267267

268268
The precise terms and conditions for copying, distribution and
269269
modification follow.
270-
270+
271+
271272
GNU GENERAL PUBLIC LICENSE
272273
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
273274

@@ -322,7 +323,8 @@ above, provided that you also meet all of these conditions:
322323
License. (Exception: if the Program itself is interactive but
323324
does not normally print such an announcement, your work based on
324325
the Program is not required to print an announcement.)
325-
326+
327+
326328
These requirements apply to the modified work as a whole. If
327329
identifiable sections of that work are not derived from the Program,
328330
and can be reasonably considered independent and separate works in
@@ -380,7 +382,8 @@ access to copy from a designated place, then offering equivalent
380382
access to copy the source code from the same place counts as
381383
distribution of the source code, even though third parties are not
382384
compelled to copy the source along with the object code.
383-
385+
386+
384387
4. You may not copy, modify, sublicense, or distribute the Program
385388
except as expressly provided under this License. Any attempt
386389
otherwise to copy, modify, sublicense or distribute the Program is
@@ -437,7 +440,8 @@ impose that choice.
437440

438441
This section is intended to make thoroughly clear what is believed to
439442
be a consequence of the rest of this License.
440-
443+
444+
441445
8. If the distribution and/or use of the Program is restricted in
442446
certain countries either by patents or by copyrighted interfaces, the
443447
original copyright holder who places the Program under this License
@@ -490,7 +494,8 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
490494
POSSIBILITY OF SUCH DAMAGES.
491495

492496
END OF TERMS AND CONDITIONS
493-
497+
498+
494499
How to Apply These Terms to Your New Programs
495500

496501
If you develop a new program, and you want it to be of the greatest

‎PRESUBMIT.cfg

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[Hook Scripts]
22
xmllint: cras/dbus_bindings/xmllint.py --ignore-non-dbus-xml-files ${PRESUBMIT_FILES}
33
check-include-guards: devtools/check-include-guards.py ${PRESUBMIT_FILES}
4+
cros format: cros format --exclude="*.c" --exclude="*.cc" --exclude="*.h" -- ${PRESUBMIT_FILES}
45

56
[Hook Overrides]
67
tab_check: false
78
clang_format_check: true
89
cargo_clippy_check: true
9-
black_check: true
1010

1111
# On by default, but required for options below.
1212
cros_license_check: true
@@ -26,5 +26,7 @@ cargo_clippy_check:
2626
--project=cras/client/cras_tests
2727
--project=cras/client/libcras
2828
long_line_check:
29+
--exclude_regex=.*\.py$
30+
--exclude_regex=^cras/scripts/asoc_dapm_graph$
2931
--exclude_regex=.+\.policy
3032
--exclude_regex=.*\.[ch]$

‎cras/client/cras-sys/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,3 @@ serde = "1.0.125"
1414
[patch.crates-io] # ignored by ebuild
1515
audio_streams = { path = "../../../../../../chroot/usr/lib/cros_rust_registry/registry/audio_streams-0.1.0/" } # ignored by ebuild
1616
data_model = { path = "../../../../../../chroot/usr/lib/cros_rust_registry/registry/data_model-0.1.50/" } # ignored by ebuild
17-

‎cras/client/cras-sys/src/lib.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,11 @@ impl fmt::Display for AudioDevDebugInfo {
446446
writeln!(f, " Frame rate: {}", self.frame_rate)?;
447447
writeln!(f, " Number of channels: {}", self.num_channels)?;
448448
writeln!(f, " Estimated rate ratio: {:.2}", self.est_rate_ratio)?;
449-
writeln!(f, " Estimated rate ratio: {:.2}", self.est_rate_ratio_when_underrun)?;
449+
writeln!(
450+
f,
451+
" Estimated rate ratio: {:.2}",
452+
self.est_rate_ratio_when_underrun
453+
)?;
450454
writeln!(f, " Underrun count: {}", self.num_underruns)?;
451455
writeln!(f, " Severe underrun count: {}", self.num_severe_underruns)?;
452456
writeln!(f, " Highest hardware level: {}", self.highest_hw_level)?;

‎cras/dbus_bindings/xmllint.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env vpython3
2-
32
# Copyright 2021 The ChromiumOS Authors
43
# Use of this source code is governed by a BSD-style license that can be
54
# found in the LICENSE file.

‎cras/rules_rust_stub/WORKSPACE.bazel

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# Copyright 2023 The ChromiumOS Authors
22
# Use of this source code is governed by a BSD-style license that can be
33
# found in the LICENSE file.
4-
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# Copyright 2023 The ChromiumOS Authors
22
# Use of this source code is governed by a BSD-style license that can be
33
# found in the LICENSE file.
4-

‎cras/rules_rust_stub/rust/BUILD.bazel

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# Copyright 2023 The ChromiumOS Authors
22
# Use of this source code is governed by a BSD-style license that can be
33
# found in the LICENSE file.
4-

‎cras/scripts/asoc_dapm_graph

+52-50
Original file line numberDiff line numberDiff line change
@@ -10,85 +10,87 @@ To generate widget status for a device run
1010
"""
1111

1212
from __future__ import print_function
13+
1314
import os
1415
import platform
1516
import re
1617
import sys
1718
import time
1819

20+
1921
ROOTDIR = '/sys/kernel/debug/asoc/'
2022
# Some widget names are widely used by many codecs, adding them to the graph
2123
# creates a mess.
2224
IGNORE_WIDGETS = ('Playback', 'Capture', 'bias_level')
2325

2426

2527
def handle_widgets(path):
26-
"""Reads DAPM widget information from sysfs and generates dot graph entry.
28+
"""Reads DAPM widget information from sysfs and generates dot graph entry.
2729
28-
Args:
29-
path: path for sysfs file that exports information about DAPM widget.
30-
"""
31-
for w in os.listdir(path):
32-
if w in IGNORE_WIDGETS:
33-
continue
30+
Args:
31+
path: path for sysfs file that exports information about DAPM widget.
32+
"""
33+
for w in os.listdir(path):
34+
if w in IGNORE_WIDGETS:
35+
continue
3436

35-
with open(os.path.join(path, w)) as f:
36-
lines = f.readlines()
37+
with open(os.path.join(path, w)) as f:
38+
lines = f.readlines()
3739

38-
active = lines[0].startswith(w + ': On ')
39-
color = 'green' if active else 'red'
40-
print('\t"%s" [color = %s]' % (w, color))
40+
active = lines[0].startswith(w + ': On ')
41+
color = 'green' if active else 'red'
42+
print('\t"%s" [color = %s]' % (w, color))
4143

42-
for l in lines[1:]:
43-
l = l.rstrip()
44-
# The string format is (in/out) "switch" "widget".
45-
edge = list(filter(None, re.split(r' (in|out) "(.+)" "(.+)"', l)))
44+
for l in lines[1:]:
45+
l = l.rstrip()
46+
# The string format is (in/out) "switch" "widget".
47+
edge = list(filter(None, re.split(r' (in|out) "(.+)" "(.+)"', l)))
4648

47-
if len(edge) != 3:
48-
continue
49+
if len(edge) != 3:
50+
continue
4951

50-
direction = edge[0]
51-
source = edge[2]
52+
direction = edge[0]
53+
source = edge[2]
5254

53-
if source in IGNORE_WIDGETS:
54-
continue
55+
if source in IGNORE_WIDGETS:
56+
continue
5557

56-
# We need to output the edge only once (e.g. inbound).
57-
if direction != 'in':
58-
continue
58+
# We need to output the edge only once (e.g. inbound).
59+
if direction != 'in':
60+
continue
5961

60-
print('\t"%s" -> "%s"' % (source, w))
62+
print('\t"%s" -> "%s"' % (source, w))
6163

6264

6365
def handle_card(path):
64-
"""Generates dot graph file for the given card.
65-
66-
Args:
67-
path: path to sysfs directory that exports DAPM information for a sound card.
68-
"""
69-
host = platform.uname()[1]
70-
print('// Generated %s at %s.' % (time.strftime("%c"), host))
71-
print('// To visualize the graph run "dot -Kfdp -Tpng $SCRIPT_OUTPUT_FILE -o widgets.png".')
72-
print('digraph G {')
73-
print('\tbgcolor = grey')
74-
for root, dirs, files in os.walk(path):
75-
if 'dapm' in dirs:
76-
handle_widgets(os.path.join(root, 'dapm'))
77-
dirs.remove('dapm')
78-
print('}')
66+
"""Generates dot graph file for the given card.
67+
68+
Args:
69+
path: path to sysfs directory that exports DAPM information for a sound card.
70+
"""
71+
host = platform.uname()[1]
72+
print('// Generated %s at %s.' % (time.strftime("%c"), host))
73+
print('// To visualize the graph run "dot -Kfdp -Tpng $SCRIPT_OUTPUT_FILE -o widgets.png".')
74+
print('digraph G {')
75+
print('\tbgcolor = grey')
76+
for root, dirs, files in os.walk(path):
77+
if 'dapm' in dirs:
78+
handle_widgets(os.path.join(root, 'dapm'))
79+
dirs.remove('dapm')
80+
print('}')
7981

8082

8183
def main(argv):
82-
for c in os.listdir(ROOTDIR):
83-
path = os.path.join(ROOTDIR, c)
84-
# We assume that directories in ROOTDIR are cards.
85-
if os.path.isdir(path):
86-
handle_card(path)
87-
sys.exit(0)
84+
for c in os.listdir(ROOTDIR):
85+
path = os.path.join(ROOTDIR, c)
86+
# We assume that directories in ROOTDIR are cards.
87+
if os.path.isdir(path):
88+
handle_card(path)
89+
sys.exit(0)
8890

89-
print('No cards found', file=sys.stderr)
90-
sys.exit(1)
91+
print('No cards found', file=sys.stderr)
92+
sys.exit(1)
9193

9294

9395
if __name__ == '__main__':
94-
main(sys.argv[1:])
96+
main(sys.argv[1:])

‎cras/src/plc/parse_sco.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Copyright 2020 The ChromiumOS Authors
33
# Use of this source code is governed by a BSD-style license that can be
44
# found in the LICENSE file.
5+
56
"""
67
A script to extract raw SCO RX packets from btsnoop.
78
Use 'btmon -S' to dump SCO traffic from btsnoop file.

‎cras/src/tests/.clang-format

-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ ForEachMacros:
1111
- 'DL_FOREACH_INTERNAL'
1212
- 'LL_FOREACH'
1313
- 'LL_FOREACH_SAFE'
14-

‎cras/src/tests/audio_test_gui.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
#!/usr/bin/env python
2-
#
32
# Copyright 2016 The ChromiumOS Authors
43
# Use of this source code is governed by a BSD-style license that can be
54
# found in the LICENSE file.
5+
66
"""Script functions as a web app and wrapper for the cras_router program."""
77

88
import re
99
import subprocess
10+
1011
import cherrypy
1112

13+
1214
# Node Format: [Stable_Id, ID, Vol/Gain, UI, Plugged, L/R_swapped, Time,
1315
# Hotword, Type, MaxCha, Name]
1416
ID_INDEX = 1

‎cras/tools/create_volume_curve.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/python
2-
#
32
# Copyright 2012 The ChromiumOS Authors
43
# Use of this source code is governed by a BSD-style license that can be
54
# found in the LICENSE file.

‎cras/tools/generate_dbus_bindings_h.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/python3
2-
#
32
# Copyright 2022 The ChromiumOS Authors
43
# Use of this source code is governed by a BSD-style license that can be
54
# found in the LICENSE file.

‎cros_alsa/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ alsa-sys = "0.2.0"
1010
cros_alsa_derive = { path = "cros_alsa_derive" } # provided by ebuild
1111
libc = "0.2.65"
1212
log = "0.4"
13-
remain = "0.2.1"
13+
remain = "0.2.1"

‎devtools/audio_thread_log_viewer/viewer_c3.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#!/usr/bin/python
2-
#
32
# Copyright 2016 The ChromiumOS Authors
43
# Use of this source code is governed by a BSD-style license that can be
54
# found in the LICENSE file.
6-
#
75

86
"""Generates an HTML file with plot of buffer level in the audio thread log."""
97

@@ -13,6 +11,7 @@
1311
import string
1412
import time
1513

14+
1615
page_content = string.Template(
1716
"""
1817
<html meta charset="UTF8">

‎devtools/audio_tuning/conf2ini.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/python3
2-
#
32
# Copyright 2021 The ChromiumOS Authors
43
# Use of this source code is governed by a BSD-style license that can be
54
# found in the LICENSE file.
@@ -18,6 +17,7 @@
1817
import sys
1918
from typing import List
2019

20+
2121
biquad_type_name = [
2222
"none",
2323
"lowpass",

‎devtools/audio_tuning/conf2ini2.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/python3
2-
#
32
# Copyright 2021 The ChromiumOS Authors
43
# Use of this source code is governed by a BSD-style license that can be
54
# found in the LICENSE file.

‎devtools/check-include-guards.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python3
2-
32
# Copyright 2022 The ChromiumOS Authors
43
# Use of this source code is governed by a BSD-style license that can be
54
# found in the LICENSE file.
@@ -10,8 +9,8 @@
109
# instead.
1110

1211
import os
13-
import sys
1412
import string
13+
import sys
1514

1615

1716
fail = False

‎devtools/ini_editor.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/python
2-
#
32
# Copyright 2014 The ChromiumOS Authors
43
# Use of this source code is governed by a BSD-style license that can be
54
# found in the LICENSE file.
@@ -12,12 +11,13 @@
1211
"""
1312

1413
import argparse
14+
from collections import namedtuple
15+
import io
1516
import logging
1617
import os
1718
import re
18-
import io
1919
import sys
20-
from collections import namedtuple
20+
2121

2222
Parameter = namedtuple('Parameter', ['value', 'comment'])
2323

‎devtools/ini_editor_unittest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# Use of this source code is governed by a BSD-style license that can be
44
# found in the LICENSE file.
55

6-
76
"""Unittest for ini_editor.py."""
87

98

@@ -15,6 +14,7 @@
1514

1615
from ini_editor import Ini
1716

17+
1818
SAMPLE_INI = """\
1919
[output_source]
2020
library=builtin

‎devtools/ucmlint/draft_comments.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
#!/usr/bin/env python3
2-
#
32
# Copyright 2022 The ChromiumOS Authors
43
# Use of this source code is governed by a BSD-style license that can be
54
# found in the LICENSE file.
65

76
import argparse
7+
import http.cookiejar
8+
import http.cookies
9+
import json
810
import logging
911
import os
10-
import json
11-
import urllib.request
1212
import urllib.parse
13-
import http.cookies
14-
import http.cookiejar
13+
import urllib.request
1514

1615
import lint_cl
1716

‎devtools/ucmlint/lint_cl.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
#!/usr/bin/env python3
2-
#
32
# Copyright 2022 The ChromiumOS Authors
43
# Use of this source code is governed by a BSD-style license that can be
54
# found in the LICENSE file.
65

76
import contextlib
7+
import http.client
8+
import json
89
import logging
10+
import os
11+
import re
912
import subprocess
10-
import http.client
1113
import tempfile
12-
import re
1314
from typing import Optional, Union
14-
import urllib.request
1515
import urllib.parse
16-
import json
17-
import os
16+
import urllib.request
1817

1918
import ucmlint
2019

‎devtools/ucmlint/ucmlint.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python3
2-
#
32
# Copyright 2022 The ChromiumOS Authors
43
# Use of this source code is governed by a BSD-style license that can be
54
# found in the LICENSE file.
@@ -10,14 +9,14 @@
109

1110
from __future__ import annotations
1211

12+
import argparse
1313
import collections
14+
import dataclasses
1415
import difflib
16+
import enum
17+
import logging
1518
import os
1619
import pathlib
17-
import argparse
18-
import logging
19-
import enum
20-
import dataclasses
2120
from typing import List, Optional
2221

2322

‎devtools/vscode_remote_gdb_server.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
# Use of this source code is governed by a BSD-style license that can be
44
# found in the LICENSE file.
55

6-
import sys
76
import argparse
87
import json
98
import os
109
from pathlib import Path
10+
import sys
1111

12-
from chromite.lib import toolchain
1312
from chromite.lib import remote_access
13+
from chromite.lib import toolchain
1414

1515

1616
class VscodeConfig:

‎sound_card_init/seccomp/sound_card_init-seccomp-arm64.policy

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ socket: arg0 == AF_UNIX
5151
socketpair: 1
5252
statx: 1
5353
tgkill: 1
54-
write: 1
54+
write: 1

0 commit comments

Comments
 (0)
Please sign in to comment.