-
Notifications
You must be signed in to change notification settings - Fork 8
Fortitude Test #88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fortitude Test #88
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,66 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| module physics_utils | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| contains | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| subroutine compute_energy(mass, velocity, energy) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| real*8 :: mass, velocity, energy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| energy = 0.5 * mass * velocity * velocity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end subroutine compute_energy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function square(x) result(y) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| real :: x, y | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| y = x * x | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end function square | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+4
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: find . -name "test.f90" -o -name "*.f90" | head -20Repository: coderabbitai/coderabbit-pr-review Length of output: 98 🏁 Script executed: if [ -f "fortitude/test.f90" ]; then
echo "=== File found: fortitude/test.f90 ==="
wc -l fortitude/test.f90
echo ""
echo "=== Lines 1-20 of fortitude/test.f90 ==="
head -20 fortitude/test.f90
fiRepository: coderabbitai/coderabbit-pr-review Length of output: 610 🏁 Script executed: rg "compute_energy|square" fortitude/test.f90Repository: coderabbitai/coderabbit-pr-review Length of output: 255 🏁 Script executed: grep -n "compute_energy\|square" fortitude/test.f90Repository: coderabbitai/coderabbit-pr-review Length of output: 267 🏁 Script executed: sed -n '45,60p' fortitude/test.f90Repository: coderabbitai/coderabbit-pr-review Length of output: 393 🏁 Script executed: sed -n '30,55p' fortitude/test.f90Repository: coderabbitai/coderabbit-pr-review Length of output: 530 🏁 Script executed: cat -n fortitude/test.f90 | sed -n '1,15p'Repository: coderabbitai/coderabbit-pr-review Length of output: 516 Use portable kinds and explicit Line 5 uses non-standard Suggested patch module physics_utils
+ use, intrinsic :: iso_fortran_env, only: real64
implicit none
private
public :: compute_energy, square
contains
subroutine compute_energy(mass, velocity, energy)
- real*8 :: mass, velocity, energy
- energy = 0.5 * mass * velocity * velocity
+ real(real64), intent(in) :: mass, velocity
+ real(real64), intent(out) :: energy
+ energy = 0.5_real64 * mass * velocity * velocity
end subroutine compute_energy
function square(x) result(y)
- real :: x, y
+ real, intent(in) :: x
+ real :: y
y = x * x
end function square🧰 Tools🪛 Fortitude (0.8.0)[error] 5-5: 'real*8' uses non-standard syntax (PORT021) [error] 5-5: real kind set with number literal '8' (PORT011) [error] 5-5: subroutine argument 'mass' missing 'intent' attribute (C061) [error] 5-5: subroutine argument 'velocity' missing 'intent' attribute (C061) [error] 5-5: subroutine argument 'energy' missing 'intent' attribute (C061) [error] 10-10: function argument 'x' missing 'intent' attribute (C061) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end module physics_utils | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| subroutine loose_procedure(n, result) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| integer :: n, result | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| integer :: i | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| result = 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| do i = 1, n | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| result = result + i | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end subroutine loose_procedure | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function external_double(x) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| real :: x, external_double | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| external_double = x * 2.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end function external_double | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+17
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: git ls-files | grep -i "test.f90"Repository: coderabbitai/coderabbit-pr-review Length of output: 96 🏁 Script executed: cat -n fortitude/test.f90 | sed -n '15,32p'Repository: coderabbitai/coderabbit-pr-review Length of output: 508 Add Lines 17–30 external procedures currently rely on implicit typing rules and omit argument direction. Please make both interfaces explicit by adding Suggested patch subroutine loose_procedure(n, result)
- integer :: n, result
+ implicit none
+ integer, intent(in) :: n
+ integer, intent(out) :: result
integer :: i
result = 0
do i = 1, n
result = result + i
end do
end subroutine loose_procedure
function external_double(x)
- real :: x, external_double
+ implicit none
+ real, intent(in) :: x
+ real :: external_double
external_double = x * 2.0
end function external_double📝 Committable suggestion
Suggested change
🧰 Tools🪛 Fortitude (0.8.0)[error] 17-18: subroutine missing 'implicit none' (C001) [error] 17-18: subroutine not contained within (sub)module or program (C092) [error] 18-18: subroutine argument 'n' missing 'intent' attribute (C061) [error] 18-18: subroutine argument 'result' missing 'intent' attribute (C061) [error] 27-28: function missing 'implicit none' (C001) [error] 27-28: function not contained within (sub)module or program (C092) [error] 28-28: function argument 'x' missing 'intent' attribute (C061) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| program main | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| use physics_utils | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+33
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: find . -name "test.f90" -type f | head -20Repository: coderabbitai/coderabbit-pr-review Length of output: 98 🏁 Script executed: find . -name "physics_utils*" -type f | head -20Repository: coderabbitai/coderabbit-pr-review Length of output: 59 🏁 Script executed: cat -n ./fortitude/test.f90 | head -50Repository: coderabbitai/coderabbit-pr-review Length of output: 1365 🏁 Script executed: rg "module physics_utils" -A 20Repository: coderabbitai/coderabbit-pr-review Length of output: 1396 🏁 Script executed: cat -n ./fortitude/test.f90 | sed -n '33,80p'Repository: coderabbitai/coderabbit-pr-review Length of output: 937 🏁 Script executed: cat -n ./fortitude/test.f90 | sed -n '33,66p' | grep -i "square"Repository: coderabbitai/coderabbit-pr-review Length of output: 145 🏁 Script executed: cat -n ./fortitude/test.f90 | sed -n '33,66p' | grep -i "call.*square\|square.*("Repository: coderabbitai/coderabbit-pr-review Length of output: 145 🏁 Script executed: rg "square" ./fortitude/test.f90 -A 2 -B 2Repository: coderabbitai/coderabbit-pr-review Length of output: 234 Tighten Add Suggested patch program main
use physics_utils, only: compute_energy
+ implicit none🧰 Tools🪛 Fortitude (0.8.0)[error] 33-34: program missing 'implicit none' (C001) [error] 34-34: 'use' statement missing 'only' clause (C121) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| real :: m, v, e | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| integer :: total, count | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| real :: pi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| real, dimension(10) :: arr | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| integer :: i | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| real :: statfunc, z | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| common /shared_block/ pi, total | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| statfunc(z) = z * z + 1.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pi = 3.14159 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| m = 1.5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| v = 10.0d0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| count = 100 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| call compute_energy(m, v, e) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| print *, "Energy:", e | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+36
to
+53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verifies kind mismatch indicators in fortitude/test.f90 using static inspection.
python - <<'PY'
from pathlib import Path
src = Path("fortitude/test.f90").read_text()
has_dummy_real8 = "real*8 :: mass, velocity, energy" in src
has_actual_default_real = "real :: m, v, e" in src
has_call = "call compute_energy(m, v, e)" in src
if has_dummy_real8 and has_actual_default_real and has_call:
print("Mismatch confirmed: compute_energy expects real*8, but main passes default real.")
else:
print("Pattern not fully matched; re-check declarations and call site.")
PYRepository: coderabbitai/coderabbit-pr-review Length of output: 158 Fix real-kind mismatch in Line 36 declares Use the Suggested patch program main
use physics_utils
+ use, intrinsic :: iso_fortran_env, only: real64
- real :: m, v, e
+ real(real64) :: m, v, e
@@
- m = 1.5
- v = 10.0d0
+ m = 1.5_real64
+ v = 10.0_real64
@@
call compute_energy(m, v, e)📝 Committable suggestion
Suggested change
🧰 Tools🪛 Fortitude (0.8.0)[error] 43-43: common blocks are obsolescent, prefer modules or derived types (OB011) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| print *, "Square via statement function:", statfunc(4.0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| do 10 i = 1, 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| arr(i) = real(i) * 1.5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (arr(i) .gt. 10.0) goto 20 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 continue | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 continue | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| call loose_procedure(10, total) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| print *, "Total:", total | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| end program main | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: coderabbitai/coderabbit-pr-review
Length of output: 1799
Harden module declarations with
implicit noneand explicit visibility.Line 1–2 define
module physics_utilswithoutimplicit noneand without a default access policy. This reduces compile-time safety and exports everything by default.Suggested patch
🧰 Tools
🪛 Fortitude (0.8.0)
[error] 1-2: module missing 'implicit none'
(C001)
[error] 1-2: module 'physics_utils' missing default accessibility statement
(C131)
🤖 Prompt for AI Agents