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

Biome part 2 #621

Merged
merged 13 commits into from
Sep 20, 2024
Merged

Biome part 2 #621

merged 13 commits into from
Sep 20, 2024

Conversation

CoMPaTech
Copy link
Member

@CoMPaTech CoMPaTech commented Sep 19, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a new "Biome lint" step in the GitHub Actions workflow to enhance code linting capabilities.
    • Updated the setup process for Python packages to include a new package manager command.
    • Enhanced the test setup script to fetch and update the Biome CLI tool based on system architecture.
  • Bug Fixes

    • Corrected syntax errors in the script for creating Python virtual environments.
  • Documentation

    • Updated CHANGELOG to reflect the new version (v1.4.1) and improvements related to document formatting.
  • Style

    • Reformatted JSON structures across multiple files for improved readability without changing functionality.

@CoMPaTech CoMPaTech added enhancement New feature or request dependencies Pull requests that update a dependency file labels Sep 19, 2024
@CoMPaTech CoMPaTech self-assigned this Sep 19, 2024
Copy link
Contributor

coderabbitai bot commented Sep 19, 2024

Walkthrough

The changes introduce a new "Biome lint" step in the GitHub Actions workflow, enhancing linting capabilities by integrating the Biome tool. Modifications to the .gitignore file reflect a shift in dependency management, while the .pre-commit-config.yaml file updates the configuration of pre-commit hooks. A new version entry is added to the changelog, and several JSON files undergo formatting changes for improved readability. Additionally, updates are made to various scripts to streamline the setup and testing processes, including the transition from Prettier to Biome for formatting tasks.

Changes

