Skip to content

Commit

Permalink
Merge pull request #2 from Team846/ci_tests
Browse files Browse the repository at this point in the history
CI fixed, merging
  • Loading branch information
VyaasBaskar authored Dec 20, 2024
2 parents 6c07e13 + c9d79a1 commit d9ce384
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 9 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/compilation_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,14 @@ jobs:
run: echo "/usr/local/lib" | sudo tee -a /etc/ld.so.conf.d/local.conf && sudo ldconfig

- name: Install clang-format
run: sudo apt-get update && sudo apt-get install -y clang-format
run: |
sudo apt-get update
sudo apt-get install -y wget lsb-release software-properties-common
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 18
sudo apt-get install -y clang-format-18
sudo ln -sf /usr/bin/clang-format-18 /usr/bin/clang-format
- name: Grant execute permission for gradlew
run: chmod +x gradlew
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cpp_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- "**"

jobs:
compilation_check:
cpp_check:
runs-on: ubuntu-latest
container: wpilib/roborio-cross-ubuntu:2024-22.04

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/formatting_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ jobs:
sudo apt-get install -y wget lsb-release software-properties-common
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 17
sudo apt-get install -y clang-format-17
sudo ln -sf /usr/bin/clang-format-17 /usr/bin/clang-format
sudo ./llvm.sh 18
sudo apt-get install -y clang-format-18
sudo ln -sf /usr/bin/clang-format-18 /usr/bin/clang-format
- name: Grant execute permission for gradlew
run: chmod +x gradlew
Expand Down
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Code subsystems interact with hardware subsystems by: 1. writing to motors and 2
Commands set targets to these subsystems. Some commands are like actions, such as moving the arm to a setpoint, or deploying the intake. Commands can be compounded to form more complex routines and autos.

- src
- y2024
- y2025
- cpp
- subsystems
- commands
Expand Down Expand Up @@ -207,3 +207,20 @@ srcfrc846cppfrc846mathcollection.cc:25:0: warning: The function 'VerticalDeadban
srcfrc846cppfrc846mathcollection.cc:39:0: warning: The function 'CoterminalDifference' is never used. [unusedFunction]
srcfrc846cppfrc846mathcollection.cc:52:0: warning: The function 'CoterminalSum' is never used. [unusedFunction]
```

## CppCheck Warnings

```
src\y2025\cpp\field.cc:9:16: warning: Variable 'point' can be declared as reference to const [constVariableReference]
src\y2025\cpp\field.cc:19:14: warning: Variable 'path' can be declared as reference to const [constVariableReference]
src\y2025\cpp\field.cc:10:32: warning: Consider using std::find_if algorithm instead of a raw loop. [useStlAlgorithm]
src\y2025\cpp\field.cc:20:29: warning: Consider using std::find_if algorithm instead of a raw loop. [useStlAlgorithm]
src\y2025\cpp\field.cc:60:26: warning: Consider using std::replace_if algorithm instead of a raw loop. [useStlAlgorithm]
src\y2025\cpp\field.cc:68:26: warning: Consider using std::replace_if algorithm instead of a raw loop. [useStlAlgorithm]
src\y2025\cpp\field.cc:55:25: warning: Consider using std::replace_if algorithm instead of a raw loop. [useStlAlgorithm]
src\frc846\cpp\frc846\math\collection.cc:7:0: warning: The function 'DEquals' is never used. [unusedFunction]
src\frc846\cpp\frc846\math\collection.cc:11:0: warning: The function 'HorizontalDeadband' is never used. [unusedFunction]
src\frc846\cpp\frc846\math\collection.cc:25:0: warning: The function 'VerticalDeadband' is never used. [unusedFunction]
src\frc846\cpp\frc846\math\collection.cc:39:0: warning: The function 'CoterminalDifference' is never used. [unusedFunction]
src\frc846\cpp\frc846\math\collection.cc:52:0: warning: The function 'CoterminalSum' is never used. [unusedFunction]
```
18 changes: 15 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ spotless {
include '**/*.cpp', '**/*.cc', '**/*.h', '**/*.hpp'
exclude '**/build/**', '**/build-*/**'
}
def selectedClangVersion = project.hasProperty('fromCI') ? '17.0.6' : '18.1.8'
def selectedClangVersion = project.hasProperty('fromCI') ? '18.1.8' : '18.1.8'

def styleFile = file('style.standard')
def styleConfig = styleFile.text.trim()
Expand Down Expand Up @@ -152,8 +152,20 @@ task runCppcheck(type: Exec) {
def warnings = cppcheckOutput.readLines().findAll { it.contains("warning") && !it.contains("nofile:") }
def reportContent = warnings.isEmpty() ? "No warnings or errors found." : warnings.join("\n")

def criticalWarnings = cppcheckOutput.readLines().findAll {
it.contains("[error]") || it.contains("nullPointer") || it.contains("uninitVar")
def criticalWarnings = cppcheckOutput.readLines().findAll {
it.contains("error") ||
it.contains("nullPointer") ||
it.contains("uninitVar") ||
it.contains("outOfBounds") ||
it.contains("divideByZero") ||
it.contains("unreachableCode") ||
it.contains("memoryLeak") ||
it.contains("useAfterFree") ||
it.contains("doubleFree") ||
it.contains("invalidMemcpy") ||
it.contains("undefinedFunction") ||
it.contains("invalidInput") ||
it.contains("invalidPointer")
}
println "Cppcheck completed. Total warnings: ${warnings.size()}. Critical issues: ${criticalWarnings.size()}."

Expand Down

0 comments on commit d9ce384

Please sign in to comment.