Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrating ruff precommit #1473

Merged

Conversation

Abellegese
Copy link
Contributor

@Abellegese Abellegese commented Dec 28, 2024

Thank you for taking your time to contribute to Ersilia, just a few checks before we proceed

  • Have you followed the guidelines in our Contribution Guide
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Refactoring Overview

This PR integrate ruff and precommit-hook based linting. Also refactors the codebase to comply with the specified ruff linting and formatting rules. Below is a checklist of the key changes made:

  • Line Length: Updated to a maximum of 88 characters for better readability.

  • Indentation: Standardized indentation width to 4 spaces.

  • Target Python Version: Refactored code to align with Python 3.10 features and standards.

  • Selected Rules: Enabled checks for:

    • D101, D102: Require docstrings for public classes and methods.
    • E4, E9, F: Address common syntax, logic, and runtime errors.
    • I: Import formatting and ordering.
    • W: Address warnings for improved code quality.
  • Ignored Rules: Excluded:

    • D104: Missing docstring in packages.
    • D105: Missing docstring in magic methods.
    • D107: Missing docstring in init.
  • Fixable Rules: Applied automated fixes for all applicable rules.

  • Dummy Variables: Standardized naming for unused variables with the regex ^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$.

  • Docstring Style: Adopted NumPy-style docstrings for consistency.

  • Formatting: Ensured:

    • Double quotes for string literals.
    • Spaces for indentation.
    • Consistent handling of trailing commas.
    • Automatic detection of line endings.
    • Proper formatting for code examples in docstrings (line length = 50 characters).

Results

  • On github action
    ruff
  • On local
    ruff2

Related to #1417

@Abellegese Abellegese changed the title Chore/integrate ruff precommit Integrating ruff precommit Dec 29, 2024
@Abellegese Abellegese closed this Dec 29, 2024
@Abellegese Abellegese reopened this Dec 29, 2024
@Abellegese Abellegese closed this Dec 29, 2024
@Abellegese Abellegese reopened this Dec 29, 2024
@DhanshreeA
Copy link
Contributor

@Abellegese could you please resolve conflicts here?

@Abellegese
Copy link
Contributor Author

Yes @DhanshreeA I will.

* added new categories

* added try-except

* bugfix list to dictionary

* added output consistency field and blackened code

* Update columns_information.py
@Abellegese Abellegese force-pushed the chore/integrate-ruff-precommit branch from fcf4287 to 1cce2f9 Compare December 30, 2024 18:51
DhanshreeA and others added 21 commits December 31, 2024 15:38
* Modify header calculation to choose from predefined example output file or standard example output file

* Remove the readiness function from SCRA because it is redundant, since those checks are also performed by the amenable function

* Remove unused method

* Make csv serialization work for any kind of model api response

* Remove the standard flag from the CLI since it is now the default run

* Update tests
* Merge sample command with the example command

* Fix example command usage
* Modify header calculation to choose from predefined example output file or standard example output file

* Remove the readiness function from SCRA because it is redundant, since those checks are also performed by the amenable function

* Remove unused method

* Make csv serialization work for any kind of model api response

* Remove the standard flag from the CLI since it is now the default run

* Update tests
* Modify header calculation to choose from predefined example output file or standard example output file

* Remove the readiness function from SCRA because it is redundant, since those checks are also performed by the amenable function

* Remove unused method

* Make csv serialization work for any kind of model api response

* Remove the standard flag from the CLI since it is now the default run

* Update tests
@Abellegese Abellegese force-pushed the chore/integrate-ruff-precommit branch from f173a24 to 1c9f136 Compare December 31, 2024 13:20
@Abellegese Abellegese force-pushed the chore/integrate-ruff-precommit branch from a3192f1 to 349cb4e Compare January 1, 2025 16:30
@DhanshreeA DhanshreeA merged commit c41fb34 into ersilia-os:master Jan 3, 2025
24 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.

3 participants