Closed sweep-ai[bot] closed 8 months ago
fluere-config/src/init.rs
β
Sandbox logs for
trunk init
1/3 ββ‘Ώ Downloading Trunk 1.17.1... β‘Ώ Downloading Trunk 1.17.1... β’Ώ Downloading Trunk 1.17.1... β£» Downloading Trunk 1.17.1... β£½ Downloading Trunk 1.17.1... β£Ύ Downloading Trunk 1.17.1... β£· Downloading Trunk 1.17.1... β Downloading Trunk 1.17.1... done β‘Ώ Verifying Trunk sha256... β Verifying Trunk sha256... done β‘Ώ Unpacking Trunk... β Unpacking Trunk... done β 14 linters were enabled (.trunk/trunk.yaml) actionlint 1.6.26 (5 github-workflow files) checkov 3.0.16 (12 yaml files) clippy 1.65.0 (5 rust files) git-diff-check (83 files) markdownlint 0.37.0 (8 markdown files) (created .markdownlint.yaml) oxipng 9.0.0 (3 png files) prettier 3.0.3 (8 markdown, 12 yaml files) rustfmt 1.65.0 (50 rust files) (created .rustfmt.toml) shellcheck 0.9.0 (2 shell files) (created .shellcheckrc) shfmt 3.6.0 (2 shell files) taplo 0.8.1 (5 toml files) trivy 0.46.1 (12 yaml files) trufflehog 3.62.1 (83 files) yamllint 1.32.0 (12 yaml files) (created .yamllint.yaml) Next Steps 1. Read documentation Our documentation can be found at https://docs.trunk.io 2. Get help and give feedback Join the Trunk community at https://slack.trunk.io
trunk fmt fluere-config/src/init.rs || exit 0
2/3 βChecked 1 file β No issues
trunk check --fix --print-failures fluere-config/src/init.rs
3/3 β (`1`)FAILURES clippy fluere-config .trunk/out/ym3yR.yaml NOTICES A tool failed to run. You can open the details yaml file for more information. Checked 1 file β No issues, 1 failure # .trunk/out/ym3yR.yaml trunk_cli_version: 1.17.1 title: "Error while executing: fluere-config" report: - Unable to find fluere-config for Cargo.lock in any parent directory of /repo/fluere-config - linter: command: | /root/.cache/trunk/tools/rust/1.65.0-f09848e9e4f55504aac7f8b8e2f48445/bin/cargo clippy --message-format json --locked -- --cap-lints=warn --no-deps stdin_path: (none) run_from: /repo/fluere-config timeout: 10m rerun: (cd /repo/fluere-config; env -i PATH=/root/.cache/trunk/tools/rust/1.65.0-f09848e9e4f55504aac7f8b8e2f48445/bin:/root/.nvm/versions/node/v18.17.0/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin CARGO_TARGET_DIR=/root/.cache/trunk/repos/f97b771eaa16b34ad180abf83b26f9a7/results/clippy-current/cargo_target_dir HOME=/root CARGO_HOME=/root/.cache/trunk/repos/f97b771eaa16b34ad180abf83b26f9a7/results/clippy-current/cargo_home /root/.cache/trunk/tools/rust/1.65.0-f09848e9e4f55504aac7f8b8e2f48445/bin/cargo clippy --message-format json --locked -- --cap-lints=warn --no-deps) affects_cache: - Cargo.toml direct_configs: [] exit_status: exited exit_code: 101 stdout: (none) stderr: | Updating crates.io index Updating git repository `https://github.com/SkuldNorniern/pcap` error: the lock file /repo/Cargo.lock needs to be updated but --locked was passed to prevent this If you want to try to generate the lock file without accessing the network, remove the --locked flag and use --offline instead. parser: | (none)
Cargo.toml
β
Sandbox logs for https://github.com/SkuldNorniern/fluere/commit/4112d3e8d74086ae6b7e5d1216e4e95aefe2f49d
trunk fmt Cargo.toml || exit 0
1/2 ββ Formatted Cargo.toml Re-checking autofixed files... Checked 1 file β No issues
trunk check --fix --print-failures Cargo.toml
2/2 βChecked 1 file β No issues
fluere-config/src/init.rs
β
Sandbox logs for
trunk fmt fluere-config/src/init.rs || exit 0
1/2 βChecked 1 file β No issues
trunk check --fix --print-failures fluere-config/src/init.rs
2/2 β (`1`)FAILURES clippy fluere-config .trunk/out/GSdZe.yaml NOTICES A tool failed to run. You can open the details yaml file for more information. Checked 1 file β No issues, 1 failure # .trunk/out/GSdZe.yaml trunk_cli_version: 1.17.1 title: "Error while executing: fluere-config" report: - Unable to find fluere-config for Cargo.lock in any parent directory of /repo/fluere-config - linter: command: | /root/.cache/trunk/tools/rust/1.65.0-f09848e9e4f55504aac7f8b8e2f48445/bin/cargo clippy --message-format json --locked -- --cap-lints=warn --no-deps stdin_path: (none) run_from: /repo/fluere-config timeout: 10m rerun: (cd /repo/fluere-config; env -i PATH=/root/.cache/trunk/tools/rust/1.65.0-f09848e9e4f55504aac7f8b8e2f48445/bin:/root/.nvm/versions/node/v18.17.0/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin HOME=/root CARGO_TARGET_DIR=/root/.cache/trunk/repos/f97b771eaa16b34ad180abf83b26f9a7/results/clippy-current/cargo_target_dir CARGO_HOME=/root/.cache/trunk/repos/f97b771eaa16b34ad180abf83b26f9a7/results/clippy-current/cargo_home /root/.cache/trunk/tools/rust/1.65.0-f09848e9e4f55504aac7f8b8e2f48445/bin/cargo clippy --message-format json --locked -- --cap-lints=warn --no-deps) affects_cache: - Cargo.toml direct_configs: [] exit_status: exited exit_code: 101 stdout: (none) stderr: | Updating crates.io index Updating git repository `https://github.com/SkuldNorniern/pcap` error: failed to select a version for the requirement `fluere-config = "^0.1.1"` candidate versions found which didn't match: 0.1.0 location searched: /repo/fluere-config required by package `fluere v0.6.1 (/repo)` parser: | (none)
Cargo.toml
β
Sandbox logs for
trunk fmt Cargo.toml || exit 0
1/2 βChecked 1 file β No issues
trunk check --fix --print-failures Cargo.toml
2/2 βChecked 1 file β No issues
fluere-config/src/init.rs
β
Sandbox logs for
trunk fmt fluere-config/src/init.rs || exit 0
1/2 βChecked 1 file β No issues
trunk check --fix --print-failures fluere-config/src/init.rs
2/2 β (`1`)FAILURES clippy fluere-config .trunk/out/2wrGD.yaml NOTICES A tool failed to run. You can open the details yaml file for more information. Checked 1 file β No issues, 1 failure # .trunk/out/2wrGD.yaml trunk_cli_version: 1.17.1 title: "Error while executing: fluere-config" report: - Unable to find fluere-config for Cargo.lock in any parent directory of /repo/fluere-config - linter: command: | /root/.cache/trunk/tools/rust/1.65.0-f09848e9e4f55504aac7f8b8e2f48445/bin/cargo clippy --message-format json --locked -- --cap-lints=warn --no-deps stdin_path: (none) run_from: /repo/fluere-config timeout: 10m rerun: (cd /repo/fluere-config; env -i PATH=/root/.cache/trunk/tools/rust/1.65.0-f09848e9e4f55504aac7f8b8e2f48445/bin:/root/.nvm/versions/node/v18.17.0/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin CARGO_TARGET_DIR=/root/.cache/trunk/repos/f97b771eaa16b34ad180abf83b26f9a7/results/clippy-current/cargo_target_dir HOME=/root CARGO_HOME=/root/.cache/trunk/repos/f97b771eaa16b34ad180abf83b26f9a7/results/clippy-current/cargo_home /root/.cache/trunk/tools/rust/1.65.0-f09848e9e4f55504aac7f8b8e2f48445/bin/cargo clippy --message-format json --locked -- --cap-lints=warn --no-deps) affects_cache: - Cargo.toml direct_configs: [] exit_status: exited exit_code: 101 stdout: (none) stderr: | Updating crates.io index Updating git repository `https://github.com/SkuldNorniern/pcap` error: the lock file /repo/Cargo.lock needs to be updated but --locked was passed to prevent this If you want to try to generate the lock file without accessing the network, remove the --locked flag and use --offline instead. parser: | (none)
Cargo.lock
β
Sandbox logs for
trunk fmt Cargo.lock || exit 0
1/2 βFound no applicable linters for the requested path
trunk check --fix --print-failures Cargo.lock
2/2 βNOTICES Cargo.lock ignored by .gitignore and trunk.yaml [git-diff-check] Hint: use --force to check ignored files Found no applicable linters for the requested path
fluere-config/src/init.rs
β
Sandbox logs for
trunk fmt fluere-config/src/init.rs || exit 0
1/2 βChecked 1 file β No issues
trunk check --fix --print-failures fluere-config/src/init.rs
2/2 β (`1`)FAILURES clippy fluere-config .trunk/out/fxoVA.yaml NOTICES A tool failed to run. You can open the details yaml file for more information. Checked 1 file β No issues, 1 failure # .trunk/out/fxoVA.yaml trunk_cli_version: 1.17.1 title: "Error while executing: fluere-config" report: - clippy exited with exit_code=101 - linter: command: | /root/.cache/trunk/tools/rust/1.65.0-f09848e9e4f55504aac7f8b8e2f48445/bin/cargo clippy --message-format json --locked -- --cap-lints=warn --no-deps stdin_path: (none) run_from: /repo/fluere-config timeout: 10m rerun: (cd /repo/fluere-config; env -i PATH=/root/.cache/trunk/tools/rust/1.65.0-f09848e9e4f55504aac7f8b8e2f48445/bin:/root/.nvm/versions/node/v18.17.0/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin HOME=/root CARGO_HOME=/root/.cache/trunk/repos/f97b771eaa16b34ad180abf83b26f9a7/results/clippy-current/cargo_home CARGO_TARGET_DIR=/root/.cache/trunk/repos/f97b771eaa16b34ad180abf83b26f9a7/results/clippy-current/cargo_target_dir /root/.cache/trunk/tools/rust/1.65.0-f09848e9e4f55504aac7f8b8e2f48445/bin/cargo clippy --message-format json --locked -- --cap-lints=warn --no-deps) affects_cache: - Cargo.toml - Cargo.lock direct_configs: [] exit_status: exited exit_code: 101 stdout: (none) stderr: | error: failed to parse lock file at: /repo/Cargo.lock Caused by: could not parse input as TOML Caused by: TOML parse error at line 1, column 4 | 1 | As the `Cargo.lock` file is generated and updated automatically by the Cargo package manager, there is no need to manually create or modify this file. Therefore, there is no new file content to provide in this section. | ^ Unexpected `t` Expected `.` or `=` parser: | (none)
Cargo.lock
β
Sandbox logs for
trunk fmt Cargo.lock || exit 0
1/2 βFound no applicable linters for the requested path
trunk check --fix --print-failures Cargo.lock
2/2 βNOTICES Cargo.lock ignored by .gitignore and trunk.yaml [git-diff-check] Hint: use --force to check ignored files Found no applicable linters for the requested path
fluere-config/src/init.rs
β
Sandbox logs for
trunk fmt fluere-config/src/init.rs || exit 0
1/2 βChecked 1 file β No issues
trunk check --fix --print-failures fluere-config/src/init.rs
2/2 β (`1`)FAILURES clippy fluere-config .trunk/out/OwFev.yaml NOTICES A tool failed to run. You can open the details yaml file for more information. Checked 1 file β No issues, 1 failure # .trunk/out/OwFev.yaml trunk_cli_version: 1.17.1 title: "Error while executing: fluere-config" report: - clippy exited with exit_code=101 - linter: command: | /root/.cache/trunk/tools/rust/1.65.0-f09848e9e4f55504aac7f8b8e2f48445/bin/cargo clippy --message-format json --locked -- --cap-lints=warn --no-deps stdin_path: (none) run_from: /repo/fluere-config timeout: 10m rerun: (cd /repo/fluere-config; env -i PATH=/root/.cache/trunk/tools/rust/1.65.0-f09848e9e4f55504aac7f8b8e2f48445/bin:/root/.nvm/versions/node/v18.17.0/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin HOME=/root CARGO_HOME=/root/.cache/trunk/repos/f97b771eaa16b34ad180abf83b26f9a7/results/clippy-current/cargo_home CARGO_TARGET_DIR=/root/.cache/trunk/repos/f97b771eaa16b34ad180abf83b26f9a7/results/clippy-current/cargo_target_dir /root/.cache/trunk/tools/rust/1.65.0-f09848e9e4f55504aac7f8b8e2f48445/bin/cargo clippy --message-format json --locked -- --cap-lints=warn --no-deps) affects_cache: - Cargo.toml - Cargo.lock direct_configs: [] exit_status: exited exit_code: 101 stdout: (none) stderr: | Updating crates.io index Updating git repository `https://github.com/SkuldNorniern/pcap` error: the lock file /repo/Cargo.lock needs to be updated but --locked was passed to prevent this If you want to try to generate the lock file without accessing the network, remove the --locked flag and use --offline instead. parser: | (none)
[X] Check Cargo.lock
β
Run `Cargo.lock` through the sandbox.
[X] Check fluere-config/src/init.rs
β
Sandbox logs for
trunk fmt fluere-config/src/init.rs || exit 0
1/2 βChecked 1 file β No issues
trunk check --fix --print-failures fluere-config/src/init.rs
2/2 β (`1`)FAILURES clippy fluere-config .trunk/out/OwFev.yaml NOTICES A tool failed to run. You can open the details yaml file for more information. Checked 1 file β No issues, 1 failure # .trunk/out/OwFev.yaml trunk_cli_version: 1.17.1 title: "Error while executing: fluere-config" report: - clippy exited with exit_code=101 - linter: command: | /root/.cache/trunk/tools/rust/1.65.0-f09848e9e4f55504aac7f8b8e2f48445/bin/cargo clippy --message-format json --locked -- --cap-lints=warn --no-deps stdin_path: (none) run_from: /repo/fluere-config timeout: 10m rerun: (cd /repo/fluere-config; env -i PATH=/root/.cache/trunk/tools/rust/1.65.0-f09848e9e4f55504aac7f8b8e2f48445/bin:/root/.nvm/versions/node/v18.17.0/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin HOME=/root CARGO_HOME=/root/.cache/trunk/repos/f97b771eaa16b34ad180abf83b26f9a7/results/clippy-current/cargo_home CARGO_TARGET_DIR=/root/.cache/trunk/repos/f97b771eaa16b34ad180abf83b26f9a7/results/clippy-current/cargo_target_dir /root/.cache/trunk/tools/rust/1.65.0-f09848e9e4f55504aac7f8b8e2f48445/bin/cargo clippy --message-format json --locked -- --cap-lints=warn --no-deps) affects_cache: - Cargo.toml - Cargo.lock direct_configs: [] exit_status: exited exit_code: 101 stdout: (none) stderr: | Updating crates.io index Updating git repository `https://github.com/SkuldNorniern/pcap` error: the lock file /repo/Cargo.lock needs to be updated but --locked was passed to prevent this If you want to try to generate the lock file without accessing the network, remove the --locked flag and use --offline instead. parser: | (none)
[!IMPORTANT]
Auto Review Skipped
Bot user detected.
To trigger a single review, invoke the
@coderabbitai review
command.
The recent changes to the Fluere project focus on enhancing error handling and improving code readability. The Config
implementation now handles directory creation failures gracefully, and the PluginManager
has been refactored for clarity. Additionally, error messages have been added to the cleanup
function for better debugging.
File Path | Summary |
---|---|
fluere-config/src/.../init.rs |
Added error handling for directory creation in the Config implementation. If directory creation fails, a default Config object is returned. |
fluere-plugin/src/.../lib.rs |
Improved readability of the PluginManager implementation. The lua_plugin_path variable is now split into multiple lines, and for loops have been reformatted. Added error messages to the cleanup function. |
π As autumn leaves fall, we code with glee, π
For Fluere's changes are as sweet as tea. β
With error handling now in place, π οΈ
And code that's clear as crystal vase. π
In the spirit of the season's grace, π
We celebrate our codebase's new face. π
So here's to Fluere, steady as a tree, π³
Evolving, growing, as free as can be. ποΈ
@coderabbitai review
β Could not find files to change
Please join our Discord to report this issue.
remove Cargo.lock
file
I wasn't able to make changes. This could be due to an unclear request or a bug in my code. As a reminder, comments on a file only modify that file. Comments on a PR (at the bottom of the "conversation" tab) can modify the entire PR. Please try again or contact us on Discord
PR Feedback: π
Description
This PR fixes a panic that occurs in the
fluere-config/src/init.rs
file when trying to create a directory at a path that is not supported by the operating system. The panic is caused by anunwrap()
call on aResult
object that contains anErr
value. This PR replaces theunwrap()
call with error handling code to prevent the panic and provide a more graceful error handling mechanism.Summary of Changes
fluere-config/src/init.rs
to handle the error when creating the directory at line 14.unwrap()
call with amatch
expression to handle theResult
object returned by thefs::create_dir_all(path_base)
function.Ok(_)
branch of thematch
expression, no action is taken as the directory creation was successful.Err(e)
branch, an error message is printed to the console usingeprintln!()
and the function returns a defaultConfig
object to prevent the application from crashing.Fixes #72.
π Latest improvements to Sweep:
rope
library to refactor Python! Check out Large Language Models are Bad at Refactoring Code. To have Sweep refactor your code, trysweep: Refactor <your_file>.py to be more modular
!π‘ To get Sweep to edit this pull request, you can:
Summary by CodeRabbit