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

Enable more clang-tidy lints #335

Merged
merged 31 commits into from
Nov 10, 2024
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
406dc4d
clang-tidy: add braces around statements
Mic92 Nov 10, 2024
80af76d
clang-tidy: don't use else after return
Mic92 Nov 10, 2024
fd76732
clang-tidy: use container empty() method where applicable
Mic92 Nov 10, 2024
475e898
clang-tidy: avoid implicit bool conversion
Mic92 Nov 10, 2024
70ae981
clang-tidy: use qualified auto
Mic92 Nov 10, 2024
8358c91
clang-tidy: use container contains() where possible
Mic92 Nov 10, 2024
1dbbdf2
clang-tidy: deduplicate includes
Mic92 Nov 10, 2024
fbc8725
clang-tidy: isolate declarations
Mic92 Nov 10, 2024
043f0a8
clang-tidy: avoid nested conditional operator
Mic92 Nov 10, 2024
82dff7e
clang-tidy: make member function const
Mic92 Nov 10, 2024
0461738
clang-tidy: enable most of readability lints
Mic92 Nov 10, 2024
6e22f55
clang-tidy: switch to include-cleaner from include-what-you-use
Mic92 Nov 10, 2024
b3efd88
clang-tidy: enable misc-const-correctness
Mic92 Nov 10, 2024
4337142
clang-tidy: enable misc-non-private-member-variables-in-classes
Mic92 Nov 10, 2024
da8d657
clang-tidy: enable misc-use-anonymous-namespace
Mic92 Nov 10, 2024
c377781
clang-tidy: enable all misc lints
Mic92 Nov 10, 2024
9c0c20b
clang-tidy: enable cppcoreguidelines-init-variables
Mic92 Nov 10, 2024
fe6cf62
clang-tidy: enable cppcoreguidelines-pro-type-member-init
Mic92 Nov 10, 2024
a4b761e
clang-tidy: enable cppcoreguidelines-pro-type-vararg
Mic92 Nov 10, 2024
65740c5
clang-tidy: enable cppcoreguidelines-prefer-member-initializer
Mic92 Nov 10, 2024
5c70471
clang-tidy: enable cppcoreguidelines-misleading-capture-default-by-value
Mic92 Nov 10, 2024
c592be9
clang-tidy: enable cppcoreguidelines-virtual-class-destructor
Mic92 Nov 10, 2024
5a4b75a
clang-tidy: enable cppcoreguidelines-special-member-functions
Mic92 Nov 10, 2024
d72255a
clang-tidy: enable cppcoreguidelines-owning-memory
Mic92 Nov 10, 2024
5bad378
clang-tidy: enable remaining cppcoreguidelines lints
Mic92 Nov 10, 2024
900e33e
clang-tidy: fix concurrency lints
Mic92 Nov 10, 2024
a05336e
clang-tidy: enable google lints
Mic92 Nov 10, 2024
c2cdec4
remove 'using namespace nlohmann;'
Mic92 Nov 10, 2024
6cfcbad
remove 'using namespace nix;'
Mic92 Nov 10, 2024
eb8a3fe
Revert "clang-tidy: address easily swappable parameters lint"
Mic92 Nov 10, 2024
f97b4be
move EvalState into worker to avoid stack-use-after-return
Mic92 Nov 10, 2024
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
Prev Previous commit
Next Next commit
clang-tidy: avoid nested conditional operator
Mic92 committed Nov 10, 2024
commit 043f0a8024e2899fba181896c7d0bbacc630e5b7
15 changes: 11 additions & 4 deletions src/drv.cc
Original file line number Diff line number Diff line change
@@ -165,9 +165,16 @@ void to_json(nlohmann::json &json, const Drv &drv) {
json["isCached"] = drv.cacheStatus == Drv::CacheStatus::Cached ||
drv.cacheStatus == Drv::CacheStatus::Local;

json["cacheStatus"] =
drv.cacheStatus == Drv::CacheStatus::Cached ? "cached"
: drv.cacheStatus == Drv::CacheStatus::Local ? "local"
: "notBuilt";
switch (drv.cacheStatus) {
case Drv::CacheStatus::Cached:
json["cacheStatus"] = "cached";
break;
case Drv::CacheStatus::Local:
json["cacheStatus"] = "local";
break;
default:
json["cacheStatus"] = "notBuilt";
break;
}
}
}