| 1 | path_classifiers: |
| 2 | docs: |
| 3 | - scripts/generate_command_help.py |
| 4 | test: |
| 5 | # Mark all code under the src/ directory as test related. |
| 6 | # Really, the crc analyzer is not for test, but LGTM can't build embedded. |
| 7 | - src |
| 8 | - exclude: src/analyzer |
| 9 | |
| 10 | queries: |
| 11 | # Exclude warning about 'if' or 'while' statements that have an 'else' clause, when there is not |
| 12 | # a 'break' statement within the main statement body (ie, it uses a 'return' to exit). This style |
| 13 | # is used in some places in pyocd to reflect that the 'else' body is logically part of the main |
| 14 | # statement. In particular, the Timeout class is used in this pattern: |
| 15 | # |
| 16 | # with Timeout(TIMEOUT) as t: |
| 17 | # while t.check(): |
| 18 | # # code... |
| 19 | # else: |
| 20 | # # handle timeout... |
| 21 | # |
| 22 | # In some cases the 'while' block will exit with only a 'return', so the 'else' isn't really |
| 23 | # necessary, but retaining it maintains the expected pattern. |
| 24 | - exclude: "py/redundant-else" |
| 25 | |
| 26 | # Exclude cases where there is an import of the same module via 'import foo' and 'from foo import ...'. |
| 27 | # The query for this is too general and catches a lot of cases that are not really errors, especially |
| 28 | # with includes of types for annotations. |
| 29 | # |
| 30 | # Example 1: |
| 31 | # |
| 32 | # import pyocd |
| 33 | # from pyocd import debug |
| 34 | # |
| 35 | # These two imports trigger this query, even though it's pretty clearly a reasonable usage. |
| 36 | # |
| 37 | # Example 2: |
| 38 | # |
| 39 | # if TYPE_CHECKING: |
| 40 | # import types |
| 41 | # |
| 42 | # def foo(): |
| 43 | # import types |
| 44 | # |
| 45 | # In this case, types is only needed within foo() at runtime and is not imported globally to reduce |
| 46 | # namespace pollution and import times. But when type checking it's types is also imported. The query |
| 47 | # doesn't see the TYPE_CHECKING predicate and triggers. |
| 48 | - exclude: "py/import-and-import-from" |
| 49 | |
| 50 | # This query triggers on logging of the probe's UID as specified on the command line in cleartext. |
| 51 | # Clearly the UID is not sensitive data, at least in the traditional sense. |
| 52 | - exclude: "py/clear-text-logging-sensitive-data" |