Skip to content

refactor: speed up pre-commit hooks - #2756

Open
MortGron wants to merge 3 commits into
masterfrom
pre-commit-speedup
Open

refactor: speed up pre-commit hooks#2756
MortGron wants to merge 3 commits into
masterfrom
pre-commit-speedup

Conversation

@MortGron

@MortGron MortGron commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Description

The two pre-commit hooks from the pre-commit-hooks package have been replaced.

  1. The debug statement rule is already handled by ruff
  2. The check docstring is first rule is deprecated and "fundamentally flawed" according to https://github.com/pre-commit/pre-commit-hooks#deprecated--replaced-hooks. A related rule from ruff has been added. The formatting of docstrings is to a large extent already handled by the ruff formatter.

Checklist:

  • Tests added/updated.
  • Documentation updated. Documentation is generated from docstrings - these must be updated according to your change.
    If a new method has been added it should be referenced in cognite.rst in order to generate docs based on its docstring.
  • The PR title follows the Conventional Commit spec.

@codecov

codecov Bot commented Aug 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.79%. Comparing base (49dcf68) to head (fb526dc).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2756   +/-   ##
=======================================
  Coverage   93.79%   93.79%           
=======================================
  Files         509      509           
  Lines       52263    52264    +1     
=======================================
+ Hits        49020    49023    +3     
+ Misses       3243     3241    -2     
Files with missing lines Coverage Δ
cognite/client/_api/entity_matching.py 92.30% <ø> (ø)
cognite/client/_sync_api/entity_matching.py 96.87% <100.00%> (+0.10%) ⬆️

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@MortGron
MortGron marked this pull request as ready for review August 8, 2026 08:15
@MortGron
MortGron requested review from a team as code owners August 8, 2026 08:15

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request removes some pre-commit hooks, updates auto-generated sync API code for entity matching, and configures new Ruff linting rules. Feedback points out that the added 'T10' rule is redundant because 'T' is already selected, and that a '# TODO' comment should be moved after the docstring to follow standard practices.

Comment thread pyproject.toml Outdated
Comment thread cognite/client/_api/entity_matching.py Outdated
Comment on lines +28 to +29
T_ContextualizationJob = TypeVar("T_ContextualizationJob", bound=ContextualizationJob)

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.

I wonder why this was added? Another bug in the auto-gen script perhaps 😅 If it is unused, feel free to just delete the lines (and keep diff so it wont be auto-generated immediately again)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The same typevar is defined in the async api. In both palces it is unclear to me if they are used for anything internal, but since they are public they might be used by external users I assume.

... description="AssetMatchingJob1",
... )
"""
# TODO: Not in service contract

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.

@olacognite could you verify these TODO comments are still needed?

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