Skip to content

Commit

Permalink
Merge branch 'main' into feature/migrate-airline-to-namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Hossamfc9 authored Jun 17, 2024
2 parents 6972f48 + c12f945 commit cf870eb
Show file tree
Hide file tree
Showing 70 changed files with 15,326 additions and 16,136 deletions.
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
ReferenceAlignment: Left
SeparateDefinitionBlocks: Always
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
Expand Down
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Changelog

All notable changes to this project will be documented in this file

## 2.0.0 (TBD)

### ⚠ BREAKING CHANGES

* removed `structure` module
* removed `book.translator` method, use `person.fullName` instead
* removed `book.isbn` method, use `commerce.isbn` instead
* removed `commerce.price` method, use `finance.amount` instead
* removed `commerce.productId` method, use `string.alphanumeric` instead
* removed `commerce.productRating` method, use `number.decimal` instead
* removed `commerce.discountAmount` method, use `number.decimal` instead
* removed `commerce.discountPercentage` method, use `number.decimal` instead
* removed `commerce.orderNumber` method, use `string.numeric` instead
* removed `commerce.discountCode` method, use `string.alphanumeric` instead
* removed `git.author` method, use `person.fullName` instead
* removed `helper.shuffle` method, use standard library shuffle instead
* removed `person.middleName` method, use `person.firstName` instead
* removed `weather.temperature` method, use `number.decimal` instead
* removed `weather.pressure` method, use `number.decimal` instead
* removed `weather.visibility` method, use `number.decimal` instead
* removed `weather.windSpeed` method, use `number.decimal` instead
* removed `weather.uvIndex` method, use `number.integer` instead
* removed `weather.humidity` method, use `number.integer` instead
* removed `weather.cloudCover` method, use `number.integer` instead

* changed std::string to std::string_view in where possible

### Features

* added `Plant` module

### Infra

* added Conan package manager support
* added support for GCC 12
* changed to link with fmt lib only if compiler does not support std::format
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ set(FAKER_SOURCES
src/common/FormatHelper.cpp
src/common/LuhnCheck.cpp
src/common/StringHelper.cpp
src/common/PrecisionMapper.cpp
)

add_library(${CMAKE_PROJECT_NAME} ${FAKER_SOURCES})
Expand Down Expand Up @@ -145,4 +144,4 @@ endif ()

if (BUILD_EXAMPLES)
add_subdirectory(examples)
endif ()
endif ()
54 changes: 19 additions & 35 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,48 +58,32 @@ Please avoid working directly on the ``main`` branch.
Before making changes, make sure you have `clang-format` installed. If you're using Visual Studio Code, you can
install the `clang-format` extension.
When you make a commit, `pre-commit` will automatically run `clang-format` on your code, ensuring it adheres to the
project's coding style.
3**Make commits of logical units:**
3. **Set up pre-commit hooks:**
This means that each commit should contain a complete and coherent piece of work that can be understood independently
of other changes. For example, if you're fixing two different bugs, it's better to make two separate commits (one for
each bug) rather than one commit that contains fixes for both bugs. This makes it easier to understand the purpose of
each commit, and allows each change to be reviewed and applied separately.
This project uses `pre-commit` hooks with `clang-format` to ensure code style consistency. Before making changes, set
up the pre-commit hooks with the following commands:
4**Make sure you have added the necessary tests for your changes:**
```sh
pip install pre-commit
pre-commit install
```

Now, `pre-commit` will automatically run `clang-format` on your code whenever you make a commit, ensuring it adheres
to the project's coding style.
4. **Make commits of logical units:**
This means that each commit should contain a complete and coherent piece of work that can be understood independently
of other changes. For example, if you're fixing two different bugs, it's better to make two separate commits (one for
each bug) rather than one commit that contains fixes for both bugs. This makes it easier to understand the purpose of
each commit, and allows each change to be reviewed and applied separately.
5. **Make sure you have added the necessary tests for your changes:**
If you're adding a new feature or changing existing functionality, it's important to update or add tests that verify
your changes. This helps to ensure that your changes work as expected and don't introduce new bugs. It also helps
other developers understand what your code is supposed to do.
If you're adding a new feature or changing existing functionality, it's important to update or add tests that verify
your changes. This helps to ensure that your changes work as expected and don't introduce new bugs. It also helps
other developers understand what your code is supposed to do.

6. **Run all the tests to assure nothing else was accidentally broken:**
5**Run all the tests to assure nothing else was accidentally broken:**

Before you submit your changes, you should run all the project's tests to make sure your changes haven't
inadvertently broken anything. Even if you think your changes are isolated, there could be unexpected interactions
with other parts of the codebase.
Before you submit your changes, you should run all the project's tests to make sure your changes haven't
inadvertently broken anything. Even if you think your changes are isolated, there could be unexpected interactions
with other parts of the codebase.

7. **If you've added a new file to your project with non-Latin characters, ensure that the file encoding is set to
Unicode (UTF-8 without signature) - Codepage 65001 in Microsoft Visual Studio Code:**
6**If you've added a new file to your project with non-Latin characters, ensure that the file encoding is set to
Unicode (UTF-8 without signature) - Codepage 65001 in Microsoft Visual Studio Code:**
If a file contains non-Latin characters (such as characters from Chinese, Arabic, or many other non-Latin alphabets),
it's important to save the file with the correct encoding to ensure that the characters are displayed correctly. In
Visual Studio Code, you can set the encoding for a file by clicking on the "UTF-8" button in the status bar at the
bottom of the window, and then selecting "Save with Encoding" and choosing "UTF-8 without BOM".
If a file contains non-Latin characters (such as characters from Chinese, Arabic, or many other non-Latin alphabets),
it's important to save the file with the correct encoding to ensure that the characters are displayed correctly. In
Visual Studio Code, you can set the encoding for a file by clicking on the "UTF-8" button in the status bar at the
bottom of the window, and then selecting "Save with Encoding" and choosing "UTF-8 without BOM".

