Skip to content

Commit 75c168d

Browse files
committed
Add license checking, cpplint, clang-format, and cppcheck
1 parent 4dfd0ec commit 75c168d

39 files changed

+2375
-2626
lines changed

.clang-format

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
BasedOnStyle: Google
2+
AllowAllParametersOfDeclarationOnNextLine: true
3+
CommentPragmas: 'NOLINT:.*'
4+
SortIncludes: false
5+
ColumnLimit: 180
6+
AlignConsecutiveMacros: true
7+
AlignConsecutiveAssignments: true

.github/workflows/ci.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: CI
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: TEMPORARY act workaround
10+
run: apt update && apt install zstd
11+
- uses: actions/checkout@v2
12+
- name: Cache pip
13+
uses: actions/cache@v2
14+
with:
15+
path: ~/.cache/pip
16+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
17+
restore-keys: |
18+
${{ runner.os }}-pip-
19+
- name: Cache PlatformIO
20+
uses: actions/cache@v2
21+
with:
22+
path: ~/.platformio
23+
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
24+
- name: Set up Python
25+
uses: actions/setup-python@v2
26+
- name: Install PlatformIO
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install --upgrade platformio
30+
- name: Run PlatformIO
31+
run: pio run

.pre-commit-config.yaml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
exclude: (\.pio|lib/NimBLE-Arduino)/.*
2+
repos:
3+
- repo: https://github.com/Lucas-C/pre-commit-hooks
4+
rev: v1.1.9
5+
hooks:
6+
- id: insert-license
7+
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$
8+
args:
9+
- --license-filepath
10+
- license_header.txt
11+
- --comment-style
12+
- /*| *| */
13+
- repo: local
14+
hooks:
15+
- id: docker-clang-format
16+
name: clang-format
17+
description: Run `clang-format` against C/C++ header and source files in Docker container
18+
language: docker_image
19+
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$
20+
entry: daverona/pre-commit-cpp:0.8.0 clang-format -i -style=file
21+
- id: docker-cpplint
22+
name: cpplint
23+
description: Run `cpplint` against C/C++ header and source files in Docker container
24+
language: docker_image
25+
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$
26+
entry: daverona/pre-commit-cpp:0.8.0 cpplint
27+
- id: docker-piocheck
28+
name: piocheck
29+
description: Run `pio check` against C/C++ source files in Docker container
30+
language: docker_image
31+
files: \.(c|cc|cpp|cu|c\+\+|cxx|tpp|txx|ino)$
32+
pass_filenames: false
33+
entry: --user=root --entrypoint /root/.platformio/penv/bin/pio shaguarger/platformio:latest check --project-dir /src

.travis.yml

-67
This file was deleted.

CHANGELOG.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## [<VERSION>] - <DATE>
6+
7+
### Added
8+
- `<CLASS> | <FILE> | <FUNCTION> | <ETC>`: <Description>
9+
10+
### Changed
11+
- `<CLASS> | <FILE> | <FUNCTION> | <ETC>`: <Description>
12+
13+
### Fixed
14+
- `<CLASS> | <FILE> | <FUNCTION> | <ETC>`: <Description>

CPPLINT.cfg

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#
2+
# Copyright (C) 2017 The Android Open Source Project
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+
# http://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+
# Don't search for additional CPPLINT.cfg in parent directories.
18+
set noparent
19+
20+
# Exclude third-party files
21+
exclude_files=\.pio|lib
22+
23+
# Limit line length.
24+
linelength=180
25+
26+
# Ignore the following categories of errors, as specified by the filter:
27+
# (the filter settings are concatenated together)
28+
filter=-build/c++11
29+
filter=-build/include
30+
filter=-readability/function,-readability/streams,-readability/todo
31+
filter=-runtime/printf,-runtime/references,-runtime/sizeof,-runtime/threadsafe_fn
32+
# TODO: this should be re-enabled.
33+
filter=-whitespace/line_length

Hardware/LICENSE

