Skip to content

Fix JETLS warnings#105

Open
ufechner7 wants to merge 63 commits intomainfrom
cleanup
Open

Fix JETLS warnings#105
ufechner7 wants to merge 63 commits intomainfrom
cleanup

Conversation

@ufechner7
Copy link
Copy Markdown
Owner

@ufechner7 ufechner7 commented Mar 16, 2026

  • add the script bin/jetls, which does a static code check of all files in the src folder
  • fix all warnings that it reports
  • Add .JETLSConfig.toml.default
  • Fix documenter warnings
  • Update tests

@ufechner7 ufechner7 marked this pull request as draft March 16, 2026 16:13
@ufechner7 ufechner7 linked an issue Mar 16, 2026 that may be closed by this pull request
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 16, 2026

Codecov Report

❌ Patch coverage is 82.85714% with 60 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.30%. Comparing base (72d44a1) to head (07d2577).

Files with missing lines Patch % Lines
src/correction/velocity.jl 50.00% 15 Missing ⚠️
src/windfield/windfield_velocity.jl 71.05% 11 Missing ⚠️
src/floridyn_cl/prepare_simulation.jl 77.50% 9 Missing ⚠️
src/floris/gaussian.jl 57.14% 6 Missing ⚠️
src/settings.jl 77.77% 6 Missing ⚠️
src/FLORIDyn.jl 87.50% 4 Missing ⚠️
src/windfield/windfield_direction.jl 88.23% 4 Missing ⚠️
src/controller/controller.jl 92.30% 2 Missing ⚠️
src/visualisation/calc_flowfield.jl 85.71% 2 Missing ⚠️
src/floris/runfloris.jl 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #105      +/-   ##
==========================================
- Coverage   86.38%   86.30%   -0.09%     
==========================================
  Files          36       36              
  Lines        3048     3198     +150     
==========================================
+ Hits         2633     2760     +127     
- Misses        415      438      +23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors parts of FLORIDyn to use more strongly typed settings/buffers, standardizes package-root path handling via PACKAGE_ROOT, and improves robustness for reading wind-field CSV inputs (including headered numeric CSVs). It also updates tests/examples to match the refactors and tweaks visualisation/flow-field utilities.

Changes:

  • Introduce/propagate stronger typing (e.g., parametric Settings, typed TurbineProperties.cp_fun) and add additional runtime validation in core simulation paths.
  • Standardize path resolution with PACKAGE_ROOT and improve numeric CSV parsing (incl. headered CSV support) used by prepareSimulation.
  • Update flow-field/visualisation helpers and many tests/examples to match updated APIs and configuration patterns.

Reviewed changes

