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

github: add clazy to linting workflow #3125

Draft
wants to merge 22 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions .github/workflows/codespell.yml

This file was deleted.

46 changes: 46 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: Lint

on:
push:
branches: [main]
pull_request: {}

jobs:
codespell:
name: Codespell
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/[email protected]
- name: Codespell
uses: codespell-project/[email protected]

clazy:
name: Clazy
runs-on: ubuntu-24.04

steps:
- name: Checkout
uses: actions/[email protected]
with:
submodules: "recursive"
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libopengl-dev qt6-base-private-dev qt6-declarative-dev qt6-httpserver-dev qt6-pdf-dev qt6-svg-dev qt6-tools-dev qt6-websockets-dev
- name: Configure
run: |
cmake -S gpt4all-chat -B gpt4all-chat/build \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DLLMODEL_CUDA=OFF \
-DLLMODEL_KOMPUTE=OFF
- name: Clazy
uses: nomic-ai/clazy-action@009a6378b899ab6d20f26647e624f3038384378e
with:
version: '1.12'
checks: "level0,no-container-anti-pattern,no-qstring-arg,no-qstring-ref,no-strict-iterators,no-unused-non-trivial-variable"
database: gpt4all-chat/build
path-regex: "gpt4all-(chat|backend)/src"
5 changes: 4 additions & 1 deletion gpt4all-chat/src/chat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@
#include <QStringList>
#include <QVariant>
#include <Qt>
#include <QtLogging>

#include <utility>

#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
# include <QtLogging>
#endif

Chat::Chat(QObject *parent)
: QObject(parent)
, m_id(Network::globalInstance()->generateUniqueId())
Expand Down
5 changes: 4 additions & 1 deletion gpt4all-chat/src/chatapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@
#include <QVariant>
#include <Qt>
#include <QtGlobal>
#include <QtLogging>

#include <iostream>

#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
# include <QtLogging>
#endif

using namespace Qt::Literals::StringLiterals;

//#define DEBUG
Expand Down
5 changes: 4 additions & 1 deletion gpt4all-chat/src/chatlistmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
#include <QVector>
#include <Qt>
#include <QtGlobal>
#include <QtLogging>

#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
# include <QtLogging>
#endif

class ChatsRestoreThread : public QThread
{
Expand Down
7 changes: 5 additions & 2 deletions gpt4all-chat/src/chatllm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <QUrl>
#include <QWaitCondition>
#include <Qt>
#include <QtLogging>

#include <algorithm>
#include <cctype>
Expand All @@ -37,6 +36,10 @@
#include <utility>
#include <vector>

#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
# include <QtLogging>
#endif

using namespace Qt::Literals::StringLiterals;

//#define DEBUG
Expand Down Expand Up @@ -198,7 +201,7 @@ bool ChatLLM::loadDefaultModel()
{
ModelInfo defaultModel = ModelList::globalInstance()->defaultModelInfo();
if (defaultModel.filename().isEmpty()) {
emit modelLoadingError(u"Could not find any model to load"_qs);
emit modelLoadingError(u"Could not find any model to load"_s);
return false;
}
return loadModel(defaultModel);
Expand Down
5 changes: 4 additions & 1 deletion gpt4all-chat/src/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@
#include <QUtf8StringView>
#include <QVariant>
#include <Qt>
#include <QtLogging>

#include <algorithm>
#include <cmath>
#include <optional>
#include <stdexcept>

#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
# include <QtLogging>
#endif

using namespace Qt::Literals::StringLiterals;
namespace ranges = std::ranges;
namespace us = unum::usearch;
Expand Down
5 changes: 4 additions & 1 deletion gpt4all-chat/src/download.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@
#include <QVariant>
#include <QVector>
#include <Qt>
#include <QtLogging>

#include <algorithm>
#include <compare>
#include <cstddef>
#include <utility>

#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
# include <QtLogging>
#endif

using namespace Qt::Literals::StringLiterals;

class MyDownload: public Download { };
Expand Down
5 changes: 4 additions & 1 deletion gpt4all-chat/src/embllm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@
#include <QUrl>
#include <Qt>
#include <QtGlobal>
#include <QtLogging>

#include <exception>
#include <utility>
#include <vector>

#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
# include <QtLogging>
#endif

using namespace Qt::Literals::StringLiterals;

static const QString EMBEDDING_MODEL_NAME = u"nomic-embed-text-v1.5"_s;
Expand Down
5 changes: 4 additions & 1 deletion gpt4all-chat/src/llm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
#include <QProcess>
#include <QSettings>
#include <QUrl>
#include <QtLogging>

#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
# include <QtLogging>
#endif

#ifdef GPT4ALL_OFFLINE_INSTALLER
# include <QDesktopServices>
Expand Down
6 changes: 5 additions & 1 deletion gpt4all-chat/src/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@

#include <QFile>
#include <QString>
#include <QtLogging>
#include <QtGlobal>

#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
# include <QtLogging>
#endif

class Logger
{
Expand Down
5 changes: 4 additions & 1 deletion gpt4all-chat/src/modellist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include <QTextStream>
#include <QTimer>
#include <QUrl>
#include <QtLogging>

#include <algorithm>
#include <cstddef>
Expand All @@ -41,6 +40,10 @@
#include <string>
#include <utility>

#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
# include <QtLogging>
#endif

using namespace Qt::Literals::StringLiterals;

//#define USE_LOCAL_MODELSJSON
Expand Down
6 changes: 5 additions & 1 deletion gpt4all-chat/src/mysettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@
#include <QThread>
#include <QUrl>
#include <QVariant>
#include <QtLogging>
#include <QtGlobal>

#include <algorithm>
#include <string>
#include <thread>
#include <vector>

#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
# include <QtLogging>
#endif

using namespace Qt::Literals::StringLiterals;

// used only for settings serialization, do not translate
Expand Down
5 changes: 4 additions & 1 deletion gpt4all-chat/src/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@
#include <QSysInfo>
#include <Qt>
#include <QtGlobal>
#include <QtLogging>
#include <QUrl>
#include <QUuid>

#include <cmath>
#include <cstring>
#include <utility>

#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
# include <QtLogging>
#endif

#ifdef __GLIBC__
# include <gnu/libc-version.h>
#endif
Expand Down
4 changes: 3 additions & 1 deletion gpt4all-chat/src/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <Qt>
#include <QtCborCommon>
#include <QtGlobal>
#include <QtLogging>

#include <cstdint>
#include <iostream>
Expand All @@ -37,6 +36,9 @@
#include <unordered_map>
#include <utility>

#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
# include <QtLogging>
#endif
#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
# include <QTcpServer>
#endif
Expand Down
5 changes: 4 additions & 1 deletion gpt4all-chat/src/xlsxtomd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@
#include <QStringView>
#include <QVariant>
#include <QtGlobal>
#include <QtLogging>

#include <memory>

#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
# include <QtLogging>
#endif

using namespace Qt::Literals::StringLiterals;


Expand Down
Loading