Skip to content

Ruff standard set update - #1381

Merged
VisLab merged 4 commits into
hed-standard:mainfrom
VisLab:ruff_standard_set
Aug 21, 2026
Merged

Ruff standard set update#1381
VisLab merged 4 commits into
hed-standard:mainfrom
VisLab:ruff_standard_set

Conversation

@VisLab

@VisLab VisLab commented Aug 21, 2026

Copy link
Copy Markdown
Member

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the project's Ruff linting configuration (moving closer to a "standard" ruleset) and applies the resulting import-order, typing, and small style fixes across the codebase (package, tests, spec tests, benchmarks, and example notebooks).

Changes:

  • Expand Ruff lint rules to include isort (I) and pyupgrade (UP), and adjust per-file ignores for __init__.py.
  • Reorder/normalize imports across many modules and tests to satisfy isort conventions.
  • Modernize typing annotations (e.g., X | None) and apply small mechanical cleanups (e.g., f-strings, super()).

Reviewed changes

Copilot reviewed 191 out of 191 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/validator/test_tag_validator.py Import ordering cleanup for Ruff/isort.
tests/validator/test_tag_validator_util.py Remove stray blank line; keep imports tidy.
tests/validator/test_tag_validator_library.py Import ordering cleanup for Ruff/isort.
tests/validator/test_tag_validator_base.py Import ordering cleanup for Ruff/isort.
tests/validator/test_spreadsheet_validator.py Import ordering/grouping cleanup for Ruff/isort.
tests/validator/test_sidecar_validator.py Import ordering cleanup for Ruff/isort.
tests/validator/test_onset_validator.py Import ordering/grouping cleanup for Ruff/isort.
tests/validator/test_hed_validator.py Import ordering/grouping cleanup for Ruff/isort.
tests/validator/test_def_validator.py Import ordering cleanup for Ruff/isort.
tests/validator/test_char_validator.py Add spacing between import groups.
tests/tools/util/test_schema_util.py Import ordering/grouping cleanup for Ruff/isort.
tests/tools/util/test_io_util.py Reorder imported symbols for isort.
tests/tools/util/test_data_util.py Import ordering cleanup for Ruff/isort.
tests/tools/bids/test_bids_util.py Import ordering/grouping cleanup for Ruff/isort.
tests/tools/bids/test_bids_tabular_file.py Import ordering cleanup for Ruff/isort.
tests/tools/bids/test_bids_sidecar_file.py Import ordering and minor open() style tweak.
tests/tools/bids/test_bids_file.py Import ordering and minor open() style tweak.
tests/tools/bids/test_bids_file_group.py Import ordering cleanup for Ruff/isort.
tests/tools/bids/test_bids_dataset.py Import ordering cleanup for Ruff/isort.
tests/tools/analysis/test_temporal_event.py Import ordering cleanup for Ruff/isort.
tests/tools/analysis/test_tabular_summary.py Import ordering cleanup for Ruff/isort.
tests/tools/analysis/test_key_map.py Import ordering/grouping cleanup for Ruff/isort.
tests/tools/analysis/test_hed_type.py Import ordering/grouping cleanup for Ruff/isort.
tests/tools/analysis/test_hed_type_manager.py Import ordering cleanup for Ruff/isort.
tests/tools/analysis/test_hed_type_factors.py Import ordering cleanup for Ruff/isort.
tests/tools/analysis/test_hed_type_defs.py Import ordering cleanup for Ruff/isort.
tests/tools/analysis/test_hed_type_counts.py Add spacing between import groups.
tests/tools/analysis/test_hed_tag_manager.py Add spacing between import groups.
tests/tools/analysis/test_hed_tag_counts.py Import ordering/grouping cleanup for Ruff/isort.
tests/tools/analysis/test_file_dictionary.py Import ordering cleanup for Ruff/isort.
tests/tools/analysis/test_event_manager.py Import ordering/grouping cleanup for Ruff/isort.
tests/tools/analysis/test_event_checker.py Import ordering/grouping cleanup for Ruff/isort.
tests/tools/analysis/test_column_name_summary.py Add spacing between import groups.
tests/tools/analysis/test_assembling_hed_strings.py Import ordering/grouping cleanup for Ruff/isort.
tests/tools/analysis/test_annotation_util.py Import ordering and minor open() style tweak.
tests/test_pandas3_compat.py Import ordering/grouping cleanup for Ruff/isort.
tests/test_notebooks.py Import ordering and minor open() style tweak.
tests/test_cli_parameter_parity.py Import ordering/grouping cleanup for Ruff/isort.
tests/scripts/test_validate_hed_tabular.py Import ordering/grouping cleanup for Ruff/isort.
tests/scripts/test_validate_hed_string.py Import ordering and minor open() style tweak.
tests/scripts/test_validate_hed_sidecar.py Import ordering and minor open() style tweak.
tests/scripts/test_validate_bids.py Import ordering/grouping cleanup for Ruff/isort.
tests/scripts/test_script_util.py Import ordering/grouping cleanup for Ruff/isort.
tests/scripts/test_hed_convert_schema.py Import ordering/grouping cleanup for Ruff/isort.
tests/scripts/test_extract_tabular_summary.py Import ordering and minor open() style tweak.
tests/scripts/test_extract_bids_sidecar.py Import ordering and minor open() style tweak.
tests/schema/test_schema_wiki_fatal_errors.py Import ordering/grouping cleanup for Ruff/isort.
tests/schema/test_schema_version_manifest.py Remove stray blank line.
tests/schema/test_schema_validator_hed_id.py Import ordering/grouping cleanup for Ruff/isort.
tests/schema/test_schema_validation_util.py Import ordering/grouping cleanup for Ruff/isort.
tests/schema/test_schema_util.py Import ordering/grouping cleanup for Ruff/isort.
tests/schema/test_schema_inlibrary_attribute.py Import ordering and minor open() style tweak.
tests/schema/test_schema_format_roundtrip.py Import ordering and minor open() style tweak.
tests/schema/test_schema_extras_comprehensive.py Import ordering/grouping cleanup for Ruff/isort.
tests/schema/test_schema_entry.py Add spacing between import groups.
tests/schema/test_schema_compliance.py Import ordering/grouping cleanup for Ruff/isort.
tests/schema/test_schema_compare.py Import ordering/grouping cleanup for Ruff/isort.
tests/schema/test_schema_attribute_validators.py Import ordering/grouping cleanup for Ruff/isort.
tests/schema/test_json_explicit_attributes.py Import ordering/grouping cleanup for Ruff/isort.
tests/schema/test_hed_schema.py Import ordering and small f-string modernization.
tests/schema/test_hed_schema_io.py Import ordering/grouping and minor open() style tweak.
tests/schema/test_hed_schema_io_util_df.py Import ordering/grouping cleanup for Ruff/isort.
tests/schema/test_hed_schema_io_df.py Import ordering and minor open() style tweaks.
tests/schema/test_hed_schema_group.py Import ordering/grouping cleanup for Ruff/isort.
tests/schema/test_hed_id_util.py Import ordering/grouping cleanup for Ruff/isort.
tests/schema/test_convert_tags.py Modernize super() usage; import ordering cleanup.
tests/schema/test_base_tag.py Import ordering/grouping cleanup for Ruff/isort.
tests/models/test_timeseries_input.py Import ordering/grouping cleanup for Ruff/isort.
tests/models/test_tabular_input.py Import ordering/grouping cleanup for Ruff/isort.
tests/models/test_string_util.py Import ordering/grouping cleanup for Ruff/isort.
tests/models/test_string_search.py Import ordering cleanup for Ruff/isort.
tests/models/test_spreadsheet_input.py Import ordering/grouping cleanup for Ruff/isort.
tests/models/test_sidecar.py Import ordering/grouping cleanup for Ruff/isort.
tests/models/test_schema_lookup.py Import ordering cleanup for Ruff/isort.
tests/models/test_query_util.py Import ordering/grouping cleanup for Ruff/isort.
tests/models/test_query_handler.py Import ordering/grouping cleanup for Ruff/isort.
tests/models/test_hed_tag.py Import ordering/grouping cleanup for Ruff/isort.
tests/models/test_hed_string.py Import ordering/grouping cleanup for Ruff/isort.
tests/models/test_hed_group.py Import ordering/grouping cleanup for Ruff/isort.
tests/models/test_df_util.py Import ordering and symbol ordering cleanup for Ruff/isort.
tests/models/test_definition_entry.py Import ordering/grouping cleanup for Ruff/isort.
tests/models/test_definition_dict.py Import ordering/grouping cleanup for Ruff/isort.
tests/models/test_column_mapper.py Import ordering/grouping cleanup for Ruff/isort.
tests/models/test_basic_search.py Import ordering/grouping cleanup for Ruff/isort.
tests/models/test_basic_search_util.py Add spacing between import groups.
tests/models/test_base_input.py Import ordering/grouping cleanup for Ruff/isort.
tests/errors/test_error_reporter.py Import ordering/grouping cleanup for Ruff/isort.
tests/errors/test_error_filter_count.py Add spacing between import groups.
spec_tests/test_hed_cache.py Import ordering/grouping cleanup for Ruff/isort.
spec_tests/test_errors.py Import ordering/grouping and minor open() style tweak.
spec_tests/test_bids_datasets.py Import ordering cleanup for Ruff/isort.
pyproject.toml Enable Ruff I (isort) and UP (pyupgrade); refine ignore/per-file ignore set.
hed/validator/util/tag_util.py Import ordering/grouping cleanup for Ruff/isort.
hed/validator/util/group_util.py Import ordering cleanup for Ruff/isort.
hed/validator/util/dup_util.py Replace Union[...] with `X
hed/validator/util/char_util.py Import ordering and minor open() style tweak.
hed/validator/spreadsheet_validator.py Import ordering cleanup for Ruff/isort.
hed/validator/sidecar_validator.py Import ordering cleanup for Ruff/isort.
hed/validator/reserved_checker.py Import ordering; modernize super().__new__; minor open() style tweak.
hed/validator/onset_validator.py Import ordering cleanup for Ruff/isort.
hed/validator/hed_validator.py Import ordering cleanup for Ruff/isort.
hed/validator/def_validator.py Import ordering/grouping cleanup for Ruff/isort.
hed/tools/util/schema_util.py Import ordering/grouping cleanup for Ruff/isort.
hed/tools/util/data_util.py Import ordering/grouping and small generator/tuple cleanup.
hed/tools/bids/bids_util.py Import ordering and minor open() style tweak.
hed/tools/bids/bids_tabular_file.py Add spacing between import groups.
hed/tools/bids/bids_sidecar_file.py Import ordering/grouping cleanup for Ruff/isort.
hed/tools/bids/bids_file.py Add spacing between import groups.
hed/tools/bids/bids_file_group.py Import ordering/grouping cleanup for Ruff/isort.
hed/tools/bids/bids_dataset.py Import ordering/grouping cleanup for Ruff/isort.
hed/tools/analysis/tabular_summary.py Replace Union[...] with `dict
hed/tools/analysis/key_map.py Add spacing between import groups.
hed/tools/analysis/hed_type.py Add spacing between import groups.
hed/tools/analysis/hed_type_manager.py Import ordering/grouping cleanup for Ruff/isort.
hed/tools/analysis/hed_type_factors.py Add spacing between import groups.
hed/tools/analysis/hed_type_defs.py Import ordering cleanup for Ruff/isort.
hed/tools/analysis/hed_tag_manager.py Import ordering cleanup for Ruff/isort.
hed/tools/analysis/file_dictionary.py Minor generator simplification (yield from) and import spacing.
hed/tools/analysis/event_manager.py Import ordering/grouping cleanup for Ruff/isort.
hed/tools/analysis/event_checker.py Import ordering cleanup for Ruff/isort.
hed/tools/analysis/annotation_util.py Replace Union[...] with `X
hed/scripts/validate_schemas.py Import ordering/grouping cleanup for Ruff/isort.
hed/scripts/validate_hed_tabular.py Import ordering/grouping cleanup for Ruff/isort.
hed/scripts/validate_hed_string.py Import ordering/grouping cleanup for Ruff/isort.
hed/scripts/validate_hed_sidecar.py Import ordering/grouping cleanup for Ruff/isort.
hed/scripts/validate_bids.py Import ordering/grouping cleanup for Ruff/isort.
hed/scripts/script_utils.py Import ordering/grouping cleanup for Ruff/isort.
hed/scripts/schema_script_util.py Import ordering/grouping cleanup for Ruff/isort.
hed/scripts/hed_extract_bids_sidecar.py Import ordering/grouping cleanup for Ruff/isort.
hed/scripts/hed_convert_schema.py Import ordering/grouping cleanup for Ruff/isort.
hed/scripts/extract_tabular_summary.py Import ordering/grouping cleanup for Ruff/isort.
hed/scripts/add_hed_ids.py Import ordering/grouping cleanup for Ruff/isort.
hed/schema/schema_validation/validation_util.py Replace Union[...] with `str
hed/schema/schema_validation/hed_id_validator.py Import ordering/grouping cleanup for Ruff/isort.
hed/schema/schema_validation/compliance.py Import ordering/grouping cleanup for Ruff/isort.
hed/schema/schema_validation/attribute_validators.py Import ordering/grouping cleanup for Ruff/isort.
hed/schema/schema_io/xml2schema.py Import ordering; minor f-string modernization.
hed/schema/schema_io/wiki2schema.py Import ordering and minor open() style tweak.
hed/schema/schema_io/schema2xml.py Import ordering (but see PR comment about isort-friendly consolidation).
hed/schema/schema_io/schema2wiki.py Import ordering/grouping cleanup for Ruff/isort.
hed/schema/schema_io/schema2json.py Import ordering/grouping cleanup for Ruff/isort.
hed/schema/schema_io/schema2df.py Import ordering/grouping cleanup for Ruff/isort.
hed/schema/schema_io/schema2base.py Import ordering/grouping cleanup for Ruff/isort.
hed/schema/schema_io/schema_util.py Import ordering and f-string modernization.
hed/schema/schema_io/json2schema.py Import ordering and minor open() style tweak.
hed/schema/schema_io/hed_id_util.py Import ordering/grouping cleanup for Ruff/isort.
hed/schema/schema_io/df2schema.py Import ordering/grouping cleanup for Ruff/isort.
hed/schema/schema_io/df_util.py Import ordering/grouping cleanup for Ruff/isort.
hed/schema/schema_io/base2schema.py Import ordering/grouping cleanup for Ruff/isort.
hed/schema/schema_header_util.py Import ordering cleanup for Ruff/isort.
hed/schema/schema_comparer.py Import ordering (but see PR comment about combining duplicate-module imports).
hed/schema/hed_schema.py Import ordering and typing annotation modernization.
hed/schema/hed_schema_section.py Typing annotation modernization (`X
hed/schema/hed_schema_io.py Import ordering and typing annotation modernization.
hed/schema/hed_schema_group.py Import ordering and typing annotation modernization.
hed/schema/hed_schema_entry.py Import ordering and typing annotation modernization.
hed/schema/hed_schema_base.py Import ordering cleanup for Ruff/isort.
hed/schema/hed_cache.py Import ordering and typing annotation modernization; minor encode() simplification.
hed/schema/hed_cache_lock.py Import ordering and exception tuple cleanup; minor open() style tweak.
hed/models/tabular_input.py Typing annotation modernization (`X
hed/models/string_util.py Import spacing cleanup.
hed/models/string_search.py Import ordering cleanup for Ruff/isort.
hed/models/spreadsheet_input.py Import ordering cleanup for Ruff/isort.
hed/models/sidecar.py Import ordering and minor open() style tweak.
hed/models/query_service.py Typing annotation modernization (`X
hed/models/query_handler.py Import ordering/grouping cleanup for Ruff/isort.
hed/models/hed_tag.py Typing annotation modernization (`X
hed/models/hed_string.py Typing annotation modernization and import spacing cleanup.
hed/models/hed_group.py Typing annotation modernization and import cleanup.
hed/models/df_util.py Import ordering/grouping cleanup for Ruff/isort.
hed/models/definition_dict.py Typing annotation modernization (`X
hed/models/def_expand_gather.py Import spacing cleanup.
hed/models/column_metadata.py Typing annotation modernization (`dict
hed/models/column_mapper.py Import ordering/grouping cleanup for Ruff/isort.
hed/models/basic_search.py Import ordering/grouping cleanup for Ruff/isort.
hed/models/base_input.py Typing annotation modernization (`X
hed/errors/schema_error_messages.py Import ordering/grouping cleanup for Ruff/isort.
hed/errors/error_reporter.py Typing annotation modernization (`str
hed/errors/error_messages.py Import ordering/grouping cleanup for Ruff/isort.
hed/cli/cli.py Add spacing between import groups.
examples/validate_bids_datasets.ipynb Notebook JSON reformat; import order in a cell adjusted.
examples/validate_bids_dataset.ipynb Notebook JSON reformat; cell metadata/order normalized.
examples/validate_bids_dataset_nondefault.ipynb Notebook JSON reformat; cell metadata/order normalized.
examples/summarize_events.ipynb Notebook JSON reformat (added blank line in a cell).
examples/sidecar_to_spreadsheet.ipynb Notebook JSON reformat; cell metadata/order normalized.
examples/merge_spreadsheet_into_sidecar.ipynb Notebook JSON reformat; cell metadata/order normalized.
examples/find_event_combinations.ipynb Notebook JSON reformat (added blank line in a cell).
examples/extract_json_template.ipynb Notebook JSON reformat (added blank line in a cell).
benchmarks/search_benchmark.py Import ordering/grouping cleanup for Ruff/isort.
benchmarks/data_generator.py Import ordering/grouping cleanup for Ruff/isort.
AGENTS.md Add documented Git flow guidance.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread hed/schema/schema_comparer.py
Comment thread hed/schema/schema_io/schema2xml.py Outdated
Enable isort combine-as-imports so aliased imports merge with plain
imports from the same module, addressing both PR hed-standard#1381 review comments,
and apply the resulting consolidation across the repo.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@VisLab
VisLab merged commit 962f891 into hed-standard:main Aug 21, 2026
20 checks passed
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.

2 participants