Skip to content

Commit 7ca3723

Browse files
authored
chore(dev): inform AI agents about dev workflows (#268)
1 parent f06c267 commit 7ca3723

2 files changed

Lines changed: 261 additions & 0 deletions

File tree

.clang-tidy

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
---
2+
Checks: 'clang-diagnostic-*,clang-analyzer-*,bugprone-*,-bugprone-easily-swappable-parameters,clang-diagnostics-*,clang-analyzer-*'
3+
WarningsAsErrors: ''
4+
HeaderFilterRegex: ''
5+
AnalyzeTemporaryDtors: false
6+
FormatStyle: file
7+
CheckOptions:
8+
- key: bugprone-string-constructor.LargeLengthThreshold
9+
value: '8388608'
10+
- key: modernize-replace-auto-ptr.IncludeStyle
11+
value: llvm
12+
- key: bugprone-reserved-identifier.Invert
13+
value: 'false'
14+
- key: bugprone-implicit-widening-of-multiplication-result.UseCXXStaticCastsInCppSources
15+
value: 'true'
16+
- key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField
17+
value: 'false'
18+
- key: bugprone-unused-return-value.CheckedFunctions
19+
value: '::std::async;::std::launder;::std::remove;::std::remove_if;::std::unique;::std::unique_ptr::release;::std::basic_string::empty;::std::vector::empty;::std::back_inserter;::std::distance;::std::find;::std::find_if;::std::inserter;::std::lower_bound;::std::make_pair;::std::map::count;::std::map::find;::std::map::lower_bound;::std::multimap::equal_range;::std::multimap::upper_bound;::std::set::count;::std::set::find;::std::setfill;::std::setprecision;::std::setw;::std::upper_bound;::std::vector::at;::bsearch;::ferror;::feof;::isalnum;::isalpha;::isblank;::iscntrl;::isdigit;::isgraph;::islower;::isprint;::ispunct;::isspace;::isupper;::iswalnum;::iswprint;::iswspace;::isxdigit;::memchr;::memcmp;::strcmp;::strcoll;::strncmp;::strpbrk;::strrchr;::strspn;::strstr;::wcscmp;::access;::bind;::connect;::difftime;::dlsym;::fnmatch;::getaddrinfo;::getopt;::htonl;::htons;::iconv_open;::inet_addr;::isascii;::isatty;::mmap;::newlocale;::openat;::pathconf;::pthread_equal;::pthread_getspecific;::pthread_mutex_trylock;::readdir;::readlink;::recvmsg;::regexec;::scandir;::semget;::setjmp;::shm_open;::shmget;::sigismember;::strcasecmp;::strsignal;::ttyname'
20+
- key: cert-dcl16-c.NewSuffixes
21+
value: 'L;LL;LU;LLU'
22+
- key: bugprone-exception-escape.FunctionsThatShouldNotThrow
23+
value: ''
24+
- key: modernize-loop-convert.MaxCopySize
25+
value: '16'
26+
- key: bugprone-narrowing-conversions.WarnOnFloatingPointNarrowingConversion
27+
value: 'true'
28+
- key: bugprone-signed-char-misuse.CharTypdefsToIgnore
29+
value: ''
30+
- key: bugprone-argument-comment.CommentStringLiterals
31+
value: '0'
32+
- key: bugprone-narrowing-conversions.PedanticMode
33+
value: 'false'
34+
- key: bugprone-sizeof-expression.WarnOnSizeOfConstant
35+
value: 'true'
36+
- key: bugprone-assert-side-effect.IgnoredFunctions
37+
value: __builtin_expect
38+
- key: bugprone-argument-comment.CommentBoolLiterals
39+
value: '0'
40+
- key: bugprone-argument-comment.CommentUserDefinedLiterals
41+
value: '0'
42+
- key: cert-str34-c.DiagnoseSignedUnsignedCharComparisons
43+
value: 'false'
44+
- key: bugprone-narrowing-conversions.WarnWithinTemplateInstantiation
45+
value: 'false'
46+
- key: cert-err33-c.CheckedFunctions
47+
value: '::aligned_alloc;::asctime_s;::at_quick_exit;::atexit;::bsearch;::bsearch_s;::btowc;::c16rtomb;::c32rtomb;::calloc;::clock;::cnd_broadcast;::cnd_init;::cnd_signal;::cnd_timedwait;::cnd_wait;::ctime_s;::fclose;::fflush;::fgetc;::fgetpos;::fgets;::fgetwc;::fopen;::fopen_s;::fprintf;::fprintf_s;::fputc;::fputs;::fputwc;::fputws;::fread;::freopen;::freopen_s;::fscanf;::fscanf_s;::fseek;::fsetpos;::ftell;::fwprintf;::fwprintf_s;::fwrite;::fwscanf;::fwscanf_s;::getc;::getchar;::getenv;::getenv_s;::gets_s;::getwc;::getwchar;::gmtime;::gmtime_s;::localtime;::localtime_s;::malloc;::mbrtoc16;::mbrtoc32;::mbsrtowcs;::mbsrtowcs_s;::mbstowcs;::mbstowcs_s;::memchr;::mktime;::mtx_init;::mtx_lock;::mtx_timedlock;::mtx_trylock;::mtx_unlock;::printf_s;::putc;::putwc;::raise;::realloc;::remove;::rename;::scanf;::scanf_s;::setlocale;::setvbuf;::signal;::snprintf;::snprintf_s;::sprintf;::sprintf_s;::sscanf;::sscanf_s;::strchr;::strerror_s;::strftime;::strpbrk;::strrchr;::strstr;::strtod;::strtof;::strtoimax;::strtok;::strtok_s;::strtol;::strtold;::strtoll;::strtoul;::strtoull;::strtoumax;::strxfrm;::swprintf;::swprintf_s;::swscanf;::swscanf_s;::thrd_create;::thrd_detach;::thrd_join;::thrd_sleep;::time;::timespec_get;::tmpfile;::tmpfile_s;::tmpnam;::tmpnam_s;::tss_create;::tss_get;::tss_set;::ungetc;::ungetwc;::vfprintf;::vfprintf_s;::vfscanf;::vfscanf_s;::vfwprintf;::vfwprintf_s;::vfwscanf;::vfwscanf_s;::vprintf_s;::vscanf;::vscanf_s;::vsnprintf;::vsnprintf_s;::vsprintf;::vsprintf_s;::vsscanf;::vsscanf_s;::vswprintf;::vswprintf_s;::vswscanf;::vswscanf_s;::vwprintf_s;::vwscanf;::vwscanf_s;::wcrtomb;::wcschr;::wcsftime;::wcspbrk;::wcsrchr;::wcsrtombs;::wcsrtombs_s;::wcsstr;::wcstod;::wcstof;::wcstoimax;::wcstok;::wcstok_s;::wcstol;::wcstold;::wcstoll;::wcstombs;::wcstombs_s;::wcstoul;::wcstoull;::wcstoumax;::wcsxfrm;::wctob;::wctrans;::wctype;::wmemchr;::wprintf_s;::wscanf;::wscanf_s;'
48+
- key: bugprone-suspicious-string-compare.WarnOnLogicalNotComparison
49+
value: 'false'
50+
- key: google-readability-braces-around-statements.ShortStatementLines
51+
value: '1'
52+
- key: bugprone-reserved-identifier.AllowedIdentifiers
53+
value: ''
54+
- key: bugprone-signal-handler.AsyncSafeFunctionSet
55+
value: POSIX
56+
- key: bugprone-suspicious-string-compare.WarnOnImplicitComparison
57+
value: 'true'
58+
- key: bugprone-argument-comment.CommentNullPtrs
59+
value: '0'
60+
- key: bugprone-narrowing-conversions.WarnOnIntegerToFloatingPointNarrowingConversion
61+
value: 'true'
62+
- key: bugprone-argument-comment.StrictMode
63+
value: '0'
64+
- key: bugprone-misplaced-widening-cast.CheckImplicitCasts
65+
value: 'false'
66+
- key: bugprone-suspicious-missing-comma.RatioThreshold
67+
value: '0.200000'
68+
- key: modernize-loop-convert.MinConfidence
69+
value: reasonable
70+
- key: bugprone-unhandled-self-assignment.WarnOnlyIfThisHasSuspiciousField
71+
value: 'true'
72+
- key: google-readability-namespace-comments.ShortNamespaceLines
73+
value: '10'
74+
- key: google-readability-namespace-comments.SpacesBeforeComments
75+
value: '2'
76+
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
77+
value: 'true'
78+
- key: bugprone-argument-comment.IgnoreSingleArgument
79+
value: '0'
80+
- key: bugprone-suspicious-string-compare.StringCompareLikeFunctions
81+
value: ''
82+
- key: bugprone-narrowing-conversions.WarnOnEquivalentBitWidth
83+
value: 'true'
84+
- key: bugprone-sizeof-expression.WarnOnSizeOfIntegerExpression
85+
value: 'false'
86+
- key: bugprone-assert-side-effect.CheckFunctionCalls
87+
value: 'false'
88+
- key: bugprone-narrowing-conversions.IgnoreConversionFromTypes
89+
value: ''
90+
- key: bugprone-string-constructor.StringNames
91+
value: '::std::basic_string;::std::basic_string_view'
92+
- key: bugprone-assert-side-effect.AssertMacros
93+
value: assert,NSAssert,NSCAssert
94+
- key: bugprone-exception-escape.IgnoredExceptions
95+
value: ''
96+
- key: bugprone-signed-char-misuse.DiagnoseSignedUnsignedCharComparisons
97+
value: 'true'
98+
- key: llvm-qualified-auto.AddConstToQualified
99+
value: 'false'
100+
- key: bugprone-narrowing-conversions.WarnOnIntegerNarrowingConversion
101+
value: 'true'
102+
- key: modernize-loop-convert.NamingStyle
103+
value: CamelCase
104+
- key: bugprone-suspicious-include.ImplementationFileExtensions
105+
value: 'c;cc;cpp;cxx'
106+
- key: bugprone-suspicious-missing-comma.SizeThreshold
107+
value: '5'
108+
- key: bugprone-suspicious-include.HeaderFileExtensions
109+
value: ';h;hh;hpp;hxx'
110+
- key: google-readability-function-size.StatementThreshold
111+
value: '800'
112+
- key: llvm-else-after-return.WarnOnConditionVariables
113+
value: 'false'
114+
- key: bugprone-argument-comment.CommentCharacterLiterals
115+
value: '0'
116+
- key: bugprone-argument-comment.CommentIntegerLiterals
117+
value: '0'
118+
- key: bugprone-stringview-nullptr.IncludeStyle
119+
value: llvm
120+
- key: bugprone-sizeof-expression.WarnOnSizeOfCompareToConstant
121+
value: 'true'
122+
- key: modernize-pass-by-value.IncludeStyle
123+
value: llvm
124+
- key: bugprone-reserved-identifier.AggressiveDependentMemberLookup
125+
value: 'false'
126+
- key: bugprone-sizeof-expression.WarnOnSizeOfThis
127+
value: 'true'
128+
- key: bugprone-string-constructor.WarnOnLargeLength
129+
value: 'true'
130+
- key: bugprone-too-small-loop-variable.MagnitudeBitsUpperLimit
131+
value: '16'
132+
- key: bugprone-argument-comment.CommentFloatLiterals
133+
value: '0'
134+
- key: modernize-use-nullptr.NullMacros
135+
value: 'NULL'
136+
- key: bugprone-dangling-handle.HandleClasses
137+
value: 'std::basic_string_view;std::experimental::basic_string_view'
138+
- key: bugprone-dynamic-static-initializers.HeaderFileExtensions
139+
value: ';h;hh;hpp;hxx'
140+
- key: bugprone-suspicious-enum-usage.StrictMode
141+
value: 'false'
142+
- key: bugprone-implicit-widening-of-multiplication-result.IncludeStyle
143+
value: llvm
144+
- key: bugprone-suspicious-missing-comma.MaxConcatenatedTokens
145+
value: '5'
146+
- key: bugprone-implicit-widening-of-multiplication-result.UseCXXHeadersInCppSources
147+
value: 'true'
148+
- key: llvm-else-after-return.WarnOnUnfixable
149+
value: 'false'
150+
- key: bugprone-not-null-terminated-result.WantToUseSafeFunctions
151+
value: 'true'
152+
...
153+

AGENTS.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# AGENTS
2+
3+
Project type: Arduino library that can be compiled for Linux and the Pico SDK.
4+
5+
## Building docs
6+
7+
requires: [doxygen]
8+
9+
steps:
10+
11+
- `cd docs`
12+
- `doxygen`
13+
- optional: open `docs/html/index.html`
14+
15+
## Build/Install library
16+
17+
requires: `cmake`, build tools (and `sudo` for install)
18+
19+
steps:
20+
21+
- `cmake -B build -S . [...cmake options]`
22+
- `cmake --build build`
23+
- `sudo cmake --install build` (required to build Linux examples)
24+
25+
### Build environment & dependency ordering
26+
27+
- Dependency ordering (use git HEAD of `master` unless specified):
28+
1. [RF24] (build & install)
29+
2. `RF24Network` (build)
30+
- Example commands to install dependencies from source (repeat for each
31+
dependency):
32+
- `git clone <repo> && cd <repo>`
33+
- `cmake -B build -S .`
34+
- `cmake --build build`
35+
- `sudo cmake --install build`
36+
37+
## Examples (RPi/Linux)
38+
39+
requires: `cmake`, build tools
40+
41+
steps:
42+
43+
- `cmake -B examples_RPi/build examples_RPi [...cmake options]`
44+
- `cmake --build examples_RPi/build`
45+
46+
## Pico SDK examples
47+
48+
requires: `cmake`, [PicoSDK] (Windows: `ninja` may be required)
49+
50+
steps:
51+
52+
- `cmake -B examples_pico/build examples_pico [...cmake opts]`
53+
- `cmake --build examples_pico/build`
54+
55+
### About [RF24] dependency
56+
57+
The `examples_pico/CMakeLists.txt` expects [RF24] repo checked out adjacent to
58+
this repo's root folder. Unless otherwise noted, [RF24] master branch tip is
59+
used.
60+
61+
## Install Python wrapper
62+
63+
requires:
64+
65+
- `python`, `pip`, and Python C API headers
66+
- `boost.python` (typically provided via `apt-get install`)
67+
68+
steps:
69+
70+
- Create a venv (can be done with various tools). Need only be done once.
71+
- Activate the venv (depends on method used in previous step), if not already in
72+
active venv.
73+
- `pip install -v ./RPi/pyRF24Network`
74+
75+
Notes about dependencies:
76+
77+
- Most dependencies can be installed via
78+
`apt-get install python3-dev libboost-python-dev`.
79+
- The [RF24] (C++ lib) is required to be installed beforehand too.
80+
81+
## Format sources
82+
83+
requires: `clang-format` v14.x
84+
85+
steps:
86+
87+
- `clang-format-14 -i --style=file <file>`
88+
- On Windows (powershell does not expand globs):
89+
`clang-format -i --style=file <file>`
90+
91+
## Clang-tidy / static analysis
92+
93+
Note: clang-tidy can only be used when targeting Linux builds. Prefer WSL when
94+
building on a Windows host machine.
95+
96+
- To generate a compilation database required by `clang-tidy`:
97+
- `cmake -B build -S . -DCMAKE_EXPORT_COMPILE_COMMANDS=ON`
98+
- Run `clang-tidy` with the `-p` option pointing to the build directory:
99+
- `clang-tidy -p build <files>`
100+
101+
Notes about [RF24] dependency:
102+
103+
- By default the CMakeLists will `find_library(RF24 rf24 REQUIRED)`
104+
- To build RF24Network, [RF24] needs to be installed.
105+
106+
[RF24]: https://github.com/nRF24/RF24
107+
[PicoSDK]: https://github.com/raspberrypi/pico-sdk
108+
[doxygen]: https://github.com/doxygen/doxygen

0 commit comments

Comments
 (0)