-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I'm not 100% this is working since I can't get it to do anything without using `-checks=level2`. The behavior doesn't seem to match the documentation there, which could be a me problem or not. In any event, this is not harmful and so is good to ship, now that I was able to add that `-checks=level2` in only the tests. Maybe an experienced user can figure this out.
- Loading branch information
Showing
3 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM ubuntu:22.04 | ||
LABEL maintainer="Pat Brisbin [email protected]" | ||
ENV DEBIAN_FRONTEND=noninteractive LANG=C.UTF-8 LC_ALL=C.UTF-8 | ||
RUN \ | ||
apt-get update && \ | ||
apt-get -y --no-install-recommends install \ | ||
clang \ | ||
clang-tools \ | ||
clazy \ | ||
cmake \ | ||
make \ | ||
locales \ | ||
qt6-base-dev && \ | ||
locale-gen en_US.UTF-8 && \ | ||
rm -rf /var/lib/apt/lists/* | ||
ENV LANG=en_US.UTF-8 | ||
COPY clazy-standlone-apply /usr/local/bin/clazy-standalone-apply | ||
RUN mkdir -p /code | ||
WORKDIR /code | ||
ENTRYPOINT [] | ||
CMD ["clazy-standalone-apply", "--help"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
set -eou pipefail | ||
|
||
tmp=$(mktemp -d) | ||
trap 'rm -rf "$tmp"' EXIT | ||
|
||
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON . | ||
clazy-standalone --export-fixes="$tmp"/fixes.yaml "$@" | ||
clang-apply-replacements "$tmp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
enabled: true | ||
name: clazy | ||
command: | ||
- clazy-standalone-apply | ||
supports_arg_sep: false | ||
version_cmd: | | ||
apt-cache policy clazy | sed '/^ *Installed: \(.*\)$/!d; s//v\1/' | ||
include: | ||
- "**/*.cpp" | ||
documentation: | ||
- https://github.com/KDE/clazy | ||
metadata: | ||
languages: | ||
- C++ | ||
tests: | ||
- name: qstring-allocations | ||
arguments: ["-checks=level2"] | ||
support: | ||
path: CMakeLists.txt | ||
contents: | | ||
cmake_minimum_required(VERSION 3.16) | ||
project(helloworld VERSION 1.0.0 LANGUAGES CXX) | ||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_AUTOMOC ON) | ||
find_package(Qt6 REQUIRED COMPONENTS Core) | ||
add_executable(helloworld | ||
clazy-test-1.cpp | ||
) | ||
target_link_libraries(helloworld PRIVATE Qt6::Core) | ||
contents: | | ||
#include <iostream> | ||
#include <QString> | ||
int main() { | ||
QString str = "hello"; | ||
QString result = str.left(1); | ||
std::cout << "Original string: " << str.toStdString() << std::endl; | ||
std::cout << "Substring from index 5 onwards: " << result.toStdString() << std::endl; | ||
return 0; | ||
} | ||
restyled: | | ||
#include <iostream> | ||
#include <QString> | ||
int main() { | ||
QString str = QStringLiteral("hello"); | ||
QString result = str.left(1); | ||
std::cout << "Original string: " << str.toStdString() << std::endl; | ||
std::cout << "Substring from index 5 onwards: " << result.toStdString() << std::endl; | ||
return 0; | ||
} |