+199
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
CERN Open Hardware Licence Version 2 - Permissive
2+
3+
4+
Preamble
5+
6+
CERN has developed this licence to promote collaboration among
7+
hardware designers and to provide a legal tool which supports the
8+
freedom to use, study, modify, share and distribute hardware designs
9+
and products based on those designs. Version 2 of the CERN Open
10+
Hardware Licence comes in three variants: this licence, CERN-OHL-P
11+
(permissive); and two reciprocal licences: CERN-OHL-W (weakly
12+
reciprocal) and CERN-OHL-S (strongly reciprocal).
13+
14+
The CERN-OHL-P is copyright CERN 2020. Anyone is welcome to use it, in
15+
unmodified form only.
16+
17+
Use of this Licence does not imply any endorsement by CERN of any
18+
Licensor or their designs nor does it imply any involvement by CERN in
19+
their development.
20+
21+
22+
1 Definitions
23+
24+
1.1 'Licence' means this CERN-OHL-P.
25+
26+
1.2 'Source' means information such as design materials or digital
27+
code which can be applied to Make or test a Product or to
28+
prepare a Product for use, Conveyance or sale, regardless of its
29+
medium or how it is expressed. It may include Notices.
30+
31+
1.3 'Covered Source' means Source that is explicitly made available
32+
under this Licence.
33+
34+
1.4 'Product' means any device, component, work or physical object,
35+
whether in finished or intermediate form, arising from the use,
36+
application or processing of Covered Source.
37+
38+
1.5 'Make' means to create or configure something, whether by
39+
manufacture, assembly, compiling, loading or applying Covered
40+
Source or another Product or otherwise.
41+
42+
1.6 'Notice' means copyright, acknowledgement and trademark notices,
43+
references to the location of any Notices, modification notices
44+
(subsection 3.3(b)) and all notices that refer to this Licence
45+
and to the disclaimer of warranties that are included in the
46+
Covered Source.
47+
48+
1.7 'Licensee' or 'You' means any person exercising rights under
49+
this Licence.
50+
51+
1.8 'Licensor' means a person who creates Source or modifies Covered
52+
Source and subsequently Conveys the resulting Covered Source
53+
under the terms and conditions of this Licence. A person may be
54+
a Licensee and a Licensor at the same time.
55+
56+
1.9 'Convey' means to communicate to the public or distribute.
57+
58+
59+
2 Applicability
60+
61+
2.1 This Licence governs the use, copying, modification, Conveying
62+
of Covered Source and Products, and the Making of Products. By
63+
exercising any right granted under this Licence, You irrevocably
64+
accept these terms and conditions.
65+
66+
2.2 This Licence is granted by the Licensor directly to You, and
67+
shall apply worldwide and without limitation in time.
68+
69+
2.3 You shall not attempt to restrict by contract or otherwise the
70+
rights granted under this Licence to other Licensees.
71+
72+
2.4 This Licence is not intended to restrict fair use, fair dealing,
73+
or any other similar right.
74+
75+
76+
3 Copying, Modifying and Conveying Covered Source
77+
78+
3.1 You may copy and Convey verbatim copies of Covered Source, in
79+
any medium, provided You retain all Notices.
80+
81+
3.2 You may modify Covered Source, other than Notices.
82+
83+
You may only delete Notices if they are no longer applicable to
84+
the corresponding Covered Source as modified by You and You may
85+
add additional Notices applicable to Your modifications.
86+
87+
3.3 You may Convey modified Covered Source (with the effect that You
88+
shall also become a Licensor) provided that You:
89+
90+
a) retain Notices as required in subsection 3.2; and
91+
92+
b) add a Notice to the modified Covered Source stating that You
93+
have modified it, with the date and brief description of how
94+
You have modified it.
95+
96+
3.4 You may Convey Covered Source or modified Covered Source under
97+
licence terms which differ from the terms of this Licence
98+
provided that You:
99+
100+
a) comply at all times with subsection 3.3; and
101+
102+
b) provide a copy of this Licence to anyone to whom You
103+
Convey Covered Source or modified Covered Source.
104+
105+
106+
4 Making and Conveying Products
107+
108+
You may Make Products, and/or Convey them, provided that You ensure
109+
that the recipient of the Product has access to any Notices applicable
110+
to the Product.
111+
112+
113+
5 DISCLAIMER AND LIABILITY
114+
115+
5.1 DISCLAIMER OF WARRANTY -- The Covered Source and any Products
116+
are provided 'as is' and any express or implied warranties,
117+
including, but not limited to, implied warranties of
118+
merchantability, of satisfactory quality, non-infringement of
119+
third party rights, and fitness for a particular purpose or use
120+
are disclaimed in respect of any Source or Product to the
121+
maximum extent permitted by law. The Licensor makes no
122+
representation that any Source or Product does not or will not
123+
infringe any patent, copyright, trade secret or other
124+
proprietary right. The entire risk as to the use, quality, and
125+
performance of any Source or Product shall be with You and not
126+
the Licensor. This disclaimer of warranty is an essential part
127+
of this Licence and a condition for the grant of any rights
128+
granted under this Licence.
129+
130+
5.2 EXCLUSION AND LIMITATION OF LIABILITY -- The Licensor shall, to
131+
the maximum extent permitted by law, have no liability for
132+
direct, indirect, special, incidental, consequential, exemplary,
133+
punitive or other damages of any character including, without
134+
limitation, procurement of substitute goods or services, loss of
135+
use, data or profits, or business interruption, however caused
136+
and on any theory of contract, warranty, tort (including
137+
negligence), product liability or otherwise, arising in any way
138+
in relation to the Covered Source, modified Covered Source
139+
and/or the Making or Conveyance of a Product, even if advised of
140+
the possibility of such damages, and You shall hold the
141+
Licensor(s) free and harmless from any liability, costs,
142+
damages, fees and expenses, including claims by third parties,
143+
in relation to such use.
144+
145+
146+
6 Patents
147+
148+
6.1 Subject to the terms and conditions of this Licence, each
149+
Licensor hereby grants to You a perpetual, worldwide,
150+
non-exclusive, no-charge, royalty-free, irrevocable (except as
151+
stated in this section 6, or where terminated by the Licensor
152+
for cause) patent licence to Make, have Made, use, offer to
153+
sell, sell, import, and otherwise transfer the Covered Source
154+
and Products, where such licence applies only to those patent
155+
claims licensable by such Licensor that are necessarily
156+
infringed by exercising rights under the Covered Source as
157+
Conveyed by that Licensor.
158+
159+
6.2 If You institute patent litigation against any entity (including
160+
a cross-claim or counterclaim in a lawsuit) alleging that the
161+
Covered Source or a Product constitutes direct or contributory
162+
patent infringement, or You seek any declaration that a patent
163+
licensed to You under this Licence is invalid or unenforceable
164+
then any rights granted to You under this Licence shall
165+
terminate as of the date such process is initiated.
166+
167+
168+
7 General
169+
170+
7.1 If any provisions of this Licence are or subsequently become
171+
invalid or unenforceable for any reason, the remaining
172+
provisions shall remain effective.
173+
174+
7.2 You shall not use any of the name (including acronyms and
175+
abbreviations), image, or logo by which the Licensor or CERN is
176+
known, except where needed to comply with section 3, or where
177+
the use is otherwise allowed by law. Any such permitted use
178+
shall be factual and shall not be made so as to suggest any kind
179+
of endorsement or implication of involvement by the Licensor or
180+
its personnel.
181+
182+
7.3 CERN may publish updated versions and variants of this Licence
183+
which it considers to be in the spirit of this version, but may
184+
differ in detail to address new problems or concerns. New
185+
versions will be published with a unique version number and a
186+
variant identifier specifying the variant. If the Licensor has
187+
specified that a given variant applies to the Covered Source
188+
without specifying a version, You may treat that Covered Source
189+
as being released under any version of the CERN-OHL with that
190+
variant. If no variant is specified, the Covered Source shall be
191+
treated as being released under CERN-OHL-S. The Licensor may
192+
also specify that the Covered Source is subject to a specific
193+
version of the CERN-OHL or any later version in which case You
194+
may apply this or any later version of CERN-OHL with the same
195+
variant identifier published by CERN.
196+
197+
7.4 This Licence shall not be enforceable except by a Licensor
198+
acting as such, and third party beneficiary rights are
199+
specifically excluded.

0 commit comments

Comments
 (0)