Skip to content

Commit 9e51f0f

Browse files
authored
fortitude: enable unchecked-stat rule (#46)
Ignoring IO errors is BAD!
1 parent ea08176 commit 9e51f0f

3 files changed

Lines changed: 15 additions & 30 deletions

File tree

fortitude.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ ignore = [
33
"implicit-external-procedures", # requires Fortran 2018
44
"star-kind", # don't use integer*4 et al
55
"literal-kind",
6-
"unchecked-stat", # TODO: Fix this!
76
]
87
line-length = 132
98
show-fixes = true

src/modules/RestartModule.f90

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -700,51 +700,37 @@ subroutine WriteElecStruc(ES, nfile_in)
700700
3 format(10(1x, es15.8))
701701

702702
write (nf, *) '# Orbitals'
703-
write (nf, 3, iostat=ierr) ES%OldOrbitals
703+
write (nf, 3) ES%OldOrbitals
704704
write (nf, *) '# CI vectors'
705-
write (nf, 3, iostat=ierr) ES%OldCIVecs
705+
write (nf, 3) ES%OldCIVecs
706706
write (nf, *) '# Overlap matrix'
707-
write (nf, 3, iostat=ierr) ES%OverlapMatrix
707+
write (nf, 3) ES%OverlapMatrix
708708
write (nf, *) '# TC Blob'
709-
write (nf, 3, iostat=ierr) ES%OldBlob
709+
write (nf, 3) ES%OldBlob
710710
write (nf, *) '# MSPT2 Coeffs'
711-
write (nf, 3, iostat=ierr) ES%OldMSPT2C
711+
write (nf, 3) ES%OldMSPT2C
712712
write (nf, *) '# Electronic Phases'
713-
write (nf, *, iostat=ierr) ES%ElecPhase
714-
715-
return
713+
write (nf, *) ES%ElecPhase
716714
end subroutine WriteElecStruc
717715

718-
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
719-
subroutine ReadElecStruc(ES, nfile_in)
720-
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
716+
subroutine ReadElecStruc(ES, nf)
721717
type(T_ElecStruc), intent(inout) :: ES
722-
integer(kind=DefInt), optional :: nfile_in
723-
724-
integer(kind=DefInt) :: nf ! unit number to write to
725-
! WTF: We shouldn't just blidly ignore all errors!
726-
integer(kind=DefInt) :: ierr ! catch errors that may be thrown
727-
728-
! set which file we are writing to
729-
nf = 5
730-
if (present(nfile_in)) nf = nfile_in
718+
integer(kind=DefInt), intent(in) :: nf
731719

732720
3 format(10(1x, es15.8))
733721

734722
read (nf, *)
735-
read (nf, 3, iostat=ierr) ES%OldOrbitals
723+
read (nf, 3) ES%OldOrbitals
736724
read (nf, *)
737-
read (nf, 3, iostat=ierr) ES%OldCIVecs
725+
read (nf, 3) ES%OldCIVecs
738726
read (nf, *)
739-
read (nf, 3, iostat=ierr) ES%OverlapMatrix
727+
read (nf, 3) ES%OverlapMatrix
740728
read (nf, *)
741-
read (nf, 3, iostat=ierr) ES%OldBlob
729+
read (nf, 3) ES%OldBlob
742730
read (nf, *)
743-
read (nf, 3, iostat=ierr) ES%OldMSPT2C
731+
read (nf, 3) ES%OldMSPT2C
744732
read (nf, *)
745-
!DEBUG - changed v from read(nf,3,iostat=ierr)
746-
read (nf, *, iostat=ierr) ES%ElecPhase
747-
return
733+
read (nf, *) ES%ElecPhase
748734
end subroutine ReadElecStruc
749735

750736
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

src/modules/SamplingModule.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,7 @@ subroutine read_frequencies(natoms, mass, nfreq, freq, Umat)
10821082

10831083
case ('HESS')
10841084
filein = trim(FMSWorkingDir)//'Hessian.dat'
1085-
open (newunit=ifunit, file=filein, status='old', action='read', iostat=ios)
1085+
open (newunit=ifunit, file=filein, status='old', action='read')
10861086
write (fmiOut, *) 'Using Hessian.dat to find normal mode frequencies'
10871087
read (IFUnit, *, end=999) natomsin
10881088
if (natomsin /= natoms) then

0 commit comments

Comments
 (0)