Copilot reviewed 40 out of 41 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
test/test_velocity_influence.jl Update test setup to configure correction mode via wind.correction before constructing typed Settings.
test/test_ti_influence.jl Same as above for TI correction mode.
test/test_direction_none.jl Same as above for direction correction mode (“None”).
test/test_direction_influence.jl Same as above for direction correction mode (“Influence”).
test/test_splines.jl Minor iteration change using zip to compare adjacent spline values.
test/test_settings.jl Make default-project path assertions robust via abspath comparisons.
test/test_prepare_simulation.jl Add coverage for loading headered CSVs in wErrorCov branches.
test/test_parallel.jl Update calcFlowField call sites to match updated keyword signature.
src/windfield/windfield_velocity.jl Robustness/perf adjustments for I&I estimator loop and interpolation+wErrorCov branch behavior.
src/windfield/windfield_turbulence.jl Clamp handling and small typing/interpolation changes for TI interpolation modes.
src/windfield/windfield_shear.jl Minor return simplification.
src/windfield/windfield_direction.jl Add type assertions, time clamping, and small allocation reductions in direction modes.
src/visualisation/plot_measurements.jl Initialize plotting labels/columns earlier and avoid unused loop indices.
src/visualisation/plot_flowfield.jl Initialize plot metadata earlier; minor exception handling tweak.
src/visualisation/create_video.jl Add explicit keyword argument types and reformat signature.
src/visualisation/calc_power.jl Adjust calls and destructuring for simulation utilities used by relative power computation.
src/visualisation/calc_flowfield.jl Refactor flow-field computation, buffer creation, and keyword signature (vis-focused).
src/settings.jl Use PACKAGE_ROOT for path resolution; improve CSV read error handling; type-stabilize TurbineProperties; update default project file writes.
src/floris/runfloris.jl Make rotor-point preparation more defensive and adjust single-turbine helper signature.
src/floris/gaussian.jl Fix initialization paths for certain velocity/dir modes; refactor power calculation to avoid shape pitfalls.
src/floris/discretization.jl Minor formatting-only changes.
src/FLORIDyn.jl Add PACKAGE_ROOT, reorganize exports/includes, strengthen buffer initialization, and adjust precompile workload.
src/floridyn_cl/prepare_simulation.jl Add readNumericCSV with header fallback; improve covariance parsing; switch many reads to use the new loader.
src/floridyn_cl/floridyn_cl.jl Add additional validation, create_unified_buffers(wf, floris) helper, and safer handling around time/demand and remote plotting parameters.
src/correction/velocity.jl Use invokelatest for some dynamic calls and add guarded access to estimator-only fields.
src/correction/direction.jl Route getDataDir calls via getfield + invokelatest.
src/controller/controller.jl Add input validation and consistent clamping for yaw/induction interpolation controllers.
examples/test_case_01.jl Update calcFlowField call signature.
examples/test_case_02.jl Update calcFlowField call signature.
examples/menu.jl Minor exception handling tweak.
examples/main.jl Refactor plot-mode selection logic and update some setup/destructuring patterns.
examples/main_tgc.jl Update commented calcFlowField call signature.
examples/main_power_plot.jl Update calcFlowField call signature.
examples/main_mini.jl Update calcFlowField call signature.
examples/main_large.jl Update calcFlowField call signature.
examples/bench.jl Add a minimal benchmark driver example for the 54-turbine layout.
docs/src/optimize_inductions.md Adjust inline formatting of numeric/math-like text.
docs/make.jl Add a Documenter HTML size warning threshold.
bin/jetls Add helper script to run jetls checks.
.JETLSConfig.toml.default Add a default configuration for JETLS diagnostics/formatter settings.
.github/workflows/CI.yml Pin setup-julia action version and opt into Node24 runtime for JS-based actions.

Comment thread src/settings.jl Outdated
Comment thread src/settings.jl Outdated
Comment thread src/settings.jl Outdated
Comment thread src/settings.jl Outdated
Comment thread src/visualisation/calc_power.jl
Comment thread src/correction/velocity.jl Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors FLORIDyn’s configuration and windfield/visualisation pipelines to improve type-stability and robustness (notably by introducing PACKAGE_ROOT, making Settings strongly typed, and hardening CSV/covariance loading), while updating tests/examples/docs/CI to match the new APIs and behaviors.

Changes:

  • Introduces PACKAGE_ROOT and updates path resolution to be consistent across settings, data discovery, and example installation.
  • Makes Settings (and related config usage) more strongly typed; updates tests to configure correction modes via WindCorrection before constructing Settings.
  • Improves robustness/performance in windfield interpolation, flowfield computation, and plotting; adds support for headered numeric CSV inputs and expands test coverage.

Reviewed changes

