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

Revert "Revert "Refactor"" #22

Closed
wants to merge 2 commits into from
Closed

Conversation

ravilushqa
Copy link
Owner

@ravilushqa ravilushqa commented May 7, 2023

Description

This pull request reverts the previous revert of the "Refactor" commit and includes various updates and improvements to the project.

Changes

  • Added a GitHub action for golangci-lint to run on push events with tags starting with "v" and on the master and main branches, as well as on pull requests with read access to contents. The action uses Go version 1.19 and golangci-lint version 1.52, with optional arguments for working directory and caching options. It also has the option to only show new issues on pull requests. (File: .github/workflows/golangci-lint.yml)
  • Updated build process to use makefile and added bin directory for executable files. Updated file paths for description and review commands to reflect new bin directory. Also added environment variables for GitHub and OpenAI tokens for Pull Request updates and reviews. (File: .github/workflows/gpt_pullrequest_updater.yml)
  • Added "bin" and ".idea" directories to the project. (File: .gitignore)
  • Added configuration for various linters to be used in the project. Specifically, it enables depguard, errcheck, godot, gofmt, goimports, gosimple, govet, ineffassign, misspell, revive, staticcheck, typecheck, and unused linters. It also excludes certain rules for tests and sets settings for misspell and goimports linters. (File: .golangci.yaml)
  • Added build, init-tools, lint, test, test-coverage, precommit, and help targets to the Makefile. The init-tools target installs the required development tools, the lint target runs golangci-lint, the test target runs go test, the test-coverage target runs go test with coverage, and the precommit target runs lint and test. The help target displays the available targets and their descriptions. (File: Makefile)
  • Updated build and execution commands for Pull Request description and review tools. The build process now uses make instead of go build for easier maintenance. The Pull Request description tool is now executed from the bin directory. The Pull Request review tool is also executed from the bin directory and only runs if the Pull Request is opened. The environment variables for both tools remain the same. (File: README.md)
  • Removed unused code related to GitHub and OpenAI tokens, GitHub owner, repo, and pull request number. Also removed a boolean flag for test mode. (File: cmd/review/config.go)
  • Updated the code to include options for GitHub token, OpenAI token, owner, repo, and pull request number. Added a test mode to print out comments without creating them. Refactored the code to use the review package for generating and pushing comments. (File: cmd/review/main.go)
  • Added new indirect dependencies to the project:
    • github.com/stretchr/testify v1.8.2
    • github.com/davecgh/go-spew v1.1.1
    • github.com/pmezard/go-difflib v1.0.0
    • github.com/stretchr/objx v0.5.0
    • gopkg.in/yaml.v3 v3.0.1
  • Added unit tests for GenerateCommentsFromDiff and PushComments functions. Also added MockCompleter and MockPullRequestUpdater structs for mocking dependencies. (File: review/review_test.go)
  • Refactored the code to use interfaces for PullRequestUpdater and Completer. Added GenerateCommentsFromDiff function to generate comments from diff and PushComments function to push comments to pull request. Removed ghClient import and updated package name to review. (File: review/review.go)
  • Updated the constant name from ticketUrlFormat to ticketURLFormat and modified the GenerateJiraTicketURL function to use the updated constant name. This change ensures consistency in naming conventions and improves code readability. (File: jira/jira.go)
  • Added a new embedded file "prompts/review" to replace the previous "prompt-review.txt" file. This change was made to improve the organization of embedded files in the project. No other changes were made to the code. (File: openai/openai.go)
  • Changed package name from "main" to "review" to better reflect the purpose of the code. No other changes were made. (File: review/utils.go)
  • This code patch updates the package name from "main" to "review". The import statement and the code remain unchanged. (File: review/utils_test.go)
  • Added module github.com/ravilushqa/gpt-pullrequest-updater/tools and updated the required dependencies to their latest versions. (File: tools/go.mod)
  • Updated dependencies:
    • 4d63.com/gocheckcompilerdirectives v1.2.1
    • 4d63.com/gochecknoglobals v0.2.1
    • cloud.google.com/go v0.26.0, v0.34.0, v0.38.0, v0.44.1, v0.44.2, v0.44.3, v0.45.1, v0.46.3, v0.50.0, v0.52.0, v0.53.0, v0.54.0, v0.56.0, v0.57.0, v0.62.0, v0.65.0, v0.72.0, v0.74.0, v0.75.0
    • cloud.google.com/go/bigquery v1.0.1, v1.3.0, v1.4.0, v1.5.0, v1.7.0, v1.8.0
    • cloud.google.com/go/datastore v1.0.0, v1.1.0
    • cloud.google.com/go/pubsub v1.0.1, v1.1.0, v1.2.0, v1.3.1
    • cloud.google.com/go/storage v1.0.0, v1.5.0, v1.6.0, v1.8.0, v1.10.0, v1.14.0
    • dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9
    • github.com/Abirdcfly/dupword v0.0.11
    • github.com/Antonboom/errname v0.1.9 (File: tools/go.sum)
  • Added support for golangci-lint tool in the project. This patch includes the necessary code changes to import the tool and generate a build command for it. The tool can now be easily accessed and used for linting purposes. (File: tools/tools.go)

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
# skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true
Copy link

Choose a reason for hiding this comment

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

[bug] Missing newline character at the end of the file.

@@ -0,0 +1,2 @@
bin
Copy link

Choose a reason for hiding this comment

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

[structure] The added lines seem to be related to project configuration and not actual code. Consider removing them from version control to avoid cluttering the repository.

fix

Verified

This commit was signed with the committer’s verified signature.
@ravilushqa ravilushqa closed this May 7, 2023
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.

None yet

1 participant