From: Peter Munch Date: Tue, 16 Feb 2021 09:42:08 +0000 (+0100) Subject: indent-all: ensure only a single newline at end of files X-Git-Tag: v9.3.0-rc1~441^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d81519eba9198204641dae26defadc6ea28f3e38;p=dealii.git indent-all: ensure only a single newline at end of files --- diff --git a/contrib/python-bindings/source/CMakeLists.txt b/contrib/python-bindings/source/CMakeLists.txt index 5ab9f9ec17..d485f9435b 100644 --- a/contrib/python-bindings/source/CMakeLists.txt +++ b/contrib/python-bindings/source/CMakeLists.txt @@ -105,4 +105,3 @@ INSTALL(FILES ${_python_sources} DESTINATION ${DEAL_II_PYTHON_RELDIR} COMPONENT python_bindings ) - diff --git a/contrib/python-bindings/tests/CMakeLists.txt b/contrib/python-bindings/tests/CMakeLists.txt index a54c8a3f70..febc7b091b 100644 --- a/contrib/python-bindings/tests/CMakeLists.txt +++ b/contrib/python-bindings/tests/CMakeLists.txt @@ -28,4 +28,3 @@ FOREACH(_test_path ${_tests}) "PYTHONPATH=${CMAKE_BINARY_DIR}/${DEAL_II_PYTHON_RELDIR}/../:$ENV{PYTHONPATH};DEAL_II_PYTHON_TESTPATH=${_test_directory}" ) ENDFOREACH() - diff --git a/contrib/utilities/indent b/contrib/utilities/indent index 0da2355d68..ac8484e956 100755 --- a/contrib/utilities/indent +++ b/contrib/utilities/indent @@ -76,33 +76,9 @@ process_changed "tests include source examples cmake/scripts contrib/python-bind process_changed "tests include source examples cmake/scripts contrib/python-bindings doc" \ ".*\.(cc|h|cu|cuh|html|dox|txt)" remove_trailing_whitespace - # # Ensure only a single newline at end of files # -ensure_single_trailing_newline() -{ - f=$1 - - # Remove newlines at end of file - # Check that the current line only contains newlines - # If it doesn't match, print it - # If it does match and we're not at the end of the file, - # append the next line to the current line and repeat the check - # If it does match and we're at the end of the file, - # remove the line. - sed -e :a -e '/^\n*$/{$d;N;};/\n$/ba' $f >$f.tmpi - - # Then add a newline to the end of the file - # '$' denotes the end of file - # 'a\' appends the following text (which in this case is nothing) - # on a new line - sed -e '$a\' $f.tmpi >$f.tmp - - diff -q $f $f.tmp >/dev/null || mv $f.tmp $f - rm -f $f.tmp $f.tmpi -} -export -f ensure_single_trailing_newline process_changed "tests include source examples cmake/scripts contrib/python-bindings doc" \ ".*\.(cc|h|cu|cuh|html|dox|txt)" ensure_single_trailing_newline diff --git a/contrib/utilities/indent-all b/contrib/utilities/indent-all index efdfdca7b9..949b2af9cf 100755 --- a/contrib/utilities/indent-all +++ b/contrib/utilities/indent-all @@ -79,3 +79,11 @@ process "tests include source examples cmake/scripts contrib/python-bindings" \ process "tests include source examples cmake/scripts contrib/python-bindings doc" \ ".*\.(cc|h|cu|cuh|html|dox|txt)" remove_trailing_whitespace + +# +# Ensure only a single newline at end of files +# + +process "tests include source examples cmake/scripts contrib/python-bindings doc" \ + ".*\.(cc|h|cu|cuh|html|dox|txt)" ensure_single_trailing_newline + diff --git a/contrib/utilities/indent_common.sh b/contrib/utilities/indent_common.sh index 9c7df35c88..52071b0bac 100644 --- a/contrib/utilities/indent_common.sh +++ b/contrib/utilities/indent_common.sh @@ -317,3 +317,30 @@ process_changed() grep -E "^${2}$" | ${XARGS} '\n' -n 1 -P 10 -I {} bash -c "${3} {}" } + +# +# Ensure only a single newline at end of files +# +ensure_single_trailing_newline() +{ + f=$1 + + # Remove newlines at end of file + # Check that the current line only contains newlines + # If it doesn't match, print it + # If it does match and we're not at the end of the file, + # append the next line to the current line and repeat the check + # If it does match and we're at the end of the file, + # remove the line. + sed -e :a -e '/^\n*$/{$d;N;};/\n$/ba' $f >$f.tmpi + + # Then add a newline to the end of the file + # '$' denotes the end of file + # 'a\' appends the following text (which in this case is nothing) + # on a new line + sed -e '$a\' $f.tmpi >$f.tmp + + diff -q $f $f.tmp >/dev/null || mv $f.tmp $f + rm -f $f.tmp $f.tmpi +} +export -f ensure_single_trailing_newline diff --git a/doc/doxygen/code-gallery/CMakeLists.txt b/doc/doxygen/code-gallery/CMakeLists.txt index 066bf86976..e97717f976 100644 --- a/doc/doxygen/code-gallery/CMakeLists.txt +++ b/doc/doxygen/code-gallery/CMakeLists.txt @@ -189,4 +189,3 @@ ELSE() ADD_DEPENDENCIES(code-gallery build_code-gallery_h) ENDIF() - diff --git a/doc/doxygen/headers/geometry_and_primitives.h b/doc/doxygen/headers/geometry_and_primitives.h index 8ad1af5fcb..0790b0d1c3 100644 --- a/doc/doxygen/headers/geometry_and_primitives.h +++ b/doc/doxygen/headers/geometry_and_primitives.h @@ -49,4 +49,3 @@ * discussed in the first few tutorial programs and are used * throughout deal.II. */ - diff --git a/doc/doxygen/headers/iterators.h b/doc/doxygen/headers/iterators.h index 41ec4ac74e..fd5038653b 100644 --- a/doc/doxygen/headers/iterators.h +++ b/doc/doxygen/headers/iterators.h @@ -390,5 +390,3 @@ levels, and accessors for objects of lower dimensionality do not have a * @defgroup Accessors Accessor classes of the mesh iterators * @ingroup Iterators */ - - diff --git a/doc/doxygen/headers/vector_valued.h b/doc/doxygen/headers/vector_valued.h index 5251d2e2fc..1d3ba28126 100644 --- a/doc/doxygen/headers/vector_valued.h +++ b/doc/doxygen/headers/vector_valued.h @@ -1106,4 +1106,3 @@ * * @ingroup feall feaccess */ - diff --git a/doc/news/CMakeLists.txt b/doc/news/CMakeLists.txt index d13d9be77e..9847f8c805 100644 --- a/doc/news/CMakeLists.txt +++ b/doc/news/CMakeLists.txt @@ -48,4 +48,3 @@ IF(DEAL_II_COMPONENT_DOCUMENTATION) ADD_DEPENDENCIES(documentation changelog) ENDIF(DEAL_II_COMPONENT_DOCUMENTATION) - diff --git a/examples/step-12b/doc/intro.dox b/examples/step-12b/doc/intro.dox index 73ed8946ad..6c7e25db21 100644 --- a/examples/step-12b/doc/intro.dox +++ b/examples/step-12b/doc/intro.dox @@ -11,4 +11,3 @@ as part of this tutorial program.

The testcase

The problem we solve here is the same as the one in step-12. - diff --git a/examples/step-13/doc/intro.dox b/examples/step-13/doc/intro.dox index 0d599788cf..de0392cb6c 100644 --- a/examples/step-13/doc/intro.dox +++ b/examples/step-13/doc/intro.dox @@ -191,4 +191,3 @@ the techniques discussed here. So much now for all the theoretical and anecdotal background. The best way of learning about a program is to look at it, so here it is: - diff --git a/examples/step-13/doc/results.dox b/examples/step-13/doc/results.dox index 3d8c8c9f2a..7c8e7fe94c 100644 --- a/examples/step-13/doc/results.dox +++ b/examples/step-13/doc/results.dox @@ -179,4 +179,3 @@ executing refinement would improve the results (exercise: what does the code do?), making them consistently better than global refinement. Behavior is still irregular, though, so no results about an order of convergence are possible.) - diff --git a/examples/step-14/doc/intro.dox b/examples/step-14/doc/intro.dox index a0a806f608..ae77127acd 100644 --- a/examples/step-14/doc/intro.dox +++ b/examples/step-14/doc/intro.dox @@ -261,4 +261,3 @@ programs, we would kindly like to ask you to state this fact and the name of the author of the example program, Wolfgang Bangerth, in publications that arise from that, of your program consists in a considerable part of the example program. - diff --git a/examples/step-14/doc/results.dox b/examples/step-14/doc/results.dox index 38d90cdf9a..68ff071a1a 100644 --- a/examples/step-14/doc/results.dox +++ b/examples/step-14/doc/results.dox @@ -392,8 +392,3 @@ program in a modular way, such that implementing another test case, or another evaluation and dual functional is simple. You are encouraged to take the program as a basis for your own experiments, and to play a little. - - - - - diff --git a/examples/step-22/doc/results.dox b/examples/step-22/doc/results.dox index c9fc2037b0..af3677b7dc 100644 --- a/examples/step-22/doc/results.dox +++ b/examples/step-22/doc/results.dox @@ -792,4 +792,3 @@ then we get images where the fault line is curved: - diff --git a/examples/step-3/doc/intro.dox b/examples/step-3/doc/intro.dox index ab01d67767..32ae299667 100644 --- a/examples/step-3/doc/intro.dox +++ b/examples/step-3/doc/intro.dox @@ -405,4 +405,3 @@ data types but, as explained above, they are used throughout the library so that becomes possible to change the actual type to a larger one if necessary without having to go through the entire library and figure out whether a particular use of unsigned int corresponds to, say, a material indicator. - diff --git a/examples/step-35/doc/intro.dox b/examples/step-35/doc/intro.dox index 3685f54be8..208960e8f7 100644 --- a/examples/step-35/doc/intro.dox +++ b/examples/step-35/doc/intro.dox @@ -260,5 +260,3 @@ with $U_m = 1.5$, i.e. the inflow boundary conditions correspond to Poiseuille f Finally, on the right vertical wall we impose the condition that the vertical component of the velocity and the pressure should both be zero. The final time $T=10$. - - diff --git a/examples/step-4/doc/results.dox b/examples/step-4/doc/results.dox index fc9382f206..70e2ac1520 100644 --- a/examples/step-4/doc/results.dox +++ b/examples/step-4/doc/results.dox @@ -108,4 +108,3 @@ Essentially the possibilities for playing around with the program are the same as for the previous one, except that they will now also apply to the 3d case. For inspiration read up on possible extensions in the documentation of step 3. - diff --git a/examples/step-44/doc/intro.dox b/examples/step-44/doc/intro.dox index c86b0ee7d8..886720ef59 100644 --- a/examples/step-44/doc/intro.dox +++ b/examples/step-44/doc/intro.dox @@ -692,5 +692,3 @@ That is, the response would be overly stiff. The initial and final configurations are shown in the image above. Using symmetry, we solve for only one quarter of the geometry (i.e. a cube with dimension $0.001$). The inner-quarter of the upper surface of the domain is subject to a load of $p_0$. - - diff --git a/examples/step-46/doc/intro.dox b/examples/step-46/doc/intro.dox index 9193ff397a..b198c68b93 100644 --- a/examples/step-46/doc/intro.dox +++ b/examples/step-46/doc/intro.dox @@ -681,4 +681,3 @@ to a reasonably refined mesh. While this is clearly a suboptimal solution, it works for now and leaves room for future improvement. - diff --git a/examples/step-53/doc/intro.dox b/examples/step-53/doc/intro.dox index 780d12ec6e..ff7a19816e 100644 --- a/examples/step-53/doc/intro.dox +++ b/examples/step-53/doc/intro.dox @@ -374,4 +374,3 @@ in a number of static member functions. Having discussed the general outline of how we want to implement things, let us go to the program and show how it is done in practice. - diff --git a/examples/step-54/doc/results.dox b/examples/step-54/doc/results.dox index de6f91d648..c36e89c020 100644 --- a/examples/step-54/doc/results.dox +++ b/examples/step-54/doc/results.dox @@ -88,5 +88,3 @@ The final test shows results using instead the projection normal to the faces: The pictures confirm that the normal to mesh projection approach leads to grids that remain evenly spaced throughtout the refinement steps. At the same time, these meshes represent rather well the original geometry even in the bottom region of the bulb, which is not well recovered employing the directional projector or the normal projector. - - diff --git a/examples/step-56/doc/results.dox b/examples/step-56/doc/results.dox index 1f83e66bde..e733a4c269 100644 --- a/examples/step-56/doc/results.dox +++ b/examples/step-56/doc/results.dox @@ -211,4 +211,3 @@ option mentioned above is obtained by setting it to @p false. What you will find is that the number of FGMRES iterations stays constant under refinement if you use GMG this way. This means that the Multigrid is optimal and independent of $h$. - diff --git a/examples/step-59/doc/intro.dox b/examples/step-59/doc/intro.dox index ab3ea60135..091adf3dd3 100644 --- a/examples/step-59/doc/intro.dox +++ b/examples/step-59/doc/intro.dox @@ -288,4 +288,3 @@ the diagonal (a point-Jacobi scheme), where FE_DGQ and FE_DGQHermite do indeed behave differently and FE_DGQ needs 2-5 less iterations than FE_DGQHermite, despite the modification made to the Hermite-like shape functions to ensure a good conditioning. - diff --git a/examples/step-63/doc/results.dox b/examples/step-63/doc/results.dox index 9adfa505ee..555c6f0b50 100644 --- a/examples/step-63/doc/results.dox +++ b/examples/step-63/doc/results.dox @@ -549,6 +549,3 @@ longer influences convergence speed. The code is set up to work correctly with an adaptively refined mesh (the interface matrices are created and set). Devise a suitable refinement criterium or try the KellyErrorEstimator class. - - - diff --git a/examples/step-8/doc/results.dox b/examples/step-8/doc/results.dox index 4866fe2c54..7c93b703bc 100644 --- a/examples/step-8/doc/results.dox +++ b/examples/step-8/doc/results.dox @@ -51,5 +51,3 @@ solution to be symmetric about the $x$- and $y$-axes since the $x$- and $y$-forces are symmetric with respect to these axes. However, the force considered as a vector is not symmetric and consequently neither is the solution. - - diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index c1447782f5..5555b38dee 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -50,4 +50,3 @@ INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/deal.II COMPONENT library FILES_MATCHING PATTERN "*.h" ) - diff --git a/source/sundials/n_vector.cc b/source/sundials/n_vector.cc index 930f3903dd..e217cf7f2a 100644 --- a/source/sundials/n_vector.cc +++ b/source/sundials/n_vector.cc @@ -27,4 +27,4 @@ DEAL_II_NAMESPACE_OPEN DEAL_II_NAMESPACE_CLOSE -#endif \ No newline at end of file +#endif diff --git a/tests/boost/extract_representative_set_01.cc b/tests/boost/extract_representative_set_01.cc index cc724b1396..84b6e18487 100644 --- a/tests/boost/extract_representative_set_01.cc +++ b/tests/boost/extract_representative_set_01.cc @@ -46,4 +46,4 @@ main() for (const auto &b : boxes) deallog << "Box: " << Patterns::Tools::to_string(b.get_boundary_points()) << std::endl; -} \ No newline at end of file +} diff --git a/tests/fe/fe_conformity_dim_2_fe_nedelec_sz.cc b/tests/fe/fe_conformity_dim_2_fe_nedelec_sz.cc index eaec8b5e4d..8700f7dfa9 100644 --- a/tests/fe/fe_conformity_dim_2_fe_nedelec_sz.cc +++ b/tests/fe/fe_conformity_dim_2_fe_nedelec_sz.cc @@ -87,4 +87,4 @@ main(int, char **) } return 0; -} \ No newline at end of file +} diff --git a/tests/fe/fe_conformity_dim_2_fe_rt_nodal.cc b/tests/fe/fe_conformity_dim_2_fe_rt_nodal.cc index 2ee2ff2403..46e512b463 100644 --- a/tests/fe/fe_conformity_dim_2_fe_rt_nodal.cc +++ b/tests/fe/fe_conformity_dim_2_fe_rt_nodal.cc @@ -87,4 +87,4 @@ main(int, char **) } return 0; -} \ No newline at end of file +} diff --git a/tests/fe/fe_conformity_fill_vector_random.h b/tests/fe/fe_conformity_fill_vector_random.h index 319dfcedc3..dd6db7f3cb 100644 --- a/tests/fe/fe_conformity_fill_vector_random.h +++ b/tests/fe/fe_conformity_fill_vector_random.h @@ -83,4 +83,4 @@ namespace FEConforimityTest v = random_double_generator.generate(); } } -} // namespace FEConforimityTest \ No newline at end of file +} // namespace FEConforimityTest diff --git a/tests/fe/fe_conformity_test.h b/tests/fe/fe_conformity_test.h index 53fc59e2f1..6005480428 100644 --- a/tests/fe/fe_conformity_test.h +++ b/tests/fe/fe_conformity_test.h @@ -515,4 +515,4 @@ namespace FEConforimityTest make_dofs(); run_test(); } -} // namespace FEConforimityTest \ No newline at end of file +} // namespace FEConforimityTest diff --git a/tests/grid/grid_in_out_vtu_01.cc b/tests/grid/grid_in_out_vtu_01.cc index 483829d503..239da0afcf 100644 --- a/tests/grid/grid_in_out_vtu_01.cc +++ b/tests/grid/grid_in_out_vtu_01.cc @@ -78,4 +78,4 @@ main() else deallog << "Not OK" << std::endl; std::remove("grid.vtu"); -} \ No newline at end of file +} diff --git a/tests/optimization/CMakeLists.txt b/tests/optimization/CMakeLists.txt index dc2783f26c..0305d274cd 100644 --- a/tests/optimization/CMakeLists.txt +++ b/tests/optimization/CMakeLists.txt @@ -2,4 +2,3 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.1.0) INCLUDE(../setup_testsubproject.cmake) PROJECT(testsuite CXX) DEAL_II_PICKUP_TESTS() - diff --git a/tests/simplex/mapping_fe_fields_01.cc b/tests/simplex/mapping_fe_fields_01.cc index 9168411635..96577c03fe 100644 --- a/tests/simplex/mapping_fe_fields_01.cc +++ b/tests/simplex/mapping_fe_fields_01.cc @@ -97,4 +97,4 @@ main() initlog(); test(); -} \ No newline at end of file +} diff --git a/tests/symengine/sd_common_tests/utilities.h b/tests/symengine/sd_common_tests/utilities.h index a251e26c15..875f761791 100644 --- a/tests/symengine/sd_common_tests/utilities.h +++ b/tests/symengine/sd_common_tests/utilities.h @@ -141,4 +141,4 @@ print(Stream & stream, for (unsigned int l = k; l < dim; ++l) stream << name << "[" << i << "][" << j << "][" << k << "][" << l << "]: " << t[i][j][k][l] << std::endl; -} \ No newline at end of file +}