Ruff standard set update - #1381
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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) andpyupgrade(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.
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.