Skip to content

Commit 89c42ff

Browse files
Fortitude v0.7 (#310)
* Update ignored fortitude fules after breaking changes and add C003. * Explicitly label ftorch and test_utils as a fully public module. * Update pFUnit files to satisfy Fortitude. * Bump fortitude to version 0.7 in requirements.txt file. * Update workflow to remove file-specific rules.
1 parent 24b7556 commit 89c42ff

10 files changed

+16
-43
lines changed

.github/workflows/static_analysis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
run: |
100100
cd ${{ github.workspace }}
101101
. ftorch_venv/bin/activate
102-
fortitude check --ignore=E001,T041 src/ftorch.F90
102+
fortitude check src/ftorch.F90
103103
fortitude check src/ftorch_test_utils.f90
104104
105105
# Apply C++ and C linter and formatter, clang

fortitude.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[check]
22
# Ignored Rules and justification:
3-
# T041: assumed size - we require assumed size for library functionality when passing data to C/C++
4-
ignore = ["T041"]
3+
# C003: 'implicit none' missing 'external' - this is a Fortran 2013 feature and we support older standards
4+
# C071: assumed size - we require assumed size for library functionality when passing data to C/C++
5+
ignore = ["C003", "C071"]

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ruff==0.7.3
2-
fortitude-lint==0.6.0
2+
fortitude-lint==0.7.0
33
clang-format==19.1.3
44
clang-tidy==19.1.0
55
cmakelang

src/ftorch.F90

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ module ftorch
1313

1414
implicit none
1515

16+
public
17+
1618
! Set integer size for FTorch library
1719
integer, parameter :: ftorch_int = int32
1820

src/ftorch.fypp

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ module ftorch
3232

3333
implicit none
3434

35+
public
36+
3537
! Set integer size for FTorch library
3638
integer, parameter :: ftorch_int = int32
3739

src/ftorch_test_utils.f90

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ module ftorch_test_utils
1111

1212
implicit none
1313

14+
public
15+
1416
interface assert_isclose
1517
module procedure assert_isclose_real32
1618
module procedure assert_isclose_real64

src/ftorch_test_utils.fypp

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ module ftorch_test_utils
1919

2020
implicit none
2121

22+
public
23+
2224
interface assert_isclose
2325
#:for PREC in PRECISIONS
2426
module procedure assert_isclose_${PREC}$

test/unit/test_tensor_constructors_destructors.pf

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ contains
3939
! Constructor for the test case type
4040
function test_case_ctor(param)
4141
type(TestCaseType) :: test_case_ctor
42-
type(TestParametersType) :: param
42+
type(TestParametersType), intent(in) :: param
4343
test_case_ctor%param = param
4444
end function test_case_ctor
4545

@@ -396,7 +396,7 @@ contains
396396
! assignment operator
397397
tensor2 = tensor1
398398

399-
! Compare the data in the tensor to the input data
399+
! Compare the data in the tensor to the input data
400400
test_pass = assert_allclose(out_data, in_data, test_name="test_torch_tensor_from_blob")
401401

402402
if (.not. test_pass) then

test/unit/test_tensor_interrogation.pf

-18
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ contains
2222
@test
2323
subroutine test_torch_tensor_get_rank_1D()
2424

25-
implicit none
26-
2725
type(torch_tensor) :: tensor
2826
integer, parameter :: ndims = 1
2927
integer(kind=c_int64_t), parameter :: tensor_shape(ndims) = [6]
@@ -40,8 +38,6 @@ contains
4038
@test
4139
subroutine test_torch_tensor_get_rank_2D()
4240

43-
implicit none
44-
4541
type(torch_tensor) :: tensor
4642
integer, parameter :: ndims = 2
4743
integer(kind=c_int64_t), parameter :: tensor_shape(ndims) = [2,3]
@@ -58,8 +54,6 @@ contains
5854
@test
5955
subroutine test_torch_tensor_get_rank_3D()
6056

61-
implicit none
62-
6357
type(torch_tensor) :: tensor
6458
integer, parameter :: ndims = 3
6559
integer(kind=c_int64_t), parameter :: tensor_shape(ndims) = [1,2,3]
@@ -76,8 +70,6 @@ contains
7670
@test
7771
subroutine test_torch_tensor_get_shape_1D()
7872

79-
implicit none
80-
8173
type(torch_tensor) :: tensor
8274
integer, parameter :: ndims = 1
8375
integer(kind=c_int64_t), parameter :: tensor_shape(ndims) = [6]
@@ -94,8 +86,6 @@ contains
9486
@test
9587
subroutine test_torch_tensor_get_shape_2D()
9688

97-
implicit none
98-
9989
type(torch_tensor) :: tensor
10090
integer, parameter :: ndims = 2
10191
integer(kind=c_int64_t), parameter :: tensor_shape(ndims) = [2, 3]
@@ -112,8 +102,6 @@ contains
112102
@test
113103
subroutine test_torch_tensor_get_shape_3D()
114104

115-
implicit none
116-
117105
type(torch_tensor) :: tensor
118106
integer, parameter :: ndims = 3
119107
integer(kind=c_int64_t), parameter :: tensor_shape(ndims) = [1, 2, 3]
@@ -130,8 +118,6 @@ contains
130118
@test
131119
subroutine test_torch_tensor_get_dtype()
132120

133-
implicit none
134-
135121
type(torch_tensor) :: tensor
136122
integer, parameter :: ndims = 1
137123
integer(c_int64_t), parameter, dimension(ndims) :: tensor_shape = [1]
@@ -149,8 +135,6 @@ contains
149135
@test
150136
subroutine test_torch_tensor_get_device_type()
151137

152-
implicit none
153-
154138
type(torch_tensor) :: tensor
155139
integer, parameter :: ndims = 1
156140
integer(c_int64_t), parameter, dimension(ndims) :: tensor_shape = [1]
@@ -168,8 +152,6 @@ contains
168152
@test
169153
subroutine test_torch_tensor_get_device_index_default()
170154

171-
implicit none
172-
173155
type(torch_tensor) :: tensor
174156
integer, parameter :: ndims = 1
175157
integer(c_int64_t), parameter, dimension(ndims) :: tensor_shape = [1]

test/unit/test_tensor_operator_overloads.pf

+1-19
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ contains
5050
! Constructor for the test case type
5151
function test_case_ctor(param)
5252
type(TestCaseType) :: test_case_ctor
53-
type(TestParametersType) :: param
53+
type(TestParametersType), intent(in) :: param
5454
test_case_ctor%param = param
5555
end function test_case_ctor
5656

@@ -67,8 +67,6 @@ contains
6767
subroutine test_torch_tensor_assign(this)
6868
use, intrinsic :: iso_fortran_env, only: sp => real32
6969

70-
implicit none
71-
7270
! Set working precision for reals
7371
integer, parameter :: wp = sp
7472

@@ -116,8 +114,6 @@ contains
116114
use ftorch, only: operator(+)
117115
use, intrinsic :: iso_fortran_env, only: sp => real32
118116

119-
implicit none
120-
121117
! Set working precision for reals
122118
integer, parameter :: wp = sp
123119

@@ -172,8 +168,6 @@ contains
172168
use ftorch, only: operator(-)
173169
use, intrinsic :: iso_fortran_env, only: sp => real32
174170

175-
implicit none
176-
177171
! Set working precision for reals
178172
integer, parameter :: wp = sp
179173

@@ -233,8 +227,6 @@ contains
233227
use, intrinsic :: iso_fortran_env, only: sp => real32
234228
use, intrinsic :: iso_c_binding, only : c_associated, c_int64_t
235229

236-
implicit none
237-
238230
! Set working precision for reals
239231
integer, parameter :: wp = sp
240232

@@ -338,8 +330,6 @@ contains
338330
use ftorch, only: operator(*)
339331
use, intrinsic :: iso_fortran_env, only: sp => real32
340332

341-
implicit none
342-
343333
! Set working precision for reals
344334
integer, parameter :: wp = sp
345335

@@ -394,8 +384,6 @@ contains
394384
use ftorch, only: operator(/)
395385
use, intrinsic :: iso_fortran_env, only: sp => real32
396386

397-
implicit none
398-
399387
! Set working precision for reals
400388
integer, parameter :: wp = sp
401389

@@ -450,8 +438,6 @@ contains
450438
use ftorch, only: operator(/)
451439
use, intrinsic :: iso_fortran_env, only: sp => real32
452440

453-
implicit none
454-
455441
! Set working precision for reals
456442
integer, parameter :: wp = sp
457443

@@ -502,8 +488,6 @@ contains
502488
use ftorch, only: operator(**)
503489
use, intrinsic :: iso_fortran_env, only: sp => real32
504490

505-
implicit none
506-
507491
! Set working precision for reals
508492
integer, parameter :: wp = sp
509493

@@ -557,8 +541,6 @@ contains
557541
use, intrinsic :: iso_fortran_env, only: sp => real32
558542
use, intrinsic :: iso_c_binding, only : c_associated, c_int64_t
559543

560-
implicit none
561-
562544
! Set working precision for reals
563545
integer, parameter :: wp = sp
564546

0 commit comments

Comments
 (0)