id int64 0 755k | file_name stringlengths 3 109 | file_path stringlengths 13 185 | content stringlengths 31 9.38M | size int64 31 9.38M | language stringclasses 1
value | extension stringclasses 11
values | total_lines int64 1 340k | avg_line_length float64 2.18 149k | max_line_length int64 7 2.22M | alphanum_fraction float64 0 1 | repo_name stringlengths 6 65 | repo_stars int64 100 47.3k | repo_forks int64 0 12k | repo_open_issues int64 0 3.4k | repo_license stringclasses 9
values | repo_extraction_date stringclasses 92
values | exact_duplicates_redpajama bool 2
classes | near_duplicates_redpajama bool 2
classes | exact_duplicates_githubcode bool 2
classes | exact_duplicates_stackv2 bool 1
class | exact_duplicates_stackv1 bool 2
classes | near_duplicates_githubcode bool 2
classes | near_duplicates_stackv1 bool 2
classes | near_duplicates_stackv2 bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
10,942 | references.cc | NixOS_nix/src/libutil-tests/references.cc | #include "references.hh"
#include <gtest/gtest.h>
namespace nix {
using std::string;
struct RewriteParams {
string originalString, finalString;
StringMap rewrites;
friend std::ostream& operator<<(std::ostream& os, const RewriteParams& bar) {
StringSet strRewrites;
for (auto & [from, to] ... | 1,281 | C++ | .cc | 37 | 29.27027 | 95 | 0.644534 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,943 | git.cc | NixOS_nix/src/libutil-tests/git.cc | #include <gtest/gtest.h>
#include "git.hh"
#include "memory-source-accessor.hh"
#include "tests/characterization.hh"
namespace nix {
using namespace git;
class GitTest : public CharacterizationTest
{
std::filesystem::path unitTestData = getUnitTestData() / "git";
public:
std::filesystem::path goldenMaste... | 7,627 | C++ | .cc | 226 | 25.053097 | 100 | 0.568228 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,944 | xml-writer.cc | NixOS_nix/src/libutil-tests/xml-writer.cc | #include "xml-writer.hh"
#include <gtest/gtest.h>
#include <sstream>
namespace nix {
/* ----------------------------------------------------------------------------
* XMLWriter
* --------------------------------------------------------------------------*/
TEST(XMLWriter, emptyObject) {
std:... | 2,945 | C++ | .cc | 85 | 25.247059 | 114 | 0.487324 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | true | false | false | true | false | false |
10,945 | terminal.cc | NixOS_nix/src/libutil-tests/terminal.cc | #include "util.hh"
#include "types.hh"
#include "terminal.hh"
#include "strings.hh"
#include <limits.h>
#include <gtest/gtest.h>
#include <numeric>
namespace nix {
/* ----------------------------------------------------------------------------
* filterANSIEscapes
* ------------------------------------------------... | 1,776 | C++ | .cc | 50 | 31.64 | 107 | 0.617788 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,946 | lru-cache.cc | NixOS_nix/src/libutil-tests/lru-cache.cc | #include "lru-cache.hh"
#include <gtest/gtest.h>
namespace nix {
/* ----------------------------------------------------------------------------
* size
* --------------------------------------------------------------------------*/
TEST(LRUCache, sizeOfEmptyCacheIsZero) {
LRUCache<std::strin... | 4,093 | C++ | .cc | 107 | 30.682243 | 83 | 0.464295 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | true | false | false | true | false | false |
10,947 | canon-path.cc | NixOS_nix/src/libutil-tests/canon-path.cc | #include "canon-path.hh"
#include <gtest/gtest.h>
namespace nix {
TEST(CanonPath, basic) {
{
CanonPath p("/");
ASSERT_EQ(p.abs(), "/");
ASSERT_EQ(p.rel(), "");
ASSERT_EQ(p.baseName(), std::nullopt);
ASSERT_EQ(p.dirOf(), std::nullopt);
... | 6,053 | C++ | .cc | 159 | 28.18239 | 80 | 0.505704 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,948 | json-utils.cc | NixOS_nix/src/libutil-tests/json-utils.cc | #include <vector>
#include <optional>
#include <gtest/gtest.h>
#include "error.hh"
#include "json-utils.hh"
namespace nix {
/* Test `to_json` and `from_json` with `std::optional` types.
* We are specifically interested in whether we can _nest_ optionals in STL
* containers so we that we can leverage existing adl_... | 5,778 | C++ | .cc | 139 | 37.568345 | 100 | 0.645669 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,949 | spawn.cc | NixOS_nix/src/libutil-tests/spawn.cc | #include <gtest/gtest.h>
#include "processes.hh"
namespace nix {
#ifdef _WIN32
TEST(SpawnTest, spawnEcho)
{
auto output = runProgram(RunOptions{.program = "cmd.exe", .args = {"/C", "echo", "hello world"}});
ASSERT_EQ(output.first, 0);
ASSERT_EQ(output.second, "\"hello world\"\r\n");
}
std::string window... | 1,039 | C++ | .cc | 28 | 33.678571 | 102 | 0.664008 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,950 | hash.cc | NixOS_nix/src/libutil-tests/hash.cc | #include <regex>
#include <gtest/gtest.h>
#include "hash.hh"
namespace nix {
/* ----------------------------------------------------------------------------
* hashString
* --------------------------------------------------------------------------*/
TEST(hashString, testKnownMD5Hashes1) {
... | 4,024 | C++ | .cc | 76 | 44.631579 | 132 | 0.642675 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
10,951 | compression.cc | NixOS_nix/src/libutil-tests/compression.cc | #include "compression.hh"
#include <gtest/gtest.h>
namespace nix {
/* ----------------------------------------------------------------------------
* compress / decompress
* --------------------------------------------------------------------------*/
TEST(compress, compressWithUnknownMethod) {
... | 3,155 | C++ | .cc | 72 | 36.319444 | 100 | 0.589735 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | true | false | false | true | false | false |
10,952 | strings.cc | NixOS_nix/src/libutil-tests/strings.cc | #include <gtest/gtest.h>
#include <rapidcheck/gtest.h>
#include "strings.hh"
namespace nix {
using Strings = std::vector<std::string>;
/* ----------------------------------------------------------------------------
* concatStringsSep
* --------------------------------------------------------------------------*/
... | 8,596 | C++ | .cc | 261 | 29.609195 | 106 | 0.625849 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,953 | nix_api_util.cc | NixOS_nix/src/libutil-tests/nix_api_util.cc | #include "config-global.hh"
#include "args.hh"
#include "nix_api_util.h"
#include "nix_api_util_internal.h"
#include "tests/nix_api_util.hh"
#include "tests/string_callback.hh"
#include <gtest/gtest.h>
#include <memory>
namespace nixC {
TEST_F(nix_api_util_context, nix_context_error)
{
std::string err_msg_ref;
... | 4,364 | C++ | .cc | 129 | 29.069767 | 88 | 0.645115 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,954 | suggestions.cc | NixOS_nix/src/libutil-tests/suggestions.cc | #include "suggestions.hh"
#include <gtest/gtest.h>
namespace nix {
struct LevenshteinDistanceParam {
std::string s1, s2;
int distance;
};
class LevenshteinDistanceTest :
public testing::TestWithParam<LevenshteinDistanceParam> {
};
TEST_P(LevenshteinDistanceTest, Correctly... | 1,452 | C++ | .cc | 35 | 32.485714 | 90 | 0.622427 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | true | false | false | true | false | false |
10,955 | args.cc | NixOS_nix/src/libutil-tests/args.cc | #include "args.hh"
#include "fs-sink.hh"
#include <list>
#include <gtest/gtest.h>
#include <rapidcheck/gtest.h>
namespace nix {
TEST(parseShebangContent, basic) {
std::list<std::string> r = parseShebangContent("hi there");
ASSERT_EQ(r.size(), 2);
auto i = r.begin();
ASSERT_EQ(*i++... | 4,736 | C++ | .cc | 140 | 26.742857 | 126 | 0.52824 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,956 | position.cc | NixOS_nix/src/libutil-tests/position.cc | #include <gtest/gtest.h>
#include "position.hh"
namespace nix {
inline Pos::Origin makeStdin(std::string s)
{
return Pos::Stdin{make_ref<std::string>(s)};
}
TEST(Position, getSnippetUpTo_0)
{
Pos::Origin o = makeStdin("");
Pos p(1, 1, o);
ASSERT_EQ(p.getSnippetUpTo(p), "");
}
TEST(Position, getSnipp... | 3,517 | C++ | .cc | 113 | 24.663717 | 113 | 0.571723 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,957 | hilite.cc | NixOS_nix/src/libutil-tests/hilite.cc | #include "hilite.hh"
#include <gtest/gtest.h>
namespace nix {
/* ----------- tests for fmt.hh -------------------------------------------------*/
TEST(hiliteMatches, noHighlight) {
ASSERT_STREQ(hiliteMatches("Hello, world!", std::vector<std::smatch>(), "(", ")").c_str(), "Hello, world!");
}
TEST... | 2,600 | C++ | .cc | 59 | 34.067797 | 116 | 0.519337 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
10,958 | file-system.cc | NixOS_nix/src/libutil-tests/file-system.cc | #include "util.hh"
#include "types.hh"
#include "file-system.hh"
#include "processes.hh"
#include "terminal.hh"
#include "strings.hh"
#include <limits.h>
#include <gtest/gtest.h>
#include <rapidcheck/gtest.h>
#include <numeric>
#ifdef _WIN32
# define FS_SEP L"\\"
# define FS_ROOT L"C:" FS_SEP // Need a mounted one... | 6,265 | C++ | .cc | 211 | 27.028436 | 102 | 0.532911 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,959 | file-content-address.cc | NixOS_nix/src/libutil-tests/file-content-address.cc | #include <gtest/gtest.h>
#include "file-content-address.hh"
namespace nix {
/* ----------------------------------------------------------------------------
* parseFileSerialisationMethod, renderFileSerialisationMethod
* --------------------------------------------------------------------------*/
TEST(FileSerialis... | 1,904 | C++ | .cc | 50 | 33.42 | 91 | 0.617472 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,960 | nix-instantiate.cc | NixOS_nix/src/nix-instantiate/nix-instantiate.cc | #include "globals.hh"
#include "print-ambiguous.hh"
#include "shared.hh"
#include "eval.hh"
#include "eval-inline.hh"
#include "get-drvs.hh"
#include "attr-path.hh"
#include "signals.hh"
#include "value-to-xml.hh"
#include "value-to-json.hh"
#include "store-api.hh"
#include "local-fs-store.hh"
#include "common-eval-arg... | 6,797 | C++ | .cc | 170 | 28.694118 | 117 | 0.527887 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
10,961 | nix-collect-garbage.cc | NixOS_nix/src/nix-collect-garbage/nix-collect-garbage.cc | #include "file-system.hh"
#include "signals.hh"
#include "store-api.hh"
#include "store-cast.hh"
#include "gc-store.hh"
#include "profiles.hh"
#include "shared.hh"
#include "globals.hh"
#include "legacy.hh"
#include <iostream>
#include <cerrno>
namespace nix::fs { using namespace std::filesystem; }
using namespace n... | 3,440 | C++ | .cc | 91 | 28.142857 | 100 | 0.554788 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,962 | tracing-file-system-object-sink.cc | NixOS_nix/src/libutil-test-support/tests/tracing-file-system-object-sink.cc | #include <iostream>
#include "tracing-file-system-object-sink.hh"
namespace nix::test {
void TracingFileSystemObjectSink::createDirectory(const CanonPath & path)
{
std::cerr << "createDirectory(" << path << ")\n";
sink.createDirectory(path);
}
void TracingFileSystemObjectSink::createRegularFile(
const Ca... | 1,089 | C++ | .cc | 28 | 35.678571 | 106 | 0.698578 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,963 | string_callback.cc | NixOS_nix/src/libutil-test-support/tests/string_callback.cc | #include "string_callback.hh"
namespace nix::testing {
void observe_string_cb(const char * start, unsigned int n, void * user_data)
{
auto user_data_casted = reinterpret_cast<std::string *>(user_data);
*user_data_casted = std::string(start);
}
}
| 257 | C++ | .cc | 8 | 29.75 | 76 | 0.719512 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,964 | hash.cc | NixOS_nix/src/libutil-test-support/tests/hash.cc | #include <regex>
#include <rapidcheck.h>
#include "hash.hh"
#include "tests/hash.hh"
namespace rc {
using namespace nix;
Gen<Hash> Arbitrary<Hash>::arbitrary()
{
Hash prototype(HashAlgorithm::SHA1);
return
gen::apply(
[](const std::vector<uint8_t> & v) {
Hash hash(HashAl... | 601 | C++ | .cc | 21 | 21.428571 | 95 | 0.571429 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,965 | installable-flake.cc | NixOS_nix/src/libcmd/installable-flake.cc | #include "globals.hh"
#include "installable-flake.hh"
#include "installable-derived-path.hh"
#include "outputs-spec.hh"
#include "util.hh"
#include "command.hh"
#include "attr-path.hh"
#include "common-eval-args.hh"
#include "derivations.hh"
#include "eval-inline.hh"
#include "eval.hh"
#include "get-drvs.hh"
#include "... | 6,807 | C++ | .cc | 184 | 28.706522 | 99 | 0.606102 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,966 | repl.cc | NixOS_nix/src/libcmd/repl.cc | #include <iostream>
#include <cstdlib>
#include <cstring>
#include "error.hh"
#include "repl-interacter.hh"
#include "repl.hh"
#include "ansicolor.hh"
#include "shared.hh"
#include "eval.hh"
#include "eval-settings.hh"
#include "attr-path.hh"
#include "signals.hh"
#include "store-api.hh"
#include "log-store.hh"
#incl... | 29,106 | C++ | .cc | 745 | 30.071141 | 204 | 0.547299 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,967 | installable-attr-path.cc | NixOS_nix/src/libcmd/installable-attr-path.cc | #include "globals.hh"
#include "installable-attr-path.hh"
#include "outputs-spec.hh"
#include "util.hh"
#include "command.hh"
#include "attr-path.hh"
#include "common-eval-args.hh"
#include "derivations.hh"
#include "eval-inline.hh"
#include "eval.hh"
#include "get-drvs.hh"
#include "store-api.hh"
#include "shared.hh"
... | 3,606 | C++ | .cc | 106 | 27.349057 | 88 | 0.641011 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,968 | legacy.cc | NixOS_nix/src/libcmd/legacy.cc | #include "legacy.hh"
namespace nix {
RegisterLegacyCommand::Commands * RegisterLegacyCommand::commands = 0;
}
| 113 | C++ | .cc | 4 | 26.5 | 70 | 0.811321 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | true | false | false | true | false | false |
10,969 | built-path.cc | NixOS_nix/src/libcmd/built-path.cc | #include "built-path.hh"
#include "derivations.hh"
#include "store-api.hh"
#include "comparator.hh"
#include <nlohmann/json.hpp>
#include <optional>
namespace nix {
// Custom implementation to avoid `ref` ptr equality
GENERATE_CMP_EXT(
,
std::strong_ordering,
SingleBuiltPathBuilt,
*me->drvPath,
... | 4,275 | C++ | .cc | 128 | 24.664063 | 115 | 0.5771 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,970 | common-eval-args.cc | NixOS_nix/src/libcmd/common-eval-args.cc | #include "fetch-settings.hh"
#include "eval-settings.hh"
#include "common-eval-args.hh"
#include "shared.hh"
#include "config-global.hh"
#include "filetransfer.hh"
#include "eval.hh"
#include "fetchers.hh"
#include "registry.hh"
#include "flake/flakeref.hh"
#include "flake/settings.hh"
#include "store-api.hh"
#include ... | 7,094 | C++ | .cc | 170 | 34.135294 | 229 | 0.620595 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,971 | installable-derived-path.cc | NixOS_nix/src/libcmd/installable-derived-path.cc | #include "installable-derived-path.hh"
#include "derivations.hh"
namespace nix {
std::string InstallableDerivedPath::what() const
{
return derivedPath.to_string(*store);
}
DerivedPathsWithInfo InstallableDerivedPath::toDerivedPaths()
{
return {{
.path = derivedPath,
.info = make_ref<ExtraPath... | 1,605 | C++ | .cc | 49 | 26.081633 | 93 | 0.647097 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,972 | repl-interacter.cc | NixOS_nix/src/libcmd/repl-interacter.cc | #include <cstdio>
#ifdef USE_READLINE
#include <readline/history.h>
#include <readline/readline.h>
#else
// editline < 1.15.2 don't wrap their API for C++ usage
// (added in https://github.com/troglobit/editline/commit/91398ceb3427b730995357e9d120539fb9bb7461).
// This results in linker errors due to to name-mangling ... | 5,585 | C++ | .cc | 177 | 25.711864 | 100 | 0.621863 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,973 | command.cc | NixOS_nix/src/libcmd/command.cc | #include <algorithm>
#include <nlohmann/json.hpp>
#include "command.hh"
#include "markdown.hh"
#include "store-api.hh"
#include "local-fs-store.hh"
#include "derivations.hh"
#include "nixexpr.hh"
#include "profiles.hh"
#include "repl.hh"
#include "strings.hh"
#include "environment-variables.hh"
namespace nix {
Regis... | 10,520 | C++ | .cc | 312 | 26.807692 | 120 | 0.611308 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,974 | installables.cc | NixOS_nix/src/libcmd/installables.cc | #include "globals.hh"
#include "installables.hh"
#include "installable-derived-path.hh"
#include "installable-attr-path.hh"
#include "installable-flake.hh"
#include "outputs-spec.hh"
#include "users.hh"
#include "util.hh"
#include "command.hh"
#include "attr-path.hh"
#include "common-eval-args.hh"
#include "derivations... | 31,288 | C++ | .cc | 812 | 28.511084 | 161 | 0.575822 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
10,975 | installable-value.cc | NixOS_nix/src/libcmd/installable-value.cc | #include "installable-value.hh"
#include "eval-cache.hh"
#include "fetch-to-store.hh"
namespace nix {
std::vector<ref<eval_cache::AttrCursor>>
InstallableValue::getCursors(EvalState & state)
{
auto evalCache =
std::make_shared<nix::eval_cache::EvalCache>(std::nullopt, state,
[&]() { return toV... | 2,073 | C++ | .cc | 58 | 30.448276 | 136 | 0.686783 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,976 | editor-for.cc | NixOS_nix/src/libcmd/editor-for.cc | #include "editor-for.hh"
#include "environment-variables.hh"
#include "source-path.hh"
namespace nix {
Strings editorFor(const SourcePath & file, uint32_t line)
{
auto path = file.getPhysicalPath();
if (!path)
throw Error("cannot open '%s' in an editor because it has no physical path", file);
auto... | 741 | C++ | .cc | 21 | 30.52381 | 91 | 0.62901 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,977 | command-installable-value.cc | NixOS_nix/src/libcmd/command-installable-value.cc | #include "command-installable-value.hh"
namespace nix {
void InstallableValueCommand::run(ref<Store> store, ref<Installable> installable)
{
auto installableValue = InstallableValue::require(installable);
run(store, installableValue);
}
}
| 249 | C++ | .cc | 8 | 28.75 | 81 | 0.798319 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,978 | network-proxy.cc | NixOS_nix/src/libcmd/network-proxy.cc | #include "network-proxy.hh"
#include <algorithm>
#include "environment-variables.hh"
namespace nix {
static const StringSet lowercaseVariables{"http_proxy", "https_proxy", "ftp_proxy", "all_proxy", "no_proxy"};
static StringSet getAllVariables()
{
StringSet variables = lowercaseVariables;
for (const auto &... | 1,355 | C++ | .cc | 40 | 28.925 | 118 | 0.710345 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,979 | misc-store-flags.cc | NixOS_nix/src/libcmd/misc-store-flags.cc | #include "misc-store-flags.hh"
namespace nix::flag
{
static void hashFormatCompleter(AddCompletions & completions, size_t index, std::string_view prefix)
{
for (auto & format : hashFormats) {
if (hasPrefix(format, prefix)) {
completions.add(format);
}
}
}
Args::Flag hashFormatWith... | 4,559 | C++ | .cc | 120 | 30.666667 | 115 | 0.612342 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,980 | markdown.cc | NixOS_nix/src/libcmd/markdown.cc | #include "markdown.hh"
#include "environment-variables.hh"
#include "error.hh"
#include "finally.hh"
#include "terminal.hh"
#if HAVE_LOWDOWN
# include <sys/queue.h>
# include <lowdown.h>
#endif
namespace nix {
#if HAVE_LOWDOWN
static std::string doRenderMarkdownToTerminal(std::string_view markdown)
{
int windo... | 2,043 | C++ | .cc | 60 | 29.433333 | 89 | 0.667513 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
10,981 | common-protocol.cc | NixOS_nix/src/libstore-tests/common-protocol.cc | #include <regex>
#include <nlohmann/json.hpp>
#include <gtest/gtest.h>
#include "common-protocol.hh"
#include "common-protocol-impl.hh"
#include "build-result.hh"
#include "tests/protocol.hh"
#include "tests/characterization.hh"
namespace nix {
const char commonProtoDir[] = "common-protocol";
class CommonProtoTest... | 5,476 | C++ | .cc | 169 | 23.852071 | 134 | 0.557448 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,982 | ssh-store.cc | NixOS_nix/src/libstore-tests/ssh-store.cc | // FIXME: Odd failures for templates that are causing the PR to break
// for now with discussion with @Ericson2314 to comment out.
#if 0
# include <gtest/gtest.h>
# include "ssh-store.hh"
namespace nix {
TEST(SSHStore, constructConfig)
{
SSHStoreConfig config{
"ssh",
"localhost",
StoreC... | 1,066 | C++ | .cc | 48 | 14.229167 | 69 | 0.501484 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,983 | path-info.cc | NixOS_nix/src/libstore-tests/path-info.cc | #include <nlohmann/json.hpp>
#include <gtest/gtest.h>
#include "path-info.hh"
#include "tests/characterization.hh"
#include "tests/libstore.hh"
namespace nix {
using nlohmann::json;
class PathInfoTest : public CharacterizationTest, public LibStoreTest
{
std::filesystem::path unitTestData = getUnitTestData() / ... | 3,760 | C++ | .cc | 87 | 35.229885 | 83 | 0.496037 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,984 | legacy-ssh-store.cc | NixOS_nix/src/libstore-tests/legacy-ssh-store.cc | #include <gtest/gtest.h>
#include "legacy-ssh-store.hh"
namespace nix {
TEST(LegacySSHStore, constructConfig)
{
LegacySSHStoreConfig config{
"ssh",
"localhost",
StoreConfig::Params{
{
"remote-program",
// TODO #11106, no more split on space
... | 494 | C++ | .cc | 23 | 13.391304 | 54 | 0.491453 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,985 | references.cc | NixOS_nix/src/libstore-tests/references.cc | #include "references.hh"
#include <gtest/gtest.h>
namespace nix {
TEST(references, scan)
{
std::string hash1 = "dc04vv14dak1c1r48qa0m23vr9jy8sm0";
std::string hash2 = "zc842j0rz61mjsp3h3wp5ly71ak6qgdn";
{
RefScanSink scanner(StringSet{hash1});
auto s = "foobar";
scanner(s);
... | 1,220 | C++ | .cc | 37 | 26.243243 | 66 | 0.595745 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | true | false | false | true | false | false |
10,986 | serve-protocol.cc | NixOS_nix/src/libstore-tests/serve-protocol.cc | #include <thread>
#include <regex>
#include <nlohmann/json.hpp>
#include <gtest/gtest.h>
#include "serve-protocol.hh"
#include "serve-protocol-impl.hh"
#include "serve-protocol-connection.hh"
#include "build-result.hh"
#include "file-descriptor.hh"
#include "tests/protocol.hh"
#include "tests/characterization.hh"
na... | 15,803 | C++ | .cc | 472 | 22.849576 | 134 | 0.534742 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,987 | path.cc | NixOS_nix/src/libstore-tests/path.cc | #include <regex>
#include <nlohmann/json.hpp>
#include <gtest/gtest.h>
#include <rapidcheck/gtest.h>
#include "path-regex.hh"
#include "store-api.hh"
#include "tests/hash.hh"
#include "tests/libstore.hh"
#include "tests/path.hh"
namespace nix {
#define STORE_DIR "/nix/store/"
#define HASH_PART "g1w7hy3qg1w7hy3qg1w... | 5,434 | C++ | .cc | 144 | 29.715278 | 85 | 0.462123 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,988 | machines.cc | NixOS_nix/src/libstore-tests/machines.cc | #include "machines.hh"
#include "file-system.hh"
#include "util.hh"
#include "tests/characterization.hh"
#include <gtest/gtest.h>
#include <gmock/gmock-matchers.h>
using testing::Contains;
using testing::ElementsAre;
using testing::Eq;
using testing::Field;
using testing::SizeIs;
namespace nix::fs { using namespace... | 7,915 | C++ | .cc | 148 | 48.763514 | 118 | 0.697521 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,989 | http-binary-cache-store.cc | NixOS_nix/src/libstore-tests/http-binary-cache-store.cc | #include <gtest/gtest.h>
#include "http-binary-cache-store.hh"
namespace nix {
TEST(HttpBinaryCacheStore, constructConfig)
{
HttpBinaryCacheStoreConfig config{"http", "foo.bar.baz", {}};
EXPECT_EQ(config.cacheUri, "http://foo.bar.baz");
}
TEST(HttpBinaryCacheStore, constructConfigNoTrailingSlash)
{
Htt... | 467 | C++ | .cc | 14 | 30.714286 | 71 | 0.73991 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,990 | derivation-advanced-attrs.cc | NixOS_nix/src/libstore-tests/derivation-advanced-attrs.cc | #include <gtest/gtest.h>
#include <optional>
#include "experimental-features.hh"
#include "derivations.hh"
#include "tests/libstore.hh"
#include "tests/characterization.hh"
#include "parsed-derivations.hh"
#include "types.hh"
#include "json-utils.hh"
namespace nix {
using nlohmann::json;
class DerivationAdvancedAt... | 12,454 | C++ | .cc | 197 | 52.395939 | 119 | 0.532733 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,991 | nar-info-disk-cache.cc | NixOS_nix/src/libstore-tests/nar-info-disk-cache.cc | #include "nar-info-disk-cache.hh"
#include <gtest/gtest.h>
#include <rapidcheck/gtest.h>
#include "sqlite.hh"
#include <sqlite3.h>
namespace nix {
TEST(NarInfoDiskCacheImpl, create_and_read) {
// This is a large single test to avoid some setup overhead.
int prio = 12345;
bool wantMassQuery = true;
... | 4,114 | C++ | .cc | 100 | 31.75 | 113 | 0.580306 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,992 | uds-remote-store.cc | NixOS_nix/src/libstore-tests/uds-remote-store.cc | // FIXME: Odd failures for templates that are causing the PR to break
// for now with discussion with @Ericson2314 to comment out.
#if 0
# include <gtest/gtest.h>
# include "uds-remote-store.hh"
namespace nix {
TEST(UDSRemoteStore, constructConfig)
{
UDSRemoteStoreConfig config{"unix", "/tmp/socket", {}};
... | 522 | C++ | .cc | 17 | 28.647059 | 78 | 0.743487 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,993 | worker-protocol.cc | NixOS_nix/src/libstore-tests/worker-protocol.cc | #include <regex>
#include <thread>
#include <nlohmann/json.hpp>
#include <gtest/gtest.h>
#include "worker-protocol.hh"
#include "worker-protocol-connection.hh"
#include "worker-protocol-impl.hh"
#include "derived-path.hh"
#include "build-result.hh"
#include "tests/protocol.hh"
#include "tests/characterization.hh"
na... | 25,179 | C++ | .cc | 725 | 22.768276 | 134 | 0.51566 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,994 | local-binary-cache-store.cc | NixOS_nix/src/libstore-tests/local-binary-cache-store.cc | #include <gtest/gtest.h>
#include "local-binary-cache-store.hh"
namespace nix {
TEST(LocalBinaryCacheStore, constructConfig)
{
LocalBinaryCacheStoreConfig config{"local", "/foo/bar/baz", {}};
EXPECT_EQ(config.binaryCacheDir, "/foo/bar/baz");
}
} // namespace nix
| 276 | C++ | .cc | 9 | 28.222222 | 68 | 0.748092 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,995 | derived-path.cc | NixOS_nix/src/libstore-tests/derived-path.cc | #include <regex>
#include <gtest/gtest.h>
#include <rapidcheck/gtest.h>
#include "tests/derived-path.hh"
#include "tests/libstore.hh"
namespace nix {
class DerivedPathTest : public LibStoreTest
{
};
/**
* Round trip (string <-> data structure) test for
* `DerivedPath::Opaque`.
*/
TEST_F(DerivedPathTest, opaque)... | 3,058 | C++ | .cc | 86 | 31.988372 | 100 | 0.699459 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,996 | local-overlay-store.cc | NixOS_nix/src/libstore-tests/local-overlay-store.cc | // FIXME: Odd failures for templates that are causing the PR to break
// for now with discussion with @Ericson2314 to comment out.
#if 0
# include <gtest/gtest.h>
# include "local-overlay-store.hh"
namespace nix {
TEST(LocalOverlayStore, constructConfig_rootQueryParam)
{
LocalOverlayStoreConfig config{
... | 742 | C++ | .cc | 27 | 22.222222 | 69 | 0.637006 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,997 | outputs-spec.cc | NixOS_nix/src/libstore-tests/outputs-spec.cc | #include "tests/outputs-spec.hh"
#include <nlohmann/json.hpp>
#include <gtest/gtest.h>
#include <rapidcheck/gtest.h>
namespace nix {
TEST(OutputsSpec, no_empty_names) {
ASSERT_DEATH(OutputsSpec::Names { std::set<std::string> { } }, "");
}
#define TEST_DONT_PARSE(NAME, STR) \
TEST(OutputsSpec, bad_... | 7,326 | C++ | .cc | 170 | 38.635294 | 122 | 0.620186 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,998 | local-store.cc | NixOS_nix/src/libstore-tests/local-store.cc | // FIXME: Odd failures for templates that are causing the PR to break
// for now with discussion with @Ericson2314 to comment out.
#if 0
# include <gtest/gtest.h>
# include "local-store.hh"
// Needed for template specialisations. This is not good! When we
// overhaul how store configs work, this should be fixed.
# ... | 905 | C++ | .cc | 32 | 23.65625 | 69 | 0.646243 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
10,999 | s3-binary-cache-store.cc | NixOS_nix/src/libstore-tests/s3-binary-cache-store.cc | #if ENABLE_S3
# include <gtest/gtest.h>
# include "s3-binary-cache-store.hh"
namespace nix {
TEST(S3BinaryCacheStore, constructConfig)
{
S3BinaryCacheStoreConfig config{"s3", "foobar", {}};
EXPECT_EQ(config.bucketName, "foobar");
}
} // namespace nix
#endif
| 275 | C++ | .cc | 11 | 22.636364 | 56 | 0.735409 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,000 | nar-info.cc | NixOS_nix/src/libstore-tests/nar-info.cc | #include <nlohmann/json.hpp>
#include <gtest/gtest.h>
#include "path-info.hh"
#include "nar-info.hh"
#include "tests/characterization.hh"
#include "tests/libstore.hh"
namespace nix {
using nlohmann::json;
class NarInfoTest : public CharacterizationTest, public LibStoreTest
{
std::filesystem::path unitTestData ... | 3,382 | C++ | .cc | 74 | 36.243243 | 94 | 0.435983 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,001 | content-address.cc | NixOS_nix/src/libstore-tests/content-address.cc | #include <gtest/gtest.h>
#include "content-address.hh"
namespace nix {
/* ----------------------------------------------------------------------------
* ContentAddressMethod::parse, ContentAddressMethod::render
* --------------------------------------------------------------------------*/
TEST(ContentAddressMetho... | 1,037 | C++ | .cc | 30 | 29.666667 | 79 | 0.588 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,002 | nix_api_store.cc | NixOS_nix/src/libstore-tests/nix_api_store.cc | #include "nix_api_util.h"
#include "nix_api_util_internal.h"
#include "nix_api_store.h"
#include "nix_api_store_internal.h"
#include "tests/nix_api_store.hh"
#include "tests/string_callback.hh"
namespace nixC {
std::string PATH_SUFFIX = "/g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-name";
TEST_F(nix_api_util_context, nix_libs... | 2,513 | C++ | .cc | 73 | 31.342466 | 95 | 0.693894 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,003 | store-reference.cc | NixOS_nix/src/libstore-tests/store-reference.cc | #include <nlohmann/json.hpp>
#include <gtest/gtest.h>
#include "file-system.hh"
#include "store-reference.hh"
#include "tests/characterization.hh"
#include "tests/libstore.hh"
namespace nix {
using nlohmann::json;
class StoreReferenceTest : public CharacterizationTest, public LibStoreTest
{
std::filesystem::pa... | 3,390 | C++ | .cc | 101 | 26.445545 | 97 | 0.464034 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,004 | downstream-placeholder.cc | NixOS_nix/src/libstore-tests/downstream-placeholder.cc | #include <gtest/gtest.h>
#include "downstream-placeholder.hh"
namespace nix {
TEST(DownstreamPlaceholder, unknownCaOutput) {
/**
* We set these in tests rather than the regular globals so we don't have
* to worry about race conditions if the tests run concurrently.
*/
ExperimentalFeatureSettin... | 1,274 | C++ | .cc | 34 | 30.117647 | 86 | 0.694242 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,005 | derivation.cc | NixOS_nix/src/libstore-tests/derivation.cc | #include <nlohmann/json.hpp>
#include <gtest/gtest.h>
#include "experimental-features.hh"
#include "derivations.hh"
#include "tests/libstore.hh"
#include "tests/characterization.hh"
namespace nix {
using nlohmann::json;
class DerivationTest : public CharacterizationTest, public LibStoreTest
{
std::filesystem::... | 11,012 | C++ | .cc | 268 | 30.835821 | 106 | 0.421264 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,006 | nixexpr.cc | NixOS_nix/src/libexpr/nixexpr.cc | #include "nixexpr.hh"
#include "eval.hh"
#include "symbol-table.hh"
#include "util.hh"
#include "print.hh"
#include <cstdlib>
#include <sstream>
#include "strings-inline.hh"
namespace nix {
unsigned long Expr::nrExprs = 0;
ExprBlackHole eBlackHole;
// FIXME: remove, because *symbols* are abstract and do not have ... | 19,719 | C++ | .cc | 579 | 28.366149 | 130 | 0.613164 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,007 | primops.cc | NixOS_nix/src/libexpr/primops.cc | #include "derivations.hh"
#include "downstream-placeholder.hh"
#include "eval-inline.hh"
#include "eval.hh"
#include "eval-settings.hh"
#include "gc-small-vector.hh"
#include "json-to-value.hh"
#include "names.hh"
#include "path-references.hh"
#include "store-api.hh"
#include "util.hh"
#include "processes.hh"
#include ... | 177,676 | C++ | .cc | 4,199 | 35.076447 | 237 | 0.618836 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,008 | json-to-value.cc | NixOS_nix/src/libexpr/json-to-value.cc | #include "json-to-value.hh"
#include "value.hh"
#include "eval.hh"
#include <limits>
#include <variant>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
namespace nix {
// for more information, refer to
// https://github.com/nlohmann/json/blob/master/include/nlohmann/detail/input/json_sax.hpp
class JSONSax... | 4,823 | C++ | .cc | 157 | 23.254777 | 103 | 0.578721 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
11,009 | attr-set.cc | NixOS_nix/src/libexpr/attr-set.cc | #include "attr-set.hh"
#include "eval-inline.hh"
#include <algorithm>
namespace nix {
/* Allocate a new array of attributes for an attribute set with a specific
capacity. The space is implicitly reserved after the Bindings
structure. */
Bindings * EvalState::allocBindings(size_t capacity)
{
if (capacity... | 1,130 | C++ | .cc | 37 | 27.216216 | 110 | 0.709378 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
11,010 | print.cc | NixOS_nix/src/libexpr/print.cc | #include <limits>
#include <unordered_set>
#include <sstream>
#include "print.hh"
#include "ansicolor.hh"
#include "signals.hh"
#include "store-api.hh"
#include "terminal.hh"
#include "english.hh"
#include "eval.hh"
namespace nix {
void printElided(
std::ostream & output,
unsigned int value,
const std::s... | 17,523 | C++ | .cc | 552 | 22.480072 | 124 | 0.520996 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,011 | get-drvs.cc | NixOS_nix/src/libexpr/get-drvs.cc | #include "get-drvs.hh"
#include "eval-inline.hh"
#include "derivations.hh"
#include "store-api.hh"
#include "path-with-outputs.hh"
#include <cstring>
#include <regex>
namespace nix {
PackageInfo::PackageInfo(EvalState & state, std::string attrPath, const Bindings * attrs)
: state(&state), attrs(attrs), attrPat... | 14,113 | C++ | .cc | 344 | 33.47093 | 168 | 0.613361 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,012 | eval-gc.cc | NixOS_nix/src/libexpr/eval-gc.cc | #include "error.hh"
#include "environment-variables.hh"
#include "eval-settings.hh"
#include "config-global.hh"
#include "serialise.hh"
#include "eval-gc.hh"
#if HAVE_BOEHMGC
# include <pthread.h>
# if __FreeBSD__
# include <pthread_np.h>
# endif
# include <gc/gc.h>
# include <gc/gc_cpp.h>
# include <gc/gc_... | 3,057 | C++ | .cc | 92 | 28.902174 | 108 | 0.67517 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,013 | eval-error.cc | NixOS_nix/src/libexpr/eval-error.cc | #include "eval-error.hh"
#include "eval.hh"
#include "value.hh"
namespace nix {
template<class T>
EvalErrorBuilder<T> & EvalErrorBuilder<T>::withExitStatus(unsigned int exitStatus)
{
error.withExitStatus(exitStatus);
return *this;
}
template<class T>
EvalErrorBuilder<T> & EvalErrorBuilder<T>::atPos(PosIdx po... | 3,218 | C++ | .cc | 97 | 30.309278 | 228 | 0.754832 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,014 | paths.cc | NixOS_nix/src/libexpr/paths.cc | #include "eval.hh"
namespace nix {
SourcePath EvalState::rootPath(CanonPath path)
{
return {rootFS, std::move(path)};
}
SourcePath EvalState::rootPath(PathView path)
{
return {rootFS, CanonPath(absPath(path))};
}
}
| 227 | C++ | .cc | 11 | 18.545455 | 46 | 0.75 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,015 | eval-settings.cc | NixOS_nix/src/libexpr/eval-settings.cc | #include "users.hh"
#include "globals.hh"
#include "profiles.hh"
#include "eval.hh"
#include "eval-settings.hh"
namespace nix {
/* Very hacky way to parse $NIX_PATH, which is colon-separated, but
can contain URLs (e.g. "nixpkgs=https://bla...:foo=https://"). */
Strings EvalSettings::parseNixPath(const std::string ... | 2,812 | C++ | .cc | 88 | 25.715909 | 148 | 0.556171 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,016 | eval.cc | NixOS_nix/src/libexpr/eval.cc | #include "eval.hh"
#include "eval-settings.hh"
#include "primops.hh"
#include "print-options.hh"
#include "exit.hh"
#include "types.hh"
#include "util.hh"
#include "store-api.hh"
#include "derivations.hh"
#include "downstream-placeholder.hh"
#include "eval-inline.hh"
#include "filetransfer.hh"
#include "function-trace.... | 103,156 | C++ | .cc | 2,700 | 29.462963 | 182 | 0.575607 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,017 | value-to-xml.cc | NixOS_nix/src/libexpr/value-to-xml.cc | #include "value-to-xml.hh"
#include "xml-writer.hh"
#include "eval-inline.hh"
#include "signals.hh"
#include <cstdlib>
namespace nix {
static XMLAttrs singletonAttrs(const std::string & name, std::string_view value)
{
XMLAttrs attrs;
attrs[name] = value;
return attrs;
}
static void printValueAsXML(Ev... | 5,697 | C++ | .cc | 135 | 32.088889 | 114 | 0.582065 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,018 | function-trace.cc | NixOS_nix/src/libexpr/function-trace.cc | #include "function-trace.hh"
#include "logging.hh"
namespace nix {
FunctionCallTrace::FunctionCallTrace(const Pos & pos) : pos(pos) {
auto duration = std::chrono::high_resolution_clock::now().time_since_epoch();
auto ns = std::chrono::duration_cast<std::chrono::nanoseconds>(duration);
printMsg(lvlInfo, "f... | 659 | C++ | .cc | 14 | 44.071429 | 81 | 0.711388 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | true | false | false | true | false | false |
11,019 | attr-path.cc | NixOS_nix/src/libexpr/attr-path.cc | #include "attr-path.hh"
#include "eval-inline.hh"
namespace nix {
static Strings parseAttrPath(std::string_view s)
{
Strings res;
std::string cur;
auto i = s.begin();
while (i != s.end()) {
if (*i == '.') {
res.push_back(cur);
cur.clear();
} else if (*i == '"'... | 4,282 | C++ | .cc | 112 | 28.9375 | 122 | 0.552415 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,020 | value-to-json.cc | NixOS_nix/src/libexpr/value-to-json.cc | #include "value-to-json.hh"
#include "eval-inline.hh"
#include "store-api.hh"
#include "signals.hh"
#include <cstdlib>
#include <iomanip>
#include <nlohmann/json.hpp>
namespace nix {
using json = nlohmann::json;
json printValueAsJSON(EvalState & state, bool strict,
Value & v, const PosIdx pos, NixStringContext &... | 3,470 | C++ | .cc | 102 | 22.784314 | 134 | 0.517622 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,021 | lexer-helpers.cc | NixOS_nix/src/libexpr/lexer-helpers.cc | #include "lexer-tab.hh"
#include "lexer-helpers.hh"
#include "parser-tab.hh"
void nix::lexer::internal::initLoc(YYLTYPE * loc)
{
loc->beginOffset = loc->endOffset = 0;
}
void nix::lexer::internal::adjustLoc(yyscan_t yyscanner, YYLTYPE * loc, const char * s, size_t len)
{
loc->stash();
LexerState & lexerS... | 941 | C++ | .cc | 25 | 32.6 | 99 | 0.705818 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,022 | print-ambiguous.cc | NixOS_nix/src/libexpr/print-ambiguous.cc | #include "print-ambiguous.hh"
#include "print.hh"
#include "signals.hh"
#include "eval.hh"
namespace nix {
// See: https://github.com/NixOS/nix/issues/9730
void printAmbiguous(
Value &v,
const SymbolTable &symbols,
std::ostream &str,
std::set<const void *> *seen,
int depth)
{
checkInterrupt();... | 2,818 | C++ | .cc | 97 | 20.072165 | 87 | 0.49058 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,023 | eval-cache.cc | NixOS_nix/src/libexpr/eval-cache.cc | #include "users.hh"
#include "eval-cache.hh"
#include "sqlite.hh"
#include "eval.hh"
#include "eval-inline.hh"
#include "store-api.hh"
// Need specialization involving `SymbolStr` just in this one module.
#include "strings-inline.hh"
namespace nix::eval_cache {
CachedEvalError::CachedEvalError(ref<AttrCursor> cursor,... | 24,256 | C++ | .cc | 668 | 26.814371 | 126 | 0.554623 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
11,024 | search-path.cc | NixOS_nix/src/libexpr/search-path.cc | #include "search-path.hh"
namespace nix {
std::optional<std::string_view> LookupPath::Prefix::suffixIfPotentialMatch(
std::string_view path) const
{
auto n = s.size();
/* Non-empty prefix and suffix must be separated by a /, or the
prefix is not a valid path prefix. */
bool needSeparator = n >... | 1,267 | C++ | .cc | 43 | 23.55814 | 75 | 0.580858 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,025 | context.cc | NixOS_nix/src/libexpr/value/context.cc | #include "util.hh"
#include "value/context.hh"
#include <optional>
namespace nix {
NixStringContextElem NixStringContextElem::parse(
std::string_view s0,
const ExperimentalFeatureSettings & xpSettings)
{
std::string_view s = s0;
std::function<SingleDerivedPath()> parseRest;
parseRest = [&]() -> ... | 3,076 | C++ | .cc | 95 | 23.284211 | 94 | 0.518868 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,026 | fetchTree.cc | NixOS_nix/src/libexpr/primops/fetchTree.cc | #include "attrs.hh"
#include "primops.hh"
#include "eval-inline.hh"
#include "eval-settings.hh"
#include "store-api.hh"
#include "fetchers.hh"
#include "filetransfer.hh"
#include "registry.hh"
#include "tarball.hh"
#include "url.hh"
#include "value-to-json.hh"
#include "fetch-to-store.hh"
#include <nlohmann/json.hpp>
... | 30,472 | C++ | .cc | 650 | 37.630769 | 230 | 0.619311 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,027 | context.cc | NixOS_nix/src/libexpr/primops/context.cc | #include "primops.hh"
#include "eval-inline.hh"
#include "derivations.hh"
#include "store-api.hh"
namespace nix {
static void prim_unsafeDiscardStringContext(EvalState & state, const PosIdx pos, Value * * args, Value & v)
{
NixStringContext context;
auto s = state.coerceToString(pos, *args[0], context, "while... | 13,606 | C++ | .cc | 286 | 38.737762 | 210 | 0.64148 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,028 | fetchMercurial.cc | NixOS_nix/src/libexpr/primops/fetchMercurial.cc | #include "primops.hh"
#include "eval-inline.hh"
#include "eval-settings.hh"
#include "store-api.hh"
#include "fetchers.hh"
#include "url.hh"
#include "url-parts.hh"
namespace nix {
static void prim_fetchMercurial(EvalState & state, const PosIdx pos, Value * * args, Value & v)
{
std::string url;
std::optional<... | 3,574 | C++ | .cc | 76 | 38.934211 | 149 | 0.632214 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
11,029 | fromTOML.cc | NixOS_nix/src/libexpr/primops/fromTOML.cc | #include "primops.hh"
#include "eval-inline.hh"
#include <sstream>
#include <toml.hpp>
namespace nix {
static void prim_fromTOML(EvalState & state, const PosIdx pos, Value * * args, Value & val)
{
auto toml = state.forceStringNoCtx(*args[0], pos, "while evaluating the argument passed to builtins.fromTOML");
... | 3,375 | C++ | .cc | 91 | 24.098901 | 115 | 0.47075 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | true | false | false |
11,030 | fetchClosure.cc | NixOS_nix/src/libexpr/primops/fetchClosure.cc | #include "primops.hh"
#include "store-api.hh"
#include "realisation.hh"
#include "make-content-addressed.hh"
#include "url.hh"
namespace nix {
/**
* Handler for the content addressed case.
*
* @param state Evaluator state and store to write to.
* @param fromStore Store containing the path to rewrite.
* @param fr... | 11,531 | C++ | .cc | 228 | 41.657895 | 217 | 0.646567 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,031 | nix_api_value.cc | NixOS_nix/src/libexpr-tests/nix_api_value.cc | #include "nix_api_store.h"
#include "nix_api_store_internal.h"
#include "nix_api_util.h"
#include "nix_api_util_internal.h"
#include "nix_api_expr.h"
#include "nix_api_value.h"
#include "nix_api_expr_internal.h"
#include "tests/nix_api_expr.hh"
#include "tests/string_callback.hh"
#include "gmock/gmock.h"
#include <cs... | 11,643 | C++ | .cc | 321 | 31.604361 | 120 | 0.650565 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,032 | primops.cc | NixOS_nix/src/libexpr-tests/primops.cc | #include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "eval-settings.hh"
#include "memory-source-accessor.hh"
#include "tests/libexpr.hh"
namespace nix {
class CaptureLogger : public Logger
{
std::ostringstream oss;
public:
CaptureLogger() {}
std::string get() c... | 28,025 | C++ | .cc | 697 | 31.806313 | 167 | 0.564145 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,033 | json.cc | NixOS_nix/src/libexpr-tests/json.cc | #include "tests/libexpr.hh"
#include "value-to-json.hh"
namespace nix {
// Testing the conversion to JSON
class JSONValueTest : public LibExprTest {
protected:
std::string getJSONValue(Value& value) {
std::stringstream ss;
NixStringContext ps;
pr... | 1,821 | C++ | .cc | 57 | 24.22807 | 88 | 0.586423 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,034 | trivial.cc | NixOS_nix/src/libexpr-tests/trivial.cc | #include "tests/libexpr.hh"
namespace nix {
// Testing of trivial expressions
class TrivialExpressionTest : public LibExprTest {};
TEST_F(TrivialExpressionTest, true) {
auto v = eval("true");
ASSERT_THAT(v, IsTrue());
}
TEST_F(TrivialExpressionTest, false) {
auto v = eval(... | 7,558 | C++ | .cc | 200 | 30.2 | 79 | 0.577176 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,035 | eval.cc | NixOS_nix/src/libexpr-tests/eval.cc | #include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "eval.hh"
#include "tests/libexpr.hh"
namespace nix {
TEST(nix_isAllowedURI, http_example_com) {
Strings allowed;
allowed.push_back("http://example.com");
ASSERT_TRUE(isAllowedURI("http://example.com", allowed));
ASSERT_TRUE(isAllowedURI("ht... | 6,199 | C++ | .cc | 123 | 46.04065 | 92 | 0.701931 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,036 | derived-path.cc | NixOS_nix/src/libexpr-tests/derived-path.cc | #include <nlohmann/json.hpp>
#include <gtest/gtest.h>
#include <rapidcheck/gtest.h>
#include "tests/derived-path.hh"
#include "tests/libexpr.hh"
namespace nix {
// Testing of trivial expressions
class DerivedPathExpressionTest : public LibExprTest {};
// FIXME: `RC_GTEST_FIXTURE_PROP` isn't calling `SetUpTestSuite`... | 2,001 | C++ | .cc | 56 | 32.535714 | 107 | 0.728401 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,037 | nix_api_expr.cc | NixOS_nix/src/libexpr-tests/nix_api_expr.cc | #include "nix_api_store.h"
#include "nix_api_store_internal.h"
#include "nix_api_util.h"
#include "nix_api_util_internal.h"
#include "nix_api_expr.h"
#include "nix_api_value.h"
#include "tests/nix_api_expr.hh"
#include "tests/string_callback.hh"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
namespace nixC {
TES... | 13,851 | C++ | .cc | 340 | 34.955882 | 118 | 0.640663 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,038 | main.cc | NixOS_nix/src/libexpr-tests/main.cc | #include <gtest/gtest.h>
#include <cstdlib>
#include "globals.hh"
#include "logging.hh"
using namespace nix;
int main (int argc, char **argv) {
if (argc > 1 && std::string_view(argv[1]) == "__build-remote") {
printError("test-build-remote: not supported in libexpr unit tests");
return 1;
}
... | 1,510 | C++ | .cc | 34 | 39.764706 | 134 | 0.689373 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,039 | nix_api_external.cc | NixOS_nix/src/libexpr-tests/nix_api_external.cc | #include "nix_api_store.h"
#include "nix_api_store_internal.h"
#include "nix_api_util.h"
#include "nix_api_util_internal.h"
#include "nix_api_expr.h"
#include "nix_api_expr_internal.h"
#include "nix_api_value.h"
#include "nix_api_external.h"
#include "tests/nix_api_expr.hh"
#include "tests/string_callback.hh"
#includ... | 2,026 | C++ | .cc | 52 | 34.576923 | 82 | 0.696118 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,040 | error_traces.cc | NixOS_nix/src/libexpr-tests/error_traces.cc | #include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "tests/libexpr.hh"
namespace nix {
using namespace testing;
// Testing eval of PrimOp's
class ErrorTraceTest : public LibExprTest { };
TEST_F(ErrorTraceTest, TraceBuilder) {
ASSERT_THROW(
state.error<EvalError>("puppy").... | 64,039 | C++ | .cc | 1,016 | 47.062008 | 147 | 0.511036 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
11,041 | search-path.cc | NixOS_nix/src/libexpr-tests/search-path.cc | #include <gtest/gtest.h>
#include <gmock/gmock.h>
#include "search-path.hh"
namespace nix {
TEST(LookupPathElem, parse_justPath) {
ASSERT_EQ(
LookupPath::Elem::parse("foo"),
(LookupPath::Elem {
.prefix = LookupPath::Prefix { .s = "" },
.path = LookupPath::Path { .s = "foo"... | 2,794 | C++ | .cc | 73 | 33.205479 | 89 | 0.651627 | NixOS/nix | 12,186 | 1,472 | 3,401 | LGPL-2.1 | 9/20/2024, 9:26:25 PM (Europe/Amsterdam) | false | false | false | false | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.