Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Test] Add cpp linter workflow #94

Closed
wants to merge 21 commits into from
26 changes: 26 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Checks: '-*,llvm-*,misc-*,-misc-const-correctness,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,-misc-no-recursion,-misc-use-anonymous-namespace,readability-identifier-naming,-misc-include-cleaner,-llvm-header-guard'
CheckOptions:
- key: readability-identifier-naming.ClassCase
value: CamelCase
- key: readability-identifier-naming.EnumCase
value: CamelCase
- key: readability-identifier-naming.FunctionCase
value: camelBack
# Exclude from scanning as this is an exported symbol used for fuzzing
# throughout the code base.
- key: readability-identifier-naming.FunctionIgnoredRegexp
value: "LLVMFuzzerTestOneInput"
- key: readability-identifier-naming.MemberCase
value: CamelCase
- key: readability-identifier-naming.ParameterCase
value: CamelCase
- key: readability-identifier-naming.UnionCase
value: CamelCase
- key: readability-identifier-naming.VariableCase
value: CamelCase
- key: readability-identifier-naming.IgnoreMainLikeFunctions
value: 1
- key: readability-redundant-member-init.IgnoreBaseInCopyConstructors
value: 1
- key: modernize-use-default-member-init.UseAssignment
value: 1
20 changes: 0 additions & 20 deletions .github/workflows/check-clang-format.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/cpp-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: cpp-linter

on:
pull_request:
#paths:
# - "common/*"
# - "pass/*"
# - "lib/*"

jobs:
cpp-linter:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: cpp-linter/cpp-linter-action@v2
id: linter
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: 18
ignore: .github | tests | scripts
style: file
tidy-checks: ''
lines-changed-only: true
format-review: true
tidy-review: true

- name: Fail fast?!
if: steps.linter.outputs.checks-failed != 0
run: exit 1
3 changes: 3 additions & 0 deletions lib/JitEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <optional>
#include <string>

#include "llvm/CodeGen/CommandFlags.h"

Check failure on line 16 in lib/JitEngine.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter

lib/JitEngine.cpp:16:10 [clang-diagnostic-error]

'llvm/CodeGen/CommandFlags.h' file not found
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/IR/Module.h"
Expand Down Expand Up @@ -135,6 +135,9 @@
void JitEngine::optimizeIR(Module &M, StringRef Arch) {
TIMESCOPE("Optimize IR");
runOptimizationPassPipeline(M, Arch);

for (int i = 0; i < 10; i++)

Check warning on line 139 in lib/JitEngine.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter

lib/JitEngine.cpp:139:12 [readability-identifier-naming]

invalid case style for variable 'i'
printf("Senseless code\n");
}

} // namespace proteus
3 changes: 3 additions & 0 deletions pass/ProteusPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
//
//===----------------------------------------------------------------------===//

#include "llvm/Analysis/CallGraph.h"

Check failure on line 28 in pass/ProteusPass.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter

pass/ProteusPass.cpp:28:10 [clang-diagnostic-error]

'llvm/Analysis/CallGraph.h' file not found
#include "llvm/Bitcode/BitcodeWriter.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/Mangler.h"
Expand Down Expand Up @@ -120,6 +120,9 @@
bool run(Module &M, bool IsLTO) {
parseAnnotations(M);

for (int I = 0; I < 10; ++I)
printf("Senseless code\n");

DEBUG(Logger::logs("proteus-pass")
<< "=== Pre Original Host Module\n"
<< M << "=== End of Pre Original Host Module\n");
Expand Down
Loading