Skip to content

Commit

Permalink
feat: improve codecov & reformat code (#849)
Browse files Browse the repository at this point in the history
* chore: refactor code

* feat: add codecov for formatter

* feat: improve codecov for date module

* refactor: move locale to seperate file
  • Loading branch information
cieslarmichal authored Aug 19, 2024
1 parent 222c890 commit 6daddc1
Show file tree
Hide file tree
Showing 106 changed files with 5,116 additions and 7,055 deletions.
243 changes: 122 additions & 121 deletions include/faker-cxx/airline.h
Original file line number Diff line number Diff line change
@@ -1,141 +1,142 @@
#pragma once

#include <string_view>

#include "faker-cxx/export.h"

namespace faker::airline
{
/**
* @brief Get a random aircraft type
*
* @return a random aircraft type
*
* @code
* faker::airline::aircraftType // "narrowbody"
* @endcode
*/
FAKER_CXX_EXPORT std::string_view aircraftType();
/**
* @brief Get a random aircraft type
*
* @return a random aircraft type
*
* @code
* faker::airline::aircraftType // "narrowbody"
* @endcode
*/
FAKER_CXX_EXPORT std::string_view aircraftType();

struct FAKER_CXX_EXPORT Airplane
{
std::string_view name;
std::string_view iataTypeCode;
};
struct FAKER_CXX_EXPORT Airplane
{
std::string_view name;
std::string_view iataTypeCode;
};

/**
* @brief Get a random airplane
*
* @return a random airplane and its iataTypeCode
*
* @code
* faker::airline::airplane() // {"Boeing 737-800", "738"}
* @endcode
*/
FAKER_CXX_EXPORT Airplane airplane();
/**
* @brief Get a random airplane
*
* @return a random airplane and its iataTypeCode
*
* @code
* faker::airline::airplane() // {"Boeing 737-800", "738"}
* @endcode
*/
FAKER_CXX_EXPORT Airplane airplane();

struct FAKER_CXX_EXPORT AirlineInfo
{
std::string_view name;
std::string_view iataCode;
};
struct FAKER_CXX_EXPORT AirlineInfo
{
std::string_view name;
std::string_view iataCode;
};

/**
* @brief Get a random airline
*
* @return a random airline and its iataCode
*
* @code
* faker::airline::airline() // {"Air Canada", "AC"}
* @endcode
*/
FAKER_CXX_EXPORT AirlineInfo airline();
/**
* @brief Get a random airline
*
* @return a random airline and its iataCode
*
* @code
* faker::airline::airline() // {"Air Canada", "AC"}
* @endcode
*/
FAKER_CXX_EXPORT AirlineInfo airline();

struct FAKER_CXX_EXPORT Airport
{
std::string_view name;
std::string_view iataCode;
};
struct FAKER_CXX_EXPORT Airport
{
std::string_view name;
std::string_view iataCode;
};

/**
* @brief Get a random airport
*
* @return a random airport and its iataCode
*
* @code
* faker::airline::airport() // {"Toronto Pearson International Airport", "YYZ"}
* @endcode
*/
FAKER_CXX_EXPORT Airport airport();
/**
* @brief Get a random airport
*
* @return a random airport and its iataCode
*
* @code
* faker::airline::airport() // {"Toronto Pearson International Airport", "YYZ"}
* @endcode
*/
FAKER_CXX_EXPORT Airport airport();

enum class AircraftType
{
Regional,
Narrowbody,
Widebody,
};
enum class AircraftType
{
Regional,
Narrowbody,
Widebody,
};

/**
* @brief Get a random seat by aircraft type
*
* @param aircraftType the aircraft type
*
* @return a random seat
*
* @code
* faker::airline::seat(AircraftType::Narrowbody) // "1A"
* @endcode
*/
FAKER_CXX_EXPORT std::string seat(AircraftType aircraftType);
/**
* @brief Get a random seat by aircraft type
*
* @param aircraftType the aircraft type
*
* @return a random seat
*
* @code
* faker::airline::seat(AircraftType::Narrowbody) // "1A"
* @endcode
*/
FAKER_CXX_EXPORT std::string seat(AircraftType aircraftType);

/**
* @brief Get a random record location
*
* @return a random record location
*
* @code
* faker::airline::recordLocator() // "ABCDEF"
* faker::airline::recordLocator(true) // "ABC123"
* @endcode
*/
FAKER_CXX_EXPORT std::string recordLocator(bool allowNumerics = false);
/**
* @brief Get a random record location
*
* @return a random record location
*
* @code
* faker::airline::recordLocator() // "ABCDEF"
* faker::airline::recordLocator(true) // "ABC123"
* @endcode
*/
FAKER_CXX_EXPORT std::string recordLocator(bool allowNumerics = false);

/**
* @brief Get a random flight number from given length
*
* @param addLeadingZeros whether to add leading zeros
*
* @param length the length of the flight number
*
* @return a random flight number
*
* @code
* faker::airline::flightNumber() // "1234"
* faker::airline::flightNumber(true) // "0123"
* faker::airline::flightNumber(false, 3) // "234"
* @endcode
*/
FAKER_CXX_EXPORT std::string flightNumber(bool addLeadingZeros = false, unsigned int length = 4);
/**
* @brief Get a random flight number from given length
*
* @param addLeadingZeros whether to add leading zeros
*
* @param length the length of the flight number
*
* @return a random flight number
*
* @code
* faker::airline::flightNumber() // "1234"
* faker::airline::flightNumber(true) // "0123"
* faker::airline::flightNumber(false, 3) // "234"
* @endcode
*/
FAKER_CXX_EXPORT std::string flightNumber(bool addLeadingZeros = false, unsigned int length = 4);

struct FAKER_CXX_EXPORT Range
{
unsigned int min;
unsigned int max;
};
struct FAKER_CXX_EXPORT Range
{
unsigned int min;
unsigned int max;
};

/**
* @brief Get a random flight number from given length
*
* @param addLeadingZeros whether to add leading zeros
*
* @param length the length of the flight number
*
* @return a random flight number
*
* @code
* faker::airline::flightNumber() // "1234"
* faker::airline::flightNumber(true) // "0123"
* faker::airline::flightNumber(false, {1, 4}) // "234" // "12" // "1234"
* @endcode
*/
FAKER_CXX_EXPORT std::string flightNumberByRange(bool addLeadingZeros = false, Range length = {1, 4});
/**
* @brief Get a random flight number from given length
*
* @param addLeadingZeros whether to add leading zeros
*
* @param length the length of the flight number
*
* @return a random flight number
*
* @code
* faker::airline::flightNumber() // "1234"
* faker::airline::flightNumber(true) // "0123"
* faker::airline::flightNumber(false, {1, 4}) // "234" // "12" // "1234"
* @endcode
*/
FAKER_CXX_EXPORT std::string flightNumberByRange(bool addLeadingZeros = false, Range length = {1, 4});
}
1 change: 1 addition & 0 deletions include/faker-cxx/animal.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <string_view>

#include "faker-cxx/export.h"

namespace faker::animal
Expand Down
1 change: 1 addition & 0 deletions include/faker-cxx/book.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <string_view>

#include "faker-cxx/export.h"

namespace faker::book
Expand Down
5 changes: 3 additions & 2 deletions include/faker-cxx/color.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include <string>

#include "types/hex.h"
#include "faker-cxx/export.h"
#include "types/hex.h"

namespace faker::color
{
Expand Down Expand Up @@ -46,7 +46,8 @@ FAKER_CXX_EXPORT std::string rgb(bool includeAlpha = false);
* faker::color::hex(HexCasing::Upper, HexPrefix::ZeroX, true) // "0xE3F3801A"
* @endcode
*/
FAKER_CXX_EXPORT std::string hex(HexCasing casing = HexCasing::Lower, HexPrefix prefix = HexPrefix::Hash, bool includeAlpha = false);
FAKER_CXX_EXPORT std::string hex(HexCasing casing = HexCasing::Lower, HexPrefix prefix = HexPrefix::Hash,
bool includeAlpha = false);

/**
* @brief Returns an HSL color.
Expand Down
1 change: 1 addition & 0 deletions include/faker-cxx/commerce.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <string_view>

#include "faker-cxx/export.h"

namespace faker::commerce
Expand Down
1 change: 1 addition & 0 deletions include/faker-cxx/company.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <optional>
#include <string_view>

#include "faker-cxx/export.h"

namespace faker::company
Expand Down
1 change: 1 addition & 0 deletions include/faker-cxx/computer.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <string_view>

#include "faker-cxx/export.h"

namespace faker::computer
Expand Down
3 changes: 2 additions & 1 deletion include/faker-cxx/crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <optional>
#include <string>

#include "faker-cxx/export.h"

namespace faker::crypto
Expand Down Expand Up @@ -29,4 +30,4 @@ FAKER_CXX_EXPORT std::string sha256(std::optional<std::string> = std::nullopt);
* @endcode
*/
FAKER_CXX_EXPORT std::string md5(std::optional<std::string> = std::nullopt);
}
}
Loading

0 comments on commit 6daddc1

Please sign in to comment.