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

[WIP] Refactor code structure #672

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

[WIP] Refactor code structure #672

wants to merge 3 commits into from

Conversation

hahwul
Copy link
Owner

@hahwul hahwul commented Mar 15, 2025

Code Refactoring

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Hello @hahwul, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request focuses on refactoring the code structure of the project. The primary change involves moving several packages from pkg to internal, specifically har, printing, optimization, report, and verification. Additionally, a new Rake task for checking remote assets has been added, which fetches and prints data from specified endpoints.

Highlights

  • Package Relocation: Moved har, printing, optimization, report, and verification packages from pkg to internal to better encapsulate internal functionalities.
  • New Rake Task: Implemented a new Rake task assets:check to verify remote assets by fetching and displaying data from predefined endpoints.
  • Code View Test: Added a test case for the CodeView function in the internal/printing package to ensure proper functionality.

Changelog

Click here to see the changelog
  • Rakefile
    • Added net/http and json requires.
    • Implemented assets:check task to fetch and display data from remote asset endpoints.
  • cmd/file.go
    • Moved printing import from pkg to internal.
  • cmd/payload.go
    • Moved generating, optimization, and printing imports from pkg to internal.
  • cmd/pipe.go
    • Moved printing import from pkg to internal.
  • cmd/root.go
    • Moved har and printing imports from pkg to internal.
  • cmd/server.go
    • Moved printing import from pkg to internal.
  • cmd/sxss.go
    • Moved printing import from pkg to internal.
  • cmd/url.go
    • Moved printing import from pkg to internal.
  • cmd/version.go
    • Moved printing import from pkg to internal.
  • internal/har/har_test.go
    • Moved har import from pkg to internal.
  • internal/optimization/optimization.go
    • Moved har import from pkg to internal.
  • internal/printing/codeview.go
    • Changed package from scanning to printing.
  • internal/printing/codeview_test.go
    • Added a new test file for CodeView function.
  • internal/printing/util_test.go
    • Moved printing import from pkg to internal.
  • lib/interface.go
    • Moved har import from pkg to internal.
  • pkg/model/options.go
    • Moved har import from pkg to internal.
  • pkg/scanning/bav.go
    • Moved optimization import from pkg to internal.
  • pkg/scanning/foundaction.go
    • Moved printing import from pkg to internal.
  • pkg/scanning/parameterAnalysis.go
    • Moved optimization, printing, and verification imports from pkg to internal.
  • pkg/scanning/scan.go
    • Moved har, optimization, printing, report, and verification imports from pkg to internal.
  • pkg/scanning/sendReq.go
    • Moved har, optimization, printing, and verification imports from pkg to internal.
  • pkg/scanning/staticAnlaysis.go
    • Moved optimization import from pkg to internal.
  • pkg/scanning/transport.go
    • Moved har and printing imports from pkg to internal.
  • pkg/scanning/transport_test.go
    • Moved har import from pkg to internal.
  • pkg/server/server.go
    • Moved printing import from pkg to internal.
  • scripts/check-asset-remote.rb
    • Removed the file.
  • scripts/check-before-release.sh
    • Removed the file.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


In the realm of code, where structures reside,
A refactor emerges, with purpose and pride.
Packages shift, like stars in the night,
Internal workings, shielded from light.
Rake tasks awaken, assets to seize,
Checking remote realms, putting minds at ease.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@hahwul hahwul linked an issue Mar 15, 2025 that may be closed by this pull request
@hahwul hahwul self-assigned this Mar 15, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request refactors the code structure by moving some packages to internal packages and adding a new Rake task to check remote assets. The changes seem well-organized and improve the project's structure.

Summary of Findings

  • Moving packages to internal: Several packages like generating, optimization, printing, and har have been moved from pkg to internal. This restricts external access and better defines the project's public API. This is a good change.
  • New Rake task for asset checking: A new Rake task assets:check has been added to check remote assets. This task fetches JSON data from a remote server and prints it. This could be useful for verifying external dependencies or resources.
  • Comment capitalization: Several comments in pkg/scanning/bav.go have incorrect capitalization. This should be corrected for consistency.

Merge Readiness

The pull request is almost ready for merging. The changes improve the code structure and add a useful Rake task. However, the capitalization issue in the comments should be addressed before merging. I am unable to directly approve the pull request, and users should have others review and approve this code before merging. Since there are no critical or high severity issues, the pull request can be merged after the medium severity issues are addressed.

Copy link

codecov bot commented Mar 15, 2025

Codecov Report

Attention: Patch coverage is 25.00000% with 15 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/scanning/scan.go 0.00% 10 Missing ⚠️
pkg/scanning/sendReq.go 0.00% 4 Missing ⚠️
pkg/scanning/parameterAnalysis.go 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

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.

Code Refactoring
1 participant