## Building and Testing the Project

Expand Down
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
</div>

## Table of Contents

- [🎯 Goal](#-goal)
- [Usage and Documentation](#usage-and-documentation)
- [💎 Modules](#-modules)
Expand Down Expand Up @@ -167,17 +168,28 @@ Check our guides on how to build the project locally:
- [G++](./docs/guides/gcc-compilation-guide.md)
- [MSVC](./docs/guides/msvc-compilation-guide.md)
Before contributing please review
our [CONTRIBUTING](https://github.com/cieslarmichal/faker-cxx/blob/main/CONTRIBUTING.md) guide.
Please make sure to read the [Contributing Guide](https://github.com/cieslarmichal/faker-cxx/blob/main/CONTRIBUTING.md)
before making a pull request.
Additionally, we encourage you to join our [Discord Channel](https://discord.gg/h2ur8H6mK6) for contributors.
## 📘 Credits
Thanks to all the people who already contributed to Faker!
<a href="https://github.com/cieslarmichal/faker-cxx/graphs/contributors"><img src="https://opencollective.com/faker-cxx/contributors.svg?width=800" /></a>
## Examples
This project offers examples to demonstrate how to use the Faker C++ library.
These examples can be found in the [examples](examples/README.md) folder of the project repository.
The examples showcase various modules of the library and provide code snippets that illustrate how to generate fake data using Faker C++.
The examples showcase various modules of the library and provide code snippets that illustrate how to generate fake data
using Faker C++.
## 📝 Changelog
Detailed changes for each release are documented in the [release notes](CHANGELOG.md).
## License
## 🔑 License
This project is under [MIT](LICENSE) license.
22 changes: 0 additions & 22 deletions include/faker-cxx/Book.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,6 @@ class Book
*/
static std::string_view publisher();

/**
* @brief Returns a random book ISBN.
*
* @returns Book ISBN.
*
* @code
* Book::isbn() // "978-83-01-00000-1"
* @endcode
*/
static std::string isbn();

/**
* @brief Returns the full name of a translator
*
* @returns std::string_view full name
*
* @code
* Book::translator() // "Eric Floyd"
* @endcode
*/
static std::string_view translator();

/**
* @brief Returns format of book
*
Expand Down
78 changes: 0 additions & 78 deletions include/faker-cxx/Commerce.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,6 @@ class Commerce
*/
static std::string_view department();

/**
* @brief Generates a random price between the given bounds (inclusive).
* @param min The lower bound for the price. Defaults to `0`.
* @param max The upper bound for the price. Defaults to `1000`.
*
* @code
* Commerce::price() // "88.62"
* @endcode
*/
static std::string price(double min = 0, double max = 1000);

/**
* @brief Generates a random sku by default only with digits.
*
Expand Down Expand Up @@ -130,17 +118,6 @@ class Commerce
*/
static std::string ISBN10();

/**
* @brief Returns a random product ID.
*
* @returns productId.
*
* @code
* Commerce::productId() // "ABCD123456"
* @endcode
*/
static std::string productId();

/**
* @brief Returns a random payment type.
*
Expand Down Expand Up @@ -196,17 +173,6 @@ class Commerce
*/
static std::string_view productReview();

/**
* @brief Returns a random product rating (0-5).
*
* @returns productRating.
*
* @code
* Commerce::productRating() // 4.1
* @endcode
*/
static double productRating();

/**
* @brief Returns a random discount type.
*
Expand All @@ -218,50 +184,6 @@ class Commerce
*/
static std::string_view discountType();

/**
* @brief Returns random discount code within the specified range of 6 to 12 characters.
*
* @returns discount code consists of uppercase letters and numbers.
*
* @code
* Commerce::discountCode() // "VNM15DEC1"
* @endcode
*/
static std::string discountCode();

/**
* @brief Returns a random discount amount within the specified range of 10 to 1000.
*
* @returns discountAmount.
*
* @code
* Commerce::discountAmount() // 57.80
* @endcode
*/
static double discountAmount();

/**
* @brief Returns a random discount percentage within the specified range of 1. to 90.
*
* @returns discountPercentage.
*
* @code
* Commerce::discountPercentage() // 35.50
* @endcode
*/
static double discountPercentage();

/**
* @brief Returns a random order number.
*
* @returns orderNumber.
*
* @code
* Commerce::orderNumber() // 0123456
* @endcode
*/
static std::string orderNumber();

/**
* @brief Returns a random order status.
*
Expand Down
13 changes: 0 additions & 13 deletions include/faker-cxx/Git.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,5 @@ class Git
* @endcode
*/
static std::string commitSha(unsigned length = 40);

/**
* @brief Returns a random author name and email.
*
* @param
*
* @returns Author.
*
* @code
* Git::author // {Author.name = "Rachel McLaughlin", Author.email = "[email protected]"}
* @endcode
*/
static Author author();
};
}
Loading

0 comments on commit cf870eb

Please sign in to comment.