File Change Summary
.github/workflows/verify.yml Added a new job step "Biome lint" to run Biome for linting.
.gitignore Removed node_modules/ and package-lock.json; added tmp.
.pre-commit-config.yaml Expanded skip list; added setup, setup_test, and biome hooks; updated linting process.
CHANGELOG.md Updated to include version v1.4.1; added entry for Biome feature.
fixtures/*.json Reformatted JSON files for readability; no functional changes.
pyproject.toml Updated version from "1.4.0" to "1.4.1".
scripts/python-venv.sh Corrected syntax error in for-loop.
scripts/setup.sh Modified package installation to include uv; removed Node.js setup.
scripts/setup_test.sh Added creation of ./tmp; updated installation command; included Biome CLI tool setup.
scripts/tests_and_coverage.sh Replaced Prettier with Biome for formatting and linting tasks.

Possibly related PRs

  • Replace prettier with biome #598: The changes in this PR involve replacing Prettier with Biome in the .pre-commit-config.yaml file, which is directly related to the main PR's introduction of the "Biome lint" step in the GitHub Actions workflow. Both PRs focus on integrating Biome for linting and formatting tasks.

🐰 In the garden where code does bloom,
A new tool arrives to chase away gloom.
With Biome's help, our scripts now shine,
Linting and formatting, all in line.
From JSON to workflows, all tidied up,
Let's hop with joy, and raise a cup! 🥕


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Sep 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (901d0c0) to head (edb94a7).
Report is 14 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #621   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           20        20           
  Lines         3360      3360           
=========================================
  Hits          3360      3360           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@CoMPaTech CoMPaTech marked this pull request as ready for review September 19, 2024 20:00
@CoMPaTech CoMPaTech requested a review from a team as a code owner September 19, 2024 20:00
@CoMPaTech
Copy link
Member Author

@coderabbitai review please :)

Copy link
Contributor

coderabbitai bot commented Sep 19, 2024

@CoMPaTech: I will review the changes.

Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Outside diff range and nitpick comments (1)
scripts/tests_and_coverage.sh (1)

53-53: Consider making the echo statement conditional if needed.

The echo statement provides useful information about the tool being used to process fixtures and test data. However, since it is executed unconditionally after the manual fixture crafting step, it may not always be relevant.

If the Biome processing step is not always run, consider making the echo statement conditional based on whether the Biome command is actually executed.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between bf9757c and fe5b63c.

Files selected for processing (39)
  • .github/workflows/verify.yml (1 hunks)
  • .gitignore (1 hunks)
  • .pre-commit-config.yaml (3 hunks)
  • CHANGELOG.md (1 hunks)
  • fixtures/adam_heatpump_cooling/all_data.json (11 hunks)
  • fixtures/adam_jip/all_data.json (5 hunks)
  • fixtures/adam_multiple_devices_per_zone/all_data.json (5 hunks)
  • fixtures/adam_onoff_cooling_fake_firmware/all_data.json (2 hunks)
  • fixtures/adam_plus_anna/all_data.json (1 hunks)
  • fixtures/adam_plus_anna_new/all_data.json (3 hunks)
  • fixtures/adam_zone_per_device/all_data.json (5 hunks)
  • fixtures/anna_elga_2/all_data.json (1 hunks)
  • fixtures/anna_elga_2_cooling/all_data.json (1 hunks)
  • fixtures/anna_elga_2_schedule_off/all_data.json (1 hunks)
  • fixtures/anna_elga_no_cooling/all_data.json (1 hunks)
  • fixtures/anna_heatpump_cooling/all_data.json (1 hunks)
  • fixtures/anna_heatpump_cooling_fake_firmware/all_data.json (1 hunks)
  • fixtures/anna_heatpump_heating/all_data.json (1 hunks)
  • fixtures/anna_loria_cooling_active/all_data.json (2 hunks)
  • fixtures/anna_loria_driessens/all_data.json (2 hunks)
  • fixtures/anna_loria_heating_idle/all_data.json (2 hunks)
  • fixtures/anna_v4/all_data.json (1 hunks)
  • fixtures/anna_v4_dhw/all_data.json (1 hunks)
  • fixtures/anna_v4_no_tag/all_data.json (1 hunks)
  • fixtures/anna_without_boiler_fw441/all_data.json (1 hunks)
  • fixtures/legacy_anna/all_data.json (1 hunks)
  • fixtures/legacy_anna_2/all_data.json (1 hunks)
  • fixtures/m_adam_cooling/all_data.json (3 hunks)
  • fixtures/m_adam_heating/all_data.json (3 hunks)
  • fixtures/m_adam_jip/all_data.json (5 hunks)
  • fixtures/m_adam_multiple_devices_per_zone/all_data.json (5 hunks)
  • fixtures/m_anna_heatpump_cooling/all_data.json (1 hunks)
  • fixtures/m_anna_heatpump_idle/all_data.json (1 hunks)
  • fixtures/stretch_v23/all_data.json (1 hunks)
  • pyproject.toml (1 hunks)
  • scripts/python-venv.sh (1 hunks)
  • scripts/setup.sh (1 hunks)
  • scripts/setup_test.sh (1 hunks)
  • scripts/tests_and_coverage.sh (1 hunks)
Files skipped from review due to trivial changes (33)
  • CHANGELOG.md
  • fixtures/adam_heatpump_cooling/all_data.json
  • fixtures/adam_jip/all_data.json
  • fixtures/adam_multiple_devices_per_zone/all_data.json
  • fixtures/adam_onoff_cooling_fake_firmware/all_data.json
  • fixtures/adam_plus_anna/all_data.json
  • fixtures/adam_plus_anna_new/all_data.json
  • fixtures/adam_zone_per_device/all_data.json
  • fixtures/anna_elga_2/all_data.json
  • fixtures/anna_elga_2_cooling/all_data.json
  • fixtures/anna_elga_2_schedule_off/all_data.json
  • fixtures/anna_elga_no_cooling/all_data.json
  • fixtures/anna_heatpump_cooling/all_data.json
  • fixtures/anna_heatpump_cooling_fake_firmware/all_data.json
  • fixtures/anna_heatpump_heating/all_data.json
  • fixtures/anna_loria_cooling_active/all_data.json
  • fixtures/anna_loria_driessens/all_data.json
  • fixtures/anna_loria_heating_idle/all_data.json
  • fixtures/anna_v4/all_data.json
  • fixtures/anna_v4_dhw/all_data.json
  • fixtures/anna_v4_no_tag/all_data.json
  • fixtures/anna_without_boiler_fw441/all_data.json
  • fixtures/legacy_anna/all_data.json
  • fixtures/legacy_anna_2/all_data.json
  • fixtures/m_adam_cooling/all_data.json
  • fixtures/m_adam_heating/all_data.json
  • fixtures/m_adam_jip/all_data.json
  • fixtures/m_adam_multiple_devices_per_zone/all_data.json
  • fixtures/m_anna_heatpump_cooling/all_data.json
  • fixtures/m_anna_heatpump_idle/all_data.json
  • fixtures/stretch_v23/all_data.json
  • pyproject.toml
  • scripts/python-venv.sh
Additional comments not posted (14)
scripts/setup.sh (2)

16-16: Verify the purpose and necessity of the uv package.

The uv package has been added to the pip install command along with the existing wheel package. Please clarify the purpose and necessity of the uv package in the installation process.

Is it a requirement or an optional enhancement? Ensure that the addition of uv aligns with the project's dependencies and goals.


17-17: Verify the purpose of uv and ensure the security of external dependencies.

  1. The installation command now uses uv pip install instead of just pip install. Please clarify the purpose and necessity of using uv in the installation process. Is it a requirement or an optional enhancement? Ensure that the addition of uv aligns with the project's dependencies and goals.

  2. The command is specifying requirements and constraints files from external URLs. While this approach provides flexibility, it could potentially introduce security risks if the URLs are not trusted or controlled. Consider using trusted and controlled URLs for these files to mitigate potential security vulnerabilities. Alternatively, consider hosting the files within the project repository itself to ensure their integrity.

scripts/setup_test.sh (5)

14-14: LGTM!

The code segment correctly creates the temporary directory using the mkdir -p command, which is a standard practice.


17-17: Verify the package management change.

The code segment correctly installs the test requirements using the uv pip command. The use of uv pip instead of pip may indicate a shift in the package management approach. Please ensure that this change is intentional and aligns with the project's package management strategy.


20-27: LGTM!

The code segment correctly fetches and updates the biome CLI tool based on the system architecture. It handles the case where the architecture cannot be determined by exiting with an error message, which is a good practice.


30-30: LGTM!

The code segment correctly makes the biome binary executable using the chmod +x command, which is necessary for running the tool.


33-35: LGTM!

The code segment correctly installs the pre-commit hook conditionally based on the number of arguments passed to the script. This adds flexibility to the script's execution, allowing the hook to be skipped if needed.

scripts/tests_and_coverage.sh (2)

46-50: LGTM!

The conditional block ensures that the manual fixture crafting script is only run locally or when explicitly requested, which helps to prevent unintended overwriting of fixtures during the GitHub run of testing.

The TODO item #313 suggests that there is a plan to handle the fixture generation process more gracefully on merge using a GitHub action. This is a good idea to streamline the process and ensure consistency across different environments.


54-54: LGTM!

The Biome command is a good addition to the script as it helps to maintain code quality and consistency by linting the staged files.

The flags used in the command (--files-ignore-unknown=true and --no-errors-on-unmatched) provide flexibility in handling unknown or unmatched files, which may be useful in certain scenarios.

.pre-commit-config.yaml (4)

4-4: LGTM!

The addition of setup, setup_test, and biome to the skip list is consistent with the introduction of new hooks with the same names later in the file. This change ensures that these hooks are not executed during pre-commit checks.


70-73: LGTM!

The introduction of the setup hook is a great addition to ensure a consistent development environment. By checking for the presence of a virtual environment and running the setup script if necessary, this hook helps maintain a standardized environment across different machines and users.


74-77: LGTM!

The setup_test hook is a valuable addition to ensure a consistent testing environment. By verifying the presence of the ./tmp/biome file and running the testing setup script if necessary, this hook helps maintain a standardized testing environment and ensures that necessary dependencies are installed before running tests.


103-105: LGTM!

The introduction of the biome hook for local linting is a positive change. By integrating Biome directly into the pre-commit workflow and using local installation, it streamlines the linting process. The command-line options used, such as --staged, --files-ignore-unknown=true, and --no-errors-on-unmatched, provide flexibility in handling unknown and unmatched files during linting.

.github/workflows/verify.yml (1)

160-164: Excellent addition of the Biome linting step!

The new "Biome lint" step is a valuable enhancement to the GitHub Actions workflow. It ensures that the codebase adheres to the rules and best practices defined by the Biome tool, further improving code quality and maintainability.

The step is well-integrated into the existing workflow, running after the pylint step and before the markdown linting step. It activates the Python virtual environment, downloads the latest release of the Biome tool, and uses the pre-commit framework to run the linting process on all files.

Great job on adding this step to strengthen the code quality checks in the workflow!

.gitignore Show resolved Hide resolved
@CoMPaTech CoMPaTech linked an issue Sep 19, 2024 that may be closed by this pull request
Copy link
Contributor

@bouwew bouwew left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link

sonarcloud bot commented Sep 20, 2024

@CoMPaTech CoMPaTech merged commit 895a9ba into main Sep 20, 2024
17 checks passed
@CoMPaTech CoMPaTech deleted the biome_part_2 branch September 20, 2024 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TODO]: remove use of prettier in tests_and_coverage.sh
2 participants