From 817189d8d5910a1d7571a1795c1d7fd40f66d944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= Date: Sat, 12 Mar 2022 19:18:50 +0100 Subject: [PATCH 1/5] Documentation: added interactive rebase to CONTRIBUTING.md --- CONTRIBUTING.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 21c479a2c..70a4706ea 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -70,10 +70,14 @@ The development of new features should follow the rebase-based workflow: - This is also a good time to squash small commits (e.g. typos, forgotten changes or trivial corrections) with relevant bigger commits to make the review easier. +- When your work in the _feature_ branch is finished, you should also do an + [interactive rebase](https://thoughtbot.com/blog/git-interactive-rebase-squash-amend-rewriting-history) + and squash small commits (notably when fixing typos or compilation problems), + reword commit messages (check all typos) and overall make the history _nice_. - When reviewed, the feature branch can be merged into the develop branch. The main advantages of this workflow are linear history, clear commits and reduction of merge conflicts. See [A rebase-based workflow]( https://brokenco.de/2010/04/02/a-rebase-based-workflow.html) and [Why is rebase-then-merge better than just merge](https://stackoverflow.com/a/457988) -([complement](https://stackoverflow.com/a/804178)) for reference. \ No newline at end of file +([complement](https://stackoverflow.com/a/804178)) for reference. -- GitLab From 50c51c8fc0b63aaa921aa76e364229b922082aa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= Date: Sun, 13 Mar 2022 10:43:29 +0100 Subject: [PATCH 2/5] Documentation: added section on code formatting to CONTRIBUTING.md --- CONTRIBUTING.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 70a4706ea..89448b9d6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +1,37 @@ +## Code formatting + +Source code should follow the formatting conventions established in the project. +There are several software configurations to help developers format their code: + +1. [.editorconfig](.editorconfig) specifies basic formatting elements, such as + character set and indentation width. Many text editors and IDEs provide + built-in support or a plugin for _editorconfig_, see + https://editorconfig.org/ for details. +2. The [.clang-format](src/.clang-format) file contains detailed specification + for C++ source code formatting. Automatic formatting may be applied with + [clang-format][clang-format] version 13 or later. Use the + [run-clang-format.py](scripts/run-clang-format.py) script for parallel + processing and correct formatting of CUDA kernel launches and OpenMP pragmas. + The script is also run in a continuous integration job on Gitlab to give + developers hints about what should be reformatted. +3. Source files in the `src/TNL/` directory should include a copyright header at + the top. The [update-copyright-headers.py](scripts/update-copyright-headers.py) + script can be used to generate or update copyright headers in source files. + +When you are unsure or if something is not specified in the aforementioned +configuration, rely on [mirroring][mirroring] the formatting style of existing +code. + +> __Note:__ Code formatting changes should be applied _before making a commit_, +> i.e., all commits should be already formatted correctly. Ideally, there should +> be no separate commits to fix formatting issues. When working on a feature +> branch, you can squash separate commits fixing style issues into previous +> commits which introduced the problem (see below on how to use the interactive +> rebase). + +[clang-format]: https://clang.llvm.org/docs/ClangFormat.html +[mirroring]: https://en.wikipedia.org/wiki/Mirroring_(psychology) + ## How to configure git It is important to [configure your git username and email address]( -- GitLab From 90d4bc10b0147de36f0389597476dd50a5ee8f4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= Date: Sun, 13 Mar 2022 11:06:21 +0100 Subject: [PATCH 3/5] Documentation: added section on code linting to CONTRIBUTING.md --- CONTRIBUTING.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 89448b9d6..7d1d46608 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -32,6 +32,17 @@ code. [clang-format]: https://clang.llvm.org/docs/ClangFormat.html [mirroring]: https://en.wikipedia.org/wiki/Mirroring_(psychology) +## Code linting + +The continuous integration on Gitlab features a code linting job using +[clang-tidy](https://clang.llvm.org/extra/clang-tidy/) to help developers +diagnosing and fixing common programming errors. The configuration is provided +in the [.clang-tidy](src/.clang-tidy) file. Various editors and IDEs provide +[integrations](https://clang.llvm.org/extra/clang-tidy/Integrations.html) either +directly for _clang-tidy_ or for [clangd](https://clangd.llvm.org/) (which +integrates _clang-tidy_). This way you can get full linting directly in your +editor without having to rely on the continuous integration. + ## How to configure git It is important to [configure your git username and email address]( -- GitLab From f4d026cd8facb8230e29bd5cc482620c7a459201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= Date: Sun, 13 Mar 2022 11:14:52 +0100 Subject: [PATCH 4/5] Removed CPack configuration from CMakeLists.txt It is unused and probably does not work. --- CMakeLists.txt | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d345284ef..f47049435 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -333,34 +333,6 @@ endif() # https://clang.llvm.org/docs/JSONCompilationDatabase.html set( CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "" ) -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Template Numerical Library") -set(CPACK_PACKAGE_VENDOR "MMG") -#set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt") -#set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt") -set(CPACK_PACKAGE_VERSION_MAJOR "0") -set(CPACK_PACKAGE_VERSION_MINOR "1") -set(CPACK_PACKAGE_VERSION_PATCH "0") -set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") -if(WIN32 AND NOT UNIX) - # There is a bug in NSI that does not handle full unix paths properly. Make - # sure there is at least one set of four (4) backlasshes. - #set(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\InstallIcon.bmp") - #set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\MyExecutable.exe") - set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} Template Numerical Library") - set(CPACK_NSIS_HELP_LINK "http:\\\\\\\\geraldine.fjfi.cvut.cz/~oberhuber/doku-wiki-tnl") - set(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\geraldine.fjfi.cvut.cz/~oberhuber/doku-wiki-tnl") - set(CPACK_NSIS_CONTACT "tomas.oberhuber@fjfi.cvut.cz") - set(CPACK_NSIS_MODIFY_PATH ON) -else(WIN32 AND NOT UNIX) -# set(CPACK_STRIP_FILES "bin/MyExecutable") -endif(WIN32 AND NOT UNIX) - -set(CPACK_SOURCE_STRIP_FILES "Debug") -set(CPACK_SOURCE_STRIP_FILES "Release") - -#set(CPACK_PACKAGE_EXECUTABLES "MyExecutable" "My Executable") -INCLUDE( CPack ) - # Print custom build options message( "-- Build options:" ) message( " OFFLINE_BUILD = ${OFFLINE_BUILD}" ) -- GitLab From c7225d41bad7e0f586d2bd2aef9d4341f16743c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= Date: Sun, 13 Mar 2022 11:18:12 +0100 Subject: [PATCH 5/5] Removed old copyright header from CMakeLists.txt It is also not necessary since this file is not included in the list of files installed on the user's system. --- CMakeLists.txt | 9 --------- 1 file changed, 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f47049435..b7182b305 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,12 +1,3 @@ -############################################################################### -# Cmake project script for TNL -# ------------------- -# begin : Dec 8, 2010 -# copyright : (C) 2010 by Tomas Oberhuber et al. -# email : tomas.oberhuber@fjfi.cvut.cz -# -############################################################################### - # cmake 3.12.2 is required due to compatibility with CUDA 10 # (see the issue reported here: https://github.com/clab/dynet/issues/1457 ) # cmake 3.13 is required for add_link_options -- GitLab