diff --git a/README.rst b/README.rst index 2c31c33aaac70132ed9a8a1941849f8624c5d3ef..21ad94d0ed0d9b6f29aa6cc059cf6924535276f6 100644 --- a/README.rst +++ b/README.rst @@ -12,38 +12,38 @@ Why |main_project_name|? |main_project_name| Documentation ********************************* -* `Getting Started <https://git.ostc-eu.org/OSTC/OHOS/docs/Documentation/-/blob/master/quick-start/build-open-harmony.rst>`_ -* `Supported Boards <https://git.ostc-eu.org/OSTC/OHOS/docs/Documentation/-/blob/master/supported-boards/README.rst>`_ +* `Getting Started <https://openharmony.readthedocs.io/en/latest/quick-start/build-open-harmony.html>`_ +* `Supported Boards <https://openharmony.readthedocs.io/en/latest/supported-boards/README.html>`_ -For the latest |main_project_name| Documentation, `Click <https://openharmony-documentation.readthedocs.io>`_. +For the latest |main_project_name| Documentation, `Click <https://openharmony.readthedocs.io>`_. Get Source Code and Tools ************************* The first thing to do is to get the required tools and source code for the development and contribution purpose. Here are the links to download the tools and source code. Once you finish downloading, you can refer to the Contribution Guidelines for more details on the process and style guides used. -* `Downloading Tools <https://git.ostc-eu.org/OSTC/OHOS/docs/Documentation/-/blob/master/quick-start/build-open-harmony.rst#id1>`_ +* `Downloading Tools <https://openharmony.readthedocs.io/en/latest/quick-start/build-open-harmony.html#downloading-tools>`_ -* `Downloading Source Code <https://git.ostc-eu.org/OSTC/OHOS/docs/Documentation/-/blob/master/quick-start/build-open-harmony.rst#id2>`_ +* `Downloading Source Code <https://openharmony.readthedocs.io/en/latest/quick-start/build-open-harmony.html#downloading-source-code>`_ Contribution Guidelines *********************** We welcome you to join the project |main_project_name| and support us in building an Open Source Community and encourages everyone in the community to submit the patches directly to the project. Based on your interest and expertise, you can contribute to the code or/and documentation. -* To know the contribution workflow on how to download code and contribute your code back to the repository, refer `Contribution Process <https://git.ostc-eu.org/OSTC/OHOS/docs/Documentation/-/blob/master/readme/Contribution%20Process.rst>`_. +* To know the contribution workflow on how to download code and contribute your code back to the repository, refer `Contribution Process <https://openharmony.readthedocs.io/en/latest/readme/Contribution%20Process.html>`_. -* To contribute to documentation, refer `Contributing to the Documentation <https://git.ostc-eu.org/OSTC/OHOS/docs/Documentation/-/blob/master/readme/Contributing%20to%20the%20Documentation.rst>`_. +* To contribute to documentation, refer `Contributing to the Documentation <https://openharmony.readthedocs.io/en/latest/readme/Contributing%20to%20the%20Documentation.html>`_. -* All our documents are written in reStructuredText for easy of writing and processing to different format. You can use ReadTheDoc to publish our documents into anyformat you want, or locally generate the required format output using the Sphinx document generator. For more details, refer `Documentation using Sphinx <https://git.ostc-eu.org/OSTC/OHOS/docs/developer-guide/-/blob/master/documentation/source/readme/reStructuredText%20Basics.rst>`_ +* All our documents are written in reStructuredText for easy of writing and processing to different format. You can use ReadTheDoc to publish our documents into anyformat you want, or locally generate the required format output using the Sphinx document generator. For more details, refer `Documentation using Sphinx <https://openharmony.readthedocs.io/en/latest/readme/reStructuredText%20Basics.html>`_ -* In order to maintain consistency across code base, refer to the `coding style guide <https://git.ostc-eu.org/OSTC/OHOS/docs/Documentation/-/blob/master/readme/Contributing%20to%20the%20Code.rst>`_ before you stat contributing to the code base of |main_project_name|. +* In order to maintain consistency across code base, refer to the `coding style guide <https://openharmony.readthedocs.io/en/latest/readme/Contributing%20to%20the%20Code.html>`_ before you stat contributing to the code base of |main_project_name|. Where to Turn for Help ********************** -You can subscribe to the mailing list to get constant updates on new features, release road maps, and community activities. For Subscribing to the mailing list or any other support, see `Communication in Community <https://git.ostc-eu.org/OSTC/OHOS/docs/Documentation/-/blob/master/readme/Communication%20in%20Community.rst>`_. +You can subscribe to the mailing list to get constant updates on new features, release road maps, and community activities. For Subscribing to the mailing list or any other support, see `Communication in Community <https://openharmony.readthedocs.io/en/latest/readme/Communication%20in%20Community.html>`_. Code of Conduct *************** -|main_project_name| is committed to provide a welcoming and inspiring community for all. In order to maintain a collaborative environment, we recommend you to read and follow the community `Code of Conduct <https://git.ostc-eu.org/OSTC/OHOS/docs/Documentation/-/blob/master/readme/Code%20of%20Conduct.rst>`_. +|main_project_name| is committed to provide a welcoming and inspiring community for all. In order to maintain a collaborative environment, we recommend you to read and follow the community `Code of Conduct <https://openharmony.readthedocs.io/en/latest/readme/Code%20of%20Conduct.html>`_. Contributors & Acknowledgements ******************************* diff --git a/readme/C++ Coding Style Guide.rst b/readme/C++ Coding Style Guide.rst index 8e714784b27b4d64e4e83624e754c46863471430..b33639fdbe57aa9c02d5f5a9fc07d485a91078ac 100644 --- a/readme/C++ Coding Style Guide.rst +++ b/readme/C++ Coding Style Guide.rst @@ -1,3 +1,5 @@ +.. _C++coding-style: + .. include:: ../definitions.rst C++ Coding Style Guide @@ -53,29 +55,29 @@ phrases so that each word or abbreviation in the phrase begins with a capital letter, with no intervening spaces or punctuation. There are two conventions: UpperCamelCase and lowerCamelCase. -+-----------------------------------+-----------------------------------+ -| Type | Naming Style | -+===================================+===================================+ -| Class Type, Struct Type, | UpperCamelCase | -| Enumeration Type, and Union Type | | -| Definitions, Scope Name | | -+-----------------------------------+-----------------------------------+ -| Functions (Including Global | UpperCamelCase | -| Functions, Scope Functions, and | | -| Member Functions) | | -+-----------------------------------+-----------------------------------+ -| Global Variables (Including | lowerCamelCase | -| Variables of the Global and | | -| Namespace Scopes, Namespace | | -| Variables, and Class Static | | -| Variables), Local Variables, | | -| Function Parameters, and Class, | | -| Struct, and Union Member | | -| Variables | | -+-----------------------------------+-----------------------------------+ -| Macro, Constant, Enumerated | All caps, separated with | -| Value, goto Tag | underscores (``_``) | -+-----------------------------------+-----------------------------------+ ++----------------------------------+--------------------------+ +| Type | Naming Style | ++==================================+==========================+ +| Class Type, Struct Type, | UpperCamelCase | +| Enumeration Type, and Union Type | | +| Definitions, Scope Name | | ++----------------------------------+--------------------------+ +| Functions (Including Global | UpperCamelCase | +| Functions, Scope Functions, and | | +| Member Functions) | | ++----------------------------------+--------------------------+ +| Global Variables (Including | lowerCamelCase | +| Variables of the Global and | | +| Namespace Scopes, Namespace | | +| Variables, and Class Static | | +| Variables), Local Variables, | | +| Function Parameters, and Class, | | +| Struct, and Union Member | | +| Variables | | ++----------------------------------+--------------------------+ +| Macro, Constant, Enumerated | All caps, separated with | +| Value, goto Tag | underscores (``_``) | ++----------------------------------+--------------------------+ Note: **Constant** indicates the variables of the basic, enumeration, or character string type modified by const or constexpr in the global @@ -172,30 +174,30 @@ For namespace naming, UpperCamelCase is recommended. } Recommendation 2.4.1 Do not abuse typedef or #define to alias basic types. ------------------------------------------------------------------------------------------------------------ +-------------------------------------------------------------------------- Unless otherwise specified, do not use typedef or #define to redefine a basic value type. The basic types found in the ``<cstdint>`` header file are preferable. -+-----------+-------------+--------------------------------------------+ -| Signed | Unsigned | Description | -| Type | Type | | -+===========+=============+============================================+ -| int8_t | uint8_t | The signed or unsigned 8-bit integer type. | -+-----------+-------------+--------------------------------------------+ -| int16_t | uint16_t | The signed or unsigned 16-bit integer | -| | | type. | -+-----------+-------------+--------------------------------------------+ -| int32_t | uint32_t | The signed or unsigned 32-bit integer | -| | | type. | -+-----------+-------------+--------------------------------------------+ -| int64_t | uint64_t | The signed or unsigned 64-bit integer | -| | | type. | -+-----------+-------------+--------------------------------------------+ -| intptr_t | uintptr_t | The signed or unsigned integer type large | -| | | enough to hold a pointer. | -+-----------+-------------+--------------------------------------------+ ++----------+-----------+--------------------------------------------+ +| Signed | Unsigned | Description | +| Type | Type | | ++==========+===========+============================================+ +| int8_t | uint8_t | The signed or unsigned 8-bit integer type. | ++----------+-----------+--------------------------------------------+ +| int16_t | uint16_t | The signed or unsigned 16-bit integer | +| | | type. | ++----------+-----------+--------------------------------------------+ +| int32_t | uint32_t | The signed or unsigned 32-bit integer | +| | | type. | ++----------+-----------+--------------------------------------------+ +| int64_t | uint64_t | The signed or unsigned 64-bit integer | +| | | type. | ++----------+-----------+--------------------------------------------+ +| intptr_t | uintptr_t | The signed or unsigned integer type large | +| | | enough to hold a pointer. | ++----------+-----------+--------------------------------------------+ Variable Names -------------- @@ -210,7 +212,7 @@ variables, function parameters, local variables, and member variables. std::string path; // Good: When there is only one word, lowerCamelCase (all lowercase) is used. Rule 2.5.1 Add the prefix ‘g\_’ to global variables. Do not add a prefix to a static variable. -------------------------------------------------------------------------------------------------------------------- +---------------------------------------------------------------------------------------------- Global variables should be used as little as possible, and special attention should be paid to the use of global variables. This prefix @@ -231,7 +233,7 @@ common member variables of classes are named in the same way. } Rule 2.5.2 Name member variables in classes based on the three styles of the lowerCamelCase and maintain a uniform coding style for a product or project. --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +--------------------------------------------------------------------------------------------------------------------------------------------------------- .. code:: cpp @@ -245,7 +247,7 @@ a member variable of the struct or union type. Keep the naming style consistent with that for a local variable. Macro, Constant, and Enumeration Names ------------------------------------------------------------ +-------------------------------------- For macros and enumerated values, use all caps separated with underscores (``_``). In the global scope, constants of named and unnamed @@ -276,13 +278,13 @@ member variables use the lowerCamelCase naming style. } Formatting -************* +********** Line Length =========== Recommendation 3.1.1 Each line of code should contain a maximum of 120 characters. ------------------------------------------------------------------------------------------------------------------------ +---------------------------------------------------------------------------------- \*\* Note: \**It is recommended that the number of characters in each line not exceed 120. It is recommended that the number of characters in @@ -696,7 +698,7 @@ Preprocessor Directives ======================= Rule 3.13.1 The number sign (#) that starts a preprocessor directive must be at the beginning of the line and can be indented in nested preprocessor directives. -------------------------------------------------------------------------------------------------------------------------------------------------------- +---------------------------------------------------------------------------------------------------------------------------------------------------------------- The number sign (#) that starts a preprocessor directive must be at the beginning of the line even through the preprocessor directive is inside @@ -945,7 +947,7 @@ Classes ======= Rule 3.15.1 Class access specifier declarations are in the sequence: public, protected, private. Indent these specifiers to the same level as the class keyword. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- +---------------------------------------------------------------------------------------------------------------------------------------------------------------- .. code:: cpp @@ -1553,7 +1555,7 @@ global namespace. } Global Functions and Static Member Functions -============================================= +============================================ Recommendation 6.2.1 Use namespaces to manage global functions. If global functions are closely tied to a class, you can use static member functions. ----------------------------------------------------------------------------------------------------------------------------------------------------- @@ -2931,7 +2933,7 @@ Recommendation 9.6.1 Member variables that will not be modified after initializa .. _exceptions-1: Exceptions -=========== +========== Recommendation 9.7.1 If the function does not throw an exception, the declaration is ``noexcept``. -------------------------------------------------------------------------------------------------- diff --git a/readme/Contributing to the Code.rst b/readme/Contributing to the Code.rst index 9f2ab0b972eab4d8225ed77b371f12879d3d10a9..4818e65bacb3ee418e71fa57dac263b2e7c26191 100644 --- a/readme/Contributing to the Code.rst +++ b/readme/Contributing to the Code.rst @@ -12,9 +12,8 @@ Code Style Develop, review, and test code following the |main_project_name| coding standards. Make sure code is written in the same style. -* `C++ Coding Style Guide <https://git.ostc-eu.org/docs/developer-guide/-/blob/master/documentation/source/readme/C++%20Coding%20Style%20Guide.rst>`_ -* `C Coding Style Guide <https://git.ostc-eu.org/docs/developer-guide/-/blob/master/documentation/source/readme/C%20Coding%20Style%20Guide.rst>`_ -* `JavaScript Coding Style Guide <https://git.ostc-eu.org/docs/developer-guide/-/blob/master/documentation/source/readme/JavaScript%20Coding%20Style%20Guide.rst>`_ +* :ref:`C++ Coding Style Guide <C++coding-style>` +* :ref:`JavaScript Coding Style Guide <javaCode-style>` * `Python Coding Style Guide <https://pep8.org/>`_ diff --git a/readme/JavaScript Coding Style Guide.rst b/readme/JavaScript Coding Style Guide.rst index e745ec640eb45bc07b03dc1e95f8a1bceecb484a..1dd1c4386f246d3d17655754326ddf09a3d17cbc 100644 --- a/readme/JavaScript Coding Style Guide.rst +++ b/readme/JavaScript Coding Style Guide.rst @@ -1,3 +1,5 @@ +.. _javaCode-style: + .. include:: ../definitions.rst JavaScript Coding Style Guide