<commit_before>#pragma once

#include <serializer/serializer.h>
#include "utils.h"

namespace aBuild {

	using Dependencies = std::vector<std::string>;
	using DepLibraries = std::vector<std::string>;

	struct ProjectLegacy {
		std::vector<std::string> includes;

		template<typename Node>
		void serialize(Node& node) {
			node["includes"] % includes;
		}
	};


	class Project {
	private:
		std::string  path;
		std::string  packagePath;
		Dependencies dependencies;
		Dependencies optionalDependencies;
		DepLibraries depLibraries;
		bool         noWarnings;
		std::string  type;
		mutable std::vector<std::string> cppFiles;
		mutable std::vector<std::string> cFiles;

		ProjectLegacy legacy;

	public:
		Project()
			: packagePath { "." }
			, noWarnings  { false }
		{}

		template<typename Node>
		void serialize(Node& node) {
			node["path"]                 % path;
			node["dependencies"]         % dependencies;
			node["optionalDependencies"] % optionalDependencies;
			node["type"]                 % type                 or getTypeByName();
			node["legacy"]               % legacy;
			node["depLibraries"]         % depLibraries;
			node["noWarnings"]           % noWarnings           or false;
		}
		void set(std::string const& _name) {
			path = _name;
			type = getTypeByName();
		}

		auto getType() const -> std::string const& {
			return type;
		}
		/** tries to determine type by name
		 *  name starting with "test" are executables
		 *  everything else is a library
		 */
		auto getTypeByName() const -> std::string {
			if (utils::isStartingWith(path, "test")) {
				return "executable";
			}
			return "library";
		}
		auto getLegacy() const -> ProjectLegacy const& {
			return legacy;
		}
		auto getName() const -> std::string {
			auto l = utils::explode(getPath(), "/");
			return l[l.size()-1];
		}
		auto getPath() const -> std::string const& {
			return path;
		}
		auto getPackagePath() const -> std::string const& {
			return packagePath;
		}
		void setPackagePath(std::string const& s) {
			packagePath = s;
		}
		auto getDependencies() const -> Dependencies const& {
			return dependencies;
		}
		auto getOptionalDependencies() const -> Dependencies const & {
			return optionalDependencies;
		}
		auto getDepLibraries() const -> DepLibraries const& {
			return depLibraries;
		}
		bool getNoWarnings() const {<commit_msg>renaming getTypeByName() to getDefaultTypeByName()<commit_after>#pragma once

#include <serializer/serializer.h>
#include "utils.h"

namespace aBuild {

	using Dependencies = std::vector<std::string>;
	using DepLibraries = std::vector<std::string>;

	struct ProjectLegacy {
		std::vector<std::string> includes;

		template<typename Node>
		void serialize(Node& node) {
			node["includes"] % includes;
		}
	};


	class Project {
	private:
		std::string  path;
		std::string  packagePath;
		Dependencies dependencies;
		Dependencies optionalDependencies;
		DepLibraries depLibraries;
		bool         noWarnings;
		std::string  type;
		mutable std::vector<std::string> cppFiles;
		mutable std::vector<std::string> cFiles;

		ProjectLegacy legacy;

	public:
		Project()
			: packagePath { "." }
			, noWarnings  { false }
		{}

		template<typename Node>
		void serialize(Node& node) {
			node["path"]                 % path;
			node["dependencies"]         % dependencies;
			node["optionalDependencies"] % optionalDependencies;
			node["type"]                 % type                 or getDefaultTypeByName();
			node["legacy"]               % legacy;
			node["depLibraries"]         % depLibraries;
			node["noWarnings"]           % noWarnings           or false;
		}
		void set(std::string const& _name) {
			path = _name;
			type = getDefaultTypeByName();
		}

		auto getType() const -> std::string const& {
			return type;
		}
		/** tries to determine type by name
		 *  name starting with "test" are executables
		 *  everything else is a library
		 */
		auto getDefaultTypeByName() const -> std::string {
			if (utils::isStartingWith(path, "test")) {
				return "executable";
			}
			return "library";
		}
		auto getLegacy() const -> ProjectLegacy const& {
			return legacy;
		}
		auto getName() const -> std::string {
			auto l = utils::explode(getPath(), "/");
			return l[l.size()-1];
		}
		auto getPath() const -> std::string const& {
			return path;
		}
		auto getPackagePath() const -> std::string const& {
			return packagePath;
		}
		void setPackagePath(std::string const& s) {
			packagePath = s;
		}
		auto getDependencies() const -> Dependencies const& {
			return dependencies;
		}
		auto getOptionalDependencies() const -> Dependencies const & {
			return optionalDependencies;
		}
		auto getDepLibraries() const -> DepLibraries const& {
			return depLibraries;
		}
		bool getNoWarnings() const {
{'fraction_non_alphanumeric': 0.12510495382031905, 'fraction_numerical': 0.00041981528127623844, 'mean_word_length': 3.1506968641114983, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2184743', 'n_tokens_mistral': 1663, 'n_tokens_neox': 1436, 'n_words': 365}