diff --git a/.github/codeql/jpl-standard-pack-1.yaml b/.github/codeql/jpl-standard-pack-1.yaml new file mode 100644 index 00000000..bff47226 --- /dev/null +++ b/.github/codeql/jpl-standard-pack-1.yaml @@ -0,0 +1,12 @@ +name: "CodeQL JPL Coding Standard - Errors and Warnings" + +disable-default-queries: true + +packs: + # Source of the query pack is https://github.com/github/codeql/tree/main/cpp/ql/src/JPL_C + - codeql/cpp-queries:JPL_C + +query-filters: + - exclude: + problem.severity: + - recommendation diff --git a/.github/codeql/jpl-standard-pack-2.yaml b/.github/codeql/jpl-standard-pack-2.yaml new file mode 100644 index 00000000..61b0e53d --- /dev/null +++ b/.github/codeql/jpl-standard-pack-2.yaml @@ -0,0 +1,20 @@ +name: "CodeQL JPL Coding Standard - Recommendations 1 of 2" + +disable-default-queries: true + +packs: + # Source of the query pack is https://github.com/github/codeql/tree/main/cpp/ql/src/JPL_C + - codeql/cpp-queries:JPL_C + +query-filters: + - exclude: + problem.severity: + - error + - warning + # We are excluding the following query because it overflows the limit of + # 5000 results that the SARIF upload can handle + # This sole query is ran in jpl-standard-pack-3.yml + # https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/uploading-a-sarif-file-to-github#uploading-a-code-scanning-analysis-with-github-actions + - exclude: + id: + - cpp/jpl-c/basic-int-types diff --git a/.github/codeql/jpl-standard-pack-3.yaml b/.github/codeql/jpl-standard-pack-3.yaml new file mode 100644 index 00000000..2b56eb50 --- /dev/null +++ b/.github/codeql/jpl-standard-pack-3.yaml @@ -0,0 +1,13 @@ +name: "CodeQL JPL Coding Standard - Recommendations 2 of 2" + +disable-default-queries: true + +packs: + # Source of the query pack is https://github.com/github/codeql/tree/main/cpp/ql/src/JPL_C + - codeql/cpp-queries:JPL_C + +query-filters: + # This will ONLY include the following query + - include: + id: + - cpp/jpl-c/basic-int-types diff --git a/.github/codeql/security.yaml b/.github/codeql/security.yaml new file mode 100644 index 00000000..4808e111 --- /dev/null +++ b/.github/codeql/security.yaml @@ -0,0 +1,15 @@ +name: "CodeQL security and quality" + +queries: + - uses: security-and-quality + +query-filters: + - include: + id: cpp/incorrect-not-operator-usage + - include: + tags contain: correctness + - include: + tags contain: reliability + +paths-ignore: + - docs/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0ad6aaff..db6a4491 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,3 +17,10 @@ repos: rev: v20.1.8 hooks: - id: clang-format + +- repo: https://github.com/cpplint/cpplint + rev: 2.0.0 + hooks: + - id: cpplint + args: + - --config=cpplint.cfg diff --git a/cpplint.cfg b/cpplint.cfg new file mode 100644 index 00000000..0ca25afd --- /dev/null +++ b/cpplint.cfg @@ -0,0 +1,64 @@ +# +# Cpplint is a command-line tool to check C/C++ files for style issues following Google's C++ style guide. +# https://github.com/cpplint/cpplint +# +# Type the command below for details about supported options in CPPLINT.cfg. +# > cpplint --help +# + +# Do not look for additional CPPLINT.cfg in the parent directories. +set noparent +root=. +extensions=cpp,hpp,c,h + +# Limit line length. +linelength=120 + +# Adjust the following error categories as specified by the filter: +# (filter parameters are concatenated together) + +# `build` rules +# Enable a warning about C++ features that were not in the original +# C++11 specification (and so might not be well-supported). In the +# case of F´, the minimum supported platforms are potentially not +# new enough to afford to do without this warning. +filter=+build/c++11 + +# F´ uses `#ifndef FOO_H` guard not the `#pragma once`. +filter=-build/pragma_once + +# Do not enforce including header files in both .h and .cpp. +filter=-build/header_guard +filter=-build/include +filter=-build/include_alpha +filter=-build/include_order +filter=-build/include_subdir +filter=-build/include_what_you_use +filter=-build/namespaces + +filter=-legal/copyright + +filter=-readability/braces +filter=-readability/casting +filter=-readability/namespace +filter=-readability/todo + +filter=-runtime/indentation_namespace +filter=-runtime/int +filter=-runtime/references + +filter=-whitespace/blank_line +filter=-whitespace/braces +filter=-whitespace/comma +filter=-whitespace/comments +filter=-whitespace/end_of_line +filter=-whitespace/indent +filter=-whitespace/line_length +filter=-whitespace/newline +filter=-whitespace/operators +filter=-whitespace/parens +filter=-whitespace/tab + +# There is no need for lint-gardening in the documentation. +exclude_files=docs +exclude_files=build-fprime-automatic-*