Copilot reviewed 45 out of 46 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/test_velocity_influence.jl Updates correction-mode setup to use WindCorrection prior to constructing typed Settings.
test/test_ti_influence.jl Same as above for TI correction influence mode.
test/test_splines.jl Minor iteration refactor using zip/@view for monotonicity checks.
test/test_settings.jl Makes path assertions resilient via abspath; adds Statistics import.
test/test_prepare_simulation.jl Adds regression test for loading headered CSVs in wErrorCov direction branches.
test/test_parallel.jl Updates calcFlowField call site for removed plt keyword.
test/test_getDataVel_branches.jl Adds coverage for I&I branch behavior when WSE.Offset is missing (logging + no wake reduction).
test/test_direction_none.jl Updates direction correction configuration via WindCorrection.
test/test_direction_influence.jl Updates direction correction configuration via WindCorrection.
src/windfield/windfield_velocity.jl Refactors I&I loop error handling; improves wErrorCov interpolation and noise application.
src/windfield/windfield_turbulence.jl Improves bounds handling; minor doc fixes and interpolation refactors.
src/windfield/windfield_shear.jl Returns shear directly (minor cleanup).
src/windfield/windfield_direction.jl Adds/strengthens type assertions; clamps time via t_eval; refactors interpolation loops.
src/visualisation/plot_measurements.jl Initializes plotting metadata defaults; avoids unused loop vars.
src/visualisation/plot_flowfield.jl Initializes contour metadata; simplifies catch usage.
src/visualisation/create_video.jl Adds keyword argument type annotations for clarity and stability.
src/visualisation/calc_power.jl Adapts to updated setup arity; reduces unused outputs; uses getfield indirection for prepareSimulation.
src/visualisation/calc_flowfield.jl Removes plt kwarg; uses getfield indirection; adds stronger postconditions for Z output.
src/settings.jl Switches to PACKAGE_ROOT; improves IO safety; makes TurbineProperties parametric for better type stability.
src/floris/runfloris.jl Adds rotor-points initialization validation; refactors single-turbine handler signature.
src/floris/gaussian.jl Adjusts initialization for some velocity/direction branches; refactors getPower computation.
src/floris/discretization.jl Minor formatting/whitespace cleanup.
src/FLORIDyn.jl Defines PACKAGE_ROOT; reorganizes exports/includes; strengthens unified-buffer initialization; refactors precompile workload.
src/floridyn_cl/prepare_simulation.jl Adds readNumericCSV for headered numeric CSVs; improves covariance parsing; uses PACKAGE_ROOT.
src/floridyn_cl/floridyn_cl.jl Adds stronger input validation; introduces create_unified_buffers(wf, floris) overload; refactors function lookups and plotting spawn args.
src/correction/velocity.jl Uses invokelatest for wind data retrieval; defensive property access for I&I estimator state.
src/correction/direction.jl Uses getfield + invokelatest indirection for getDataDir in corrections.
src/controller/controller.jl Adds nothing checks for interpolation data; clamps time via t_eval; updates ignored args for constant modes.
examples/test_case_02.jl Updates calcFlowField call site for removed plt keyword.
examples/test_case_01.jl Updates calcFlowField call site for removed plt keyword.
examples/menu.jl Simplifies exception handling (catch without binding).
examples/main.jl Refactors plot-mode selection; updates setup arity usage; updates flowfield calls; minor hygiene around globals.
examples/main_tgc.jl Updates commented flowfield call to new vis keyword.
examples/main_power_plot.jl Updates calcFlowField call to new vis keyword.
examples/main_mini.jl Updates calcFlowField call to new vis keyword.
examples/main_large.jl Updates calcFlowField call to new vis keyword.
examples/bench.jl Adds a minimal benchmark script for the 54-turbine layout.
docs/src/optimize_inductions.md Markdown/math formatting adjustments (code-style backticks for inline expressions).
docs/make.jl Adds HTML size warning threshold configuration for docs build.
data/2026_162T_NordseeOne.yaml Clarifies that I_and_I is not yet implemented.
data/2026_108T_NordseeOne.yaml Clarifies that I_and_I is not yet implemented.
data/2021_9T_Data.yaml Clarifies that I_and_I is not yet implemented.
data/2021_54T_NordseeOne.yaml Clarifies that I_and_I is not yet implemented.
bin/jetls Adds a helper script to run jetls checks.
.JETLSConfig.toml.default Adds default JetLS configuration (formatter + diagnostic patterns).
.github/workflows/CI.yml Adds Node runtime env opt-in; pins setup-julia action version.

Comment thread src/floris/gaussian.jl
Comment thread test/test_prepare_simulation.jl
Comment thread src/visualisation/calc_flowfield.jl
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes FLORIDyn’s wind-field I/O and simulation/visualisation plumbing to be more type-stable and robust (notably around covariance-aware wind inputs and flow-field computation), while updating tests/examples/docs and CI configuration accordingly.

Changes:

  • Add/adjust wind-field model dispatch for covariance-aware inputs (including a new Velocity_ZOH_wErrorCov overload) and improve data-loading robustness (e.g., headered numeric CSV support).
  • Refactor API usage across simulation + visualisation (e.g., calcFlowField keyword changes, more explicit initialization/validation, package-root path resolution via PACKAGE_ROOT).
  • Update tests, examples, docs, and CI/linting scaffolding to match the new behavior and signatures.

Reviewed changes

