Skip to content

Commit b728c51

Browse files
authored
fix: Mark get_log_level() pure for consistency (fixes #1347) (#1348)
Summary - Mark get_log_level() as pure since it reads a module variable without side effects. - Clarifies intent, enables compiler optimizations, and aligns with project guidance to prefer purity when applicable. Verification Commands run locally: - make test-ci - CI essential suite completed successfully - make test - ALL TESTS PASSED (fpm test) - make verify-artifacts - Artifact verification passed (no plot/text regressions) Key excerpts: - CI essential: "CI essential test suite completed successfully" - Full suite: "ALL TESTS PASSED (fpm test)" - Artifacts: strict checks on PDFs/PNGs/txt passed No artifact/output differences, as expected (signature-only attribute change). Housekeeping - Wrapped two long lines in src/external/fortplot_logging.f90 to comply with the 88–90 column limit (no functional changes).
1 parent cb1c89d commit b728c51

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/external/fortplot_logging.f90

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ module fortplot_logging
1212
private
1313

1414
public :: set_log_level, get_log_level, log_info, log_warning, log_error, log_debug
15-
public :: LOG_LEVEL_SILENT, LOG_LEVEL_ERROR, LOG_LEVEL_WARNING, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG
15+
public :: LOG_LEVEL_SILENT, LOG_LEVEL_ERROR, &
16+
LOG_LEVEL_WARNING, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG
1617
public :: initialize_warning_suppression, is_warnings_suppressed
1718

1819
! Log levels (in increasing verbosity)
@@ -47,7 +48,7 @@ subroutine set_log_level(level)
4748
current_log_level = lvl
4849
end subroutine set_log_level
4950

50-
function get_log_level() result(level)
51+
pure function get_log_level() result(level)
5152
!! Get the current global logging level
5253
!! Returns one of: LOG_LEVEL_SILENT, LOG_LEVEL_ERROR,
5354
!! LOG_LEVEL_WARNING, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG
@@ -120,7 +121,8 @@ subroutine initialize_warning_suppression()
120121
end if
121122

122123
! Check for manual warning suppression override
123-
call get_environment_variable('FORTPLOT_SUPPRESS_WARNINGS', env_value, status=status)
124+
call get_environment_variable('FORTPLOT_SUPPRESS_WARNINGS', env_value, &
125+
status=status)
124126
if (status == 0 .and. len_trim(env_value) > 0) then
125127
warnings_suppressed = parse_boolean_env(env_value)
126128
suppression_initialized = .true.

0 commit comments

Comments
 (0)