Skip to content

Commit ae67ae3

Browse files
authored
Add cpplint and codeql configs (#8)
* Add cpplint * Add FPrime codeql config * Remove unnecessary excludes
1 parent 9612439 commit ae67ae3

File tree

6 files changed

+131
-0
lines changed

6 files changed

+131
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: "CodeQL JPL Coding Standard - Errors and Warnings"
2+
3+
disable-default-queries: true
4+
5+
packs:
6+
# Source of the query pack is https://github.com/github/codeql/tree/main/cpp/ql/src/JPL_C
7+
- codeql/cpp-queries:JPL_C
8+
9+
query-filters:
10+
- exclude:
11+
problem.severity:
12+
- recommendation
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: "CodeQL JPL Coding Standard - Recommendations 1 of 2"
2+
3+
disable-default-queries: true
4+
5+
packs:
6+
# Source of the query pack is https://github.com/github/codeql/tree/main/cpp/ql/src/JPL_C
7+
- codeql/cpp-queries:JPL_C
8+
9+
query-filters:
10+
- exclude:
11+
problem.severity:
12+
- error
13+
- warning
14+
# We are excluding the following query because it overflows the limit of
15+
# 5000 results that the SARIF upload can handle
16+
# This sole query is ran in jpl-standard-pack-3.yml
17+
# 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
18+
- exclude:
19+
id:
20+
- cpp/jpl-c/basic-int-types
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: "CodeQL JPL Coding Standard - Recommendations 2 of 2"
2+
3+
disable-default-queries: true
4+
5+
packs:
6+
# Source of the query pack is https://github.com/github/codeql/tree/main/cpp/ql/src/JPL_C
7+
- codeql/cpp-queries:JPL_C
8+
9+
query-filters:
10+
# This will ONLY include the following query
11+
- include:
12+
id:
13+
- cpp/jpl-c/basic-int-types

.github/codeql/security.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: "CodeQL security and quality"
2+
3+
queries:
4+
- uses: security-and-quality
5+
6+
query-filters:
7+
- include:
8+
id: cpp/incorrect-not-operator-usage
9+
- include:
10+
tags contain: correctness
11+
- include:
12+
tags contain: reliability
13+
14+
paths-ignore:
15+
- docs/

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,10 @@ repos:
1717
rev: v20.1.8
1818
hooks:
1919
- id: clang-format
20+
21+
- repo: https://github.com/cpplint/cpplint
22+
rev: 2.0.0
23+
hooks:
24+
- id: cpplint
25+
args:
26+
- --config=cpplint.cfg

cpplint.cfg

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#
2+
# Cpplint is a command-line tool to check C/C++ files for style issues following Google's C++ style guide.
3+
# https://github.com/cpplint/cpplint
4+
#
5+
# Type the command below for details about supported options in CPPLINT.cfg.
6+
# > cpplint --help
7+
#
8+
9+
# Do not look for additional CPPLINT.cfg in the parent directories.
10+
set noparent
11+
root=.
12+
extensions=cpp,hpp,c,h
13+
14+
# Limit line length.
15+
linelength=120
16+
17+
# Adjust the following error categories as specified by the filter:
18+
# (filter parameters are concatenated together)
19+
20+
# `build` rules
21+
# Enable a warning about C++ features that were not in the original
22+
# C++11 specification (and so might not be well-supported). In the
23+
# case of F´, the minimum supported platforms are potentially not
24+
# new enough to afford to do without this warning.
25+
filter=+build/c++11
26+
27+
# F´ uses `#ifndef FOO_H` guard not the `#pragma once`.
28+
filter=-build/pragma_once
29+
30+
# Do not enforce including header files in both .h and .cpp.
31+
filter=-build/header_guard
32+
filter=-build/include
33+
filter=-build/include_alpha
34+
filter=-build/include_order
35+
filter=-build/include_subdir
36+
filter=-build/include_what_you_use
37+
filter=-build/namespaces
38+
39+
filter=-legal/copyright
40+
41+
filter=-readability/braces
42+
filter=-readability/casting
43+
filter=-readability/namespace
44+
filter=-readability/todo
45+
46+
filter=-runtime/indentation_namespace
47+
filter=-runtime/int
48+
filter=-runtime/references
49+
50+
filter=-whitespace/blank_line
51+
filter=-whitespace/braces
52+
filter=-whitespace/comma
53+
filter=-whitespace/comments
54+
filter=-whitespace/end_of_line
55+
filter=-whitespace/indent
56+
filter=-whitespace/line_length
57+
filter=-whitespace/newline
58+
filter=-whitespace/operators
59+
filter=-whitespace/parens
60+
filter=-whitespace/tab
61+
62+
# There is no need for lint-gardening in the documentation.
63+
exclude_files=docs
64+
exclude_files=build-fprime-automatic-*

0 commit comments

Comments
 (0)