Copilot reviewed 46 out of 47 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/test_velocity_influence.jl Updates test setup to configure correction mode via WindCorrection before Settings.
test/test_vel.jl Adds test coverage for getWindSpeedT with WindVelType and scalar/vector iT signatures.
test/test_ti_influence.jl Updates test setup to configure TI correction via WindCorrection before Settings.
test/test_splines.jl Minor test-loop refactor using zip/@view.
test/test_settings.jl Adds Statistics import; makes path assertions more robust via abspath.
test/test_prepare_simulation.jl Adds regression test for headered CSV parsing in wErrorCov branches.
test/test_parallel.jl Updates calcFlowField call-site after keyword/API change.
test/test_getDataVel_branches.jl Adds coverage for I&I branch behavior when WSE.Offset is absent (logging + skip).
test/test_direction_none.jl Updates test setup to configure direction correction via WindCorrection.
test/test_direction_influence.jl Updates test setup to configure direction correction via WindCorrection.
src/windfield/windfield_velocity.jl Fixes/extends covariance velocity retrieval (incl. new ZOH_wErrorCov method) and indexing/noise handling.
src/windfield/windfield_turbulence.jl Improves interpolation clamping logic; fixes typos in comments.
src/windfield/windfield_shear.jl Returns interpolated value directly.
src/windfield/windfield_direction.jl Adds stronger typing, clamping via t_eval, and minor signature cleanups for direction modes.
src/visualisation/plot_measurements.jl Initializes plot metadata variables; avoids unused loop indices.
src/visualisation/plot_flowfield.jl Initializes derived variables earlier; simplifies exception catch.
src/visualisation/create_video.jl Makes keyword argument types explicit for createVideo.
src/visualisation/calc_power.jl Adapts to updated setup/run_floridyn return values and prepareSimulation invocation.
src/visualisation/calc_flowfield.jl Removes plt kwarg, keeps vis kwarg; routes calls through module functions and adds failure checks.
src/settings.jl Uses PACKAGE_ROOT for path resolution; tightens TurbineProperties typing; safer file writes for defaults.
src/floris/runfloris.jl Validates floris.rotor_points; refactors rotor discretization prep and single-turbine handler signature.
src/floris/gaussian.jl Fixes initialization path for ZOH_wErrorCov; improves RW_with_Mean dir init; refactors getPower.
src/floris/discretization.jl Minor formatting-only change.
src/FLORIDyn.jl Introduces PACKAGE_ROOT, reorders imports/exports/includes, and adjusts precompile workload invocation strategy.
src/floridyn_cl/prepare_simulation.jl Adds readNumericCSV, improves covariance parsing, uses PACKAGE_ROOT, and refactors data-load calls.
src/floridyn_cl/floridyn_cl.jl Adds stronger input validation, factors function lookups, and adds create_unified_buffers(wf, floris) overload.
src/correction/velocity.jl Routes velocity data retrieval through invokelatest; adds defensive I&I wake-reduction gating + debug logging.
src/correction/direction.jl Routes direction data retrieval through getfield + invokelatest.
src/controller/controller.jl Adds nil checks for controller data and clamps interpolation time; updates constant-mode signatures to ignore time.
examples/test_case_02.jl Updates calcFlowField call-site to new signature.
examples/test_case_01.jl Updates calcFlowField call-site to new signature.
examples/menu.jl Simplifies catch clause.
examples/main.jl Refactors plot-mode selection and updates setup/run_floridyn call-sites; updates calcFlowField usage.
examples/main_tgc.jl Updates commented calcFlowField call-site.
examples/main_power_plot.jl Updates calcFlowField call-site.
examples/main_mini.jl Updates calcFlowField call-site.
examples/main_large.jl Updates calcFlowField call-site.
examples/bench.jl Adds a benchmark-oriented example script for the 54-turbine layout.
docs/src/optimize_inductions.md Tweaks inline formatting for values/variables in the documentation.
docs/make.jl Adds size_threshold_warn to Documenter HTML config.
data/2026_162T_NordseeOne.yaml Updates comment to state I&I velocity mode is not implemented.
data/2026_108T_NordseeOne.yaml Updates comment to state I&I velocity mode is not implemented.
data/2021_9T_Data.yaml Updates comment to state I&I velocity mode is not implemented.
data/2021_54T_NordseeOne.yaml Updates comment to state I&I velocity mode is not implemented.
bin/jetls Adds helper script to run JETLS checks.
.JETLSConfig.toml.default Adds default JETLS configuration.
.github/workflows/CI.yml Updates julia-actions cache to v3 and opts into Node24 runtime for JS actions.

Comment thread src/settings.jl
Comment thread src/correction/velocity.jl
Comment thread src/windfield/windfield_velocity.jl
@ufechner7 ufechner7 marked this pull request as ready for review March 17, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix JETLS warnings

2 participants