utils

package
v4.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2023 License: LGPL-3.0 Imports: 16 Imported by: 0

README

Reviewpad utilities library

Documentation

Overview

Copyright 2022 Explore.dev Unipessoal Lda. All Rights Reserved. Use of this source code is governed by a license that can be found in the LICENSE file

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsInt32

func AbsInt32(value int32) int32

func CompactJSONString

func CompactJSONString(data string) (string, error)

func DownloadReviewpadFileFromGitHub

func DownloadReviewpadFileFromGitHub(
	ctx context.Context,
	logger *logrus.Entry,
	githubClient *gh.GithubClient,
	filePath string,
	branch *pbc.Branch,
	options *github.DownloadContentsOptions,
) (*bytes.Buffer, error)

func ElementOf

func ElementOf(s []string, str string) bool

func FileExt

func FileExt(fp string) string

func GenerateRandom

func GenerateRandom(size int) int

func IsPullRequestReadyForReportMetrics

func IsPullRequestReadyForReportMetrics(eventDetails *entities.EventDetails) bool

func IsReviewpadCommand

func IsReviewpadCommand(eventDetails *entities.EventDetails) bool

func IsReviewpadCommandDryRun

func IsReviewpadCommandDryRun(command string) bool

func IsReviewpadCommandRun

func IsReviewpadCommandRun(command string) bool

func MinifyQuery

func MinifyQuery(query string) string

func MustRead

func MustRead(r io.Reader) string

func MustUnmarshal

func MustUnmarshal(data []byte, v interface{})

func MustWrite

func MustWrite(w io.Writer, s string)

func MustWriteBytes

func MustWriteBytes(w io.Writer, data []byte)

func ReadFile

func ReadFile(filepath string) ([]byte, error)

func ReadableTimeDiff

func ReadableTimeDiff(x time.Time, y time.Time) string

func ReviewpadFileChanged

func ReviewpadFileChanged(ctx context.Context, githubClient *gh.GithubClient, filePath string, pullRequest *pbc.PullRequest) (bool, error)

reviewpad-an: experimental ReviewpadFileChanges checks if a file path was changed in a pull request. The way this is done depends on the number of files changed in the pull request. If the number of files changed is greater than pullRequestFileLimit, then we download both files using the filePath and check their contents. This strategy assumes that the file path exists in the head branch. Otherwise, we download the pull request files and check the filePath exists in them.

func ValidateUrl

func ValidateUrl(fileUrl string) (*pbc.Branch, string, error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL