diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 58aca208..c9c28e8f 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -14,13 +14,17 @@ repos:
       )$
   - id: trailing-whitespace
     files: (?x)^(
+        Makefile|
         config/make[.]inc[.\w]*|
-        tutorials/tutorial\d\d[-]?\w*/.+win
+        tutorials/tutorial\d\d[-]?\w*/.+win|
+        src/.+
       )$
   - id: end-of-file-fixer
     files: (?x)^(
+        Makefile|
         config/make[.]inc[.\w]*|
-        tutorials/tutorial\d\d[-]?\w*/.+win
+        tutorials/tutorial\d\d[-]?\w*/.+win|
+        src/.+
       )$
 - repo: https://github.com/pseewald/fprettify
   rev: v0.3.3
diff --git a/Makefile b/Makefile
index d2317960..a9ea8569 100644
--- a/Makefile
+++ b/Makefile
@@ -199,7 +199,7 @@ dist-legacy:
 test-serial: w90chk2chk wannier post
 	(cd $(ROOTDIR)/test-suite && ./run_tests --category=default )
 
-test-parallel: w90chk2chk wannier post 
+test-parallel: w90chk2chk wannier post
 	(cd $(ROOTDIR)/test-suite && ./run_tests --category=par --numprocs=4 )
 
 # Alias
diff --git a/src/Makefile.2 b/src/Makefile.2
index 9b3c1b0f..8ab27d2a 100644
--- a/src/Makefile.2
+++ b/src/Makefile.2
@@ -1,4 +1,4 @@
-# -*- MakeFile -*- 
+# -*- MakeFile -*-
 #  Should be no need to change below this line
 #
 
@@ -36,7 +36,7 @@ endif
 
 wannier libs dynlibs w90chk2chk w90spn2spn: POSTOPTS = $(TEMP1)
 wannier libs dynlibs w90chk2chk w90spn2spn: COMPILER = $(TEMP2)
-wannier: ../../wannier90.x 
+wannier: ../../wannier90.x
 w90chk2chk: ../../w90chk2chk.x
 w90spn2spn: ../../w90spn2spn.x
 
@@ -51,7 +51,7 @@ w90spn2spn: ../../w90spn2spn.x
 
 $(LIBRARYV2): $(OBJS)
 	$(AR) $(ARFLAGS) $(LIBRARYV2) $(OBJS)
-        
+
 post: POSTOPTS = $(TEMP1)
 post: COMPILER = $(TEMP2)
 post: mpi_test ../../postw90.x
@@ -71,11 +71,11 @@ ifndef MPIF90
 	$(info *  On many systems MPIF90=mpif90 will work      *) \
 	$(info ********************* STOP **********************) \
 	$(info  ) \
-	$(error MPIF90 is not set) 
+	$(error MPIF90 is not set)
 
 endif
 
-endif 
+endif
 
 
 
@@ -130,7 +130,7 @@ hamiltonian.o: ../hamiltonian.F90 ws_distance.o constants.o io.o utility.o types
 overlap.o: ../overlap.F90 constants.o io.o utility.o types.o sitesym.o wannier90_types.o comms.o error.o
 	 $(COMPILER) $(POSTOPTS) $(FCOPTS) -c ../overlap.F90
 
-kmesh.o: ../kmesh.F90 constants.o io.o utility.o types.o 
+kmesh.o: ../kmesh.F90 constants.o io.o utility.o types.o
 	 $(COMPILER) $(POSTOPTS) $(FCOPTS) -c ../kmesh.F90
 
 error_base.o: ../error_base.F90
@@ -193,11 +193,10 @@ wan_ham.o: $(POSTDIR)wan_ham.F90 types.o postw90_types.o constants.o utility.o p
 postw90_common.o: $(POSTDIR)postw90_common.F90 postw90_types.o ws_distance.o comms.o types.o utility.o constants.o io.o
 	$(COMPILER) $(POSTOPTS) $(FCOPTS) -c $(POSTDIR)postw90_common.F90
 
-postw90_types.o: $(POSTDIR)postw90_types.F90 comms.o types.o utility.o constants.o io.o 
+postw90_types.o: $(POSTDIR)postw90_types.F90 comms.o types.o utility.o constants.o io.o
 	$(COMPILER) $(POSTOPTS) $(FCOPTS) -c $(POSTDIR)postw90_types.F90
 
 postw90_readwrite.o: $(POSTDIR)postw90_readwrite.F90 comms.o postw90_types.o types.o utility.o constants.o io.o error.o
 	$(COMPILER) $(POSTOPTS) $(FCOPTS) -c $(POSTDIR)postw90_readwrite.F90
 
 .PHONY: wannier libs post clean mpi_test w90spn2spn
-
diff --git a/src/comms.F90 b/src/comms.F90
index 6a8609cd..af02d9dd 100644
--- a/src/comms.F90
+++ b/src/comms.F90
@@ -1920,5 +1920,4 @@ subroutine comms_scatterv_int_3(array, localcount, rootglobalarray, counts, disp
     call comms_no_sync_scatterv_int_3(array, localcount, rootglobalarray, counts, displs, &
                                       error, comm)
   end subroutine comms_scatterv_int_3
-
 end module w90_comms
diff --git a/src/error.F90 b/src/error.F90
index a5435612..8066d559 100644
--- a/src/error.F90
+++ b/src/error.F90
@@ -103,4 +103,3 @@ subroutine set_error_warn(err, mesg, comm)
   end subroutine set_error_warn
 
 end module w90_error
-
diff --git a/src/readwrite.F90 b/src/readwrite.F90
index 476ded57..d139d266 100644
--- a/src/readwrite.F90
+++ b/src/readwrite.F90
@@ -4295,7 +4295,7 @@ subroutine init_settings(settings)
   end subroutine init_settings
 
   subroutine expand_settings(settings) ! this is a compromise to avoid a fixed size
-    type(settings_data), allocatable :: nentries(:); 
+    type(settings_data), allocatable :: nentries(:)
     type(settings_type), intent(inout) :: settings
     integer :: n, m ! old, new sizes
     integer, parameter :: incsize = 20 ! default increment when settings array grows
diff --git a/src/w90chk2chk.F90 b/src/w90chk2chk.F90
index f4e62ed8..facdaf70 100644
--- a/src/w90chk2chk.F90
+++ b/src/w90chk2chk.F90
@@ -757,4 +757,3 @@ program w90chk2chk
   close (unit=stdout)
 
 end program w90chk2chk
-
diff --git a/src/w90spn2spn.F90 b/src/w90spn2spn.F90
index 3280ab9d..26f2cd0e 100644
--- a/src/w90spn2spn.F90
+++ b/src/w90spn2spn.F90
@@ -409,4 +409,3 @@ program w90spn2spn
   close (unit=stdout)
 
 end program w90spn2spn
-