Skip to content

Tolerate missing additional data tables in code quality visualizations#113

Open
Jammy-Louie wants to merge 1 commit into
mainfrom
fix/tolerate-missing-additional-data-tables
Open

Tolerate missing additional data tables in code quality visualizations#113
Jammy-Louie wants to merge 1 commit into
mainfrom
fix/tolerate-missing-additional-data-tables

Conversation

@Jammy-Louie

@Jammy-Louie Jammy-Louie commented Jun 22, 2026

Copy link
Copy Markdown

Problem

complexity_vs_test_gaps_bubble and code_quality_executive_dashboard load their additionalDataTables (the secondary tables declared in their specs) with raw pd.read_csv(...). When the notebook runs without a path supplied for one of those tables, the parameter keeps its in-package default (e.g. ../samples/test_gaps.csv), which does not resolve in the run environment, and the notebook aborts before it can render anything:

FileNotFoundError: [Errno 2] No such file or directory: '../samples/test_gaps.csv'

Both notebooks already guard for empty data (len(df) == 0 -> "No data available"), but the raw read crashes before reaching that guard.

Fix

  • Switch the additionalDataTables reads to read_optional_csv() (the helper added in fix: handle missing DependenciesDeclared in release metro visualizations #104 for the release-metro notebooks), which returns an empty DataFrame for a None / missing / empty path. A missing optional table then flows into the existing "No data available" guard instead of crashing.

  • complexity_vs_test_gaps_bubble: data_file_gaps; also drop the now-unused import pandas as pd.

  • code_quality_executive_dashboard: data_file_methods, data_file_packages, data_file_smells, data_file_gaps (keeps pandas, still used by pd.concat / pd.Series).

Test plan

  • papermill with a missing/nonexistent data_file_gaps -> runs to completion and renders the "No data available" figure (previously PapermillExecutionError / FileNotFoundError).
  • papermill with real ClassQualityMetrics + TestGaps CSVs -> renders the bubble chart (2,137 points).
  • ruff check clean on both changed notebooks.
  • poe check-options passes for both.

Note

complexity_vs_test_gaps_bubble and code_quality_executive_dashboard read
their additionalDataTables (TestGaps, MethodQualityMetrics, PackageQualityMetrics,
CodeSmells) with raw pd.read_csv, which aborts the notebook with
FileNotFoundError when the platform does not supply the secondary CSV path.

Switch those reads to read_optional_csv (the helper already used for the
release-metro notebooks in #104) so a missing optional table degrades to an
empty DataFrame and the existing "No data available" guard, instead of
crashing the run. Drop the now-unused pandas import in
complexity_vs_test_gaps_bubble.
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.

1 participant