Skip to content

Commit

Permalink
fix: lint gomnd
Browse files Browse the repository at this point in the history
  • Loading branch information
maaslalani committed Nov 6, 2022
1 parent ca80f4c commit a0c2a1f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 3 additions & 2 deletions evaluator.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ func Evaluate(ctx context.Context, tape string, out io.Writer, opts ...Evaluator
}

video := v.Options.Video
if video.Height < 2*video.Padding || video.Width < 2*video.Padding {
v.Errors = append(v.Errors, fmt.Errorf("height and width must be greater than %d", 2*video.Padding))
minDimension := video.Padding + video.Padding
if video.Height < minDimension || video.Width < minDimension {
v.Errors = append(v.Errors, fmt.Errorf("height and width must be greater than %d", minDimension))
}

if len(v.Errors) > 0 {
Expand Down
2 changes: 1 addition & 1 deletion publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func dataPath() (string, error) {
// if the host does not exist there, it adds it so its available next time, as plain old `ssh` does.
func hostKeyCallback(path string) ssh.HostKeyCallback {
return func(hostname string, remote net.Addr, key ssh.PublicKey) error {
kh, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0o600) // nolint:gomnd
kh, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0o600) //nolint:gomnd
if err != nil {
return fmt.Errorf("failed to open known_hosts: %w", err)
}
Expand Down
9 changes: 6 additions & 3 deletions video.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ func MakeGIF(opts VideoOptions) *exec.Cmd {
"-i", filepath.Join(opts.Input, cursorFrameFormat),
"-filter_complex",
fmt.Sprintf(`[0][1]overlay[merged];[merged]scale=%d:%d:force_original_aspect_ratio=1[scaled];[scaled]fps=%d,setpts=PTS/%f[speed];[speed]pad=%d:%d:(ow-iw)/2:(oh-ih)/2:%s[padded];[padded]fillborders=left=%d:right=%d:top=%d:bottom=%d:mode=fixed:color=%s[bordered];[bordered]split[a][b];[a]palettegen=max_colors=256[p];[b][p]paletteuse[out]`,
opts.Width-2*opts.Padding, opts.Height-2*opts.Padding,
opts.Width-(opts.Padding+opts.Padding),
opts.Height-(opts.Padding+opts.Padding),
opts.Framerate, opts.PlaybackSpeed,
opts.Width, opts.Height,
opts.BackgroundColor,
Expand Down Expand Up @@ -128,7 +129,8 @@ func MakeWebM(opts VideoOptions) *exec.Cmd {
"-i", filepath.Join(opts.Input, cursorFrameFormat),
"-filter_complex",
fmt.Sprintf(`[0][1]overlay,scale=%d:%d:force_original_aspect_ratio=1,fps=%d,setpts=PTS/%f,pad=%d:%d:(ow-iw)/2:(oh-ih)/2:%s,fillborders=left=%d:right=%d:top=%d:bottom=%d:mode=fixed:color=%s`,
opts.Width-2*opts.Padding, opts.Height-2*opts.Padding,
opts.Width-(opts.Padding+opts.Padding),
opts.Height-(opts.Padding+opts.Padding),
opts.Framerate, opts.PlaybackSpeed,
opts.Width, opts.Height,
opts.BackgroundColor,
Expand Down Expand Up @@ -162,7 +164,8 @@ func MakeMP4(opts VideoOptions) *exec.Cmd {
"-i", filepath.Join(opts.Input, cursorFrameFormat),
"-filter_complex",
fmt.Sprintf(`[0][1]overlay,scale=%d:%d:force_original_aspect_ratio=1,fps=%d,setpts=PTS/%f,pad=%d:%d:(ow-iw)/2:(oh-ih)/2:%s,fillborders=left=%d:right=%d:top=%d:bottom=%d:mode=fixed:color=%s`,
opts.Width-2*opts.Padding, opts.Height-2*opts.Padding,
opts.Width-(opts.Padding+opts.Padding),
opts.Height-(opts.Padding+opts.Padding),
opts.Framerate, opts.PlaybackSpeed,
opts.Width, opts.Height,
opts.BackgroundColor,
Expand Down

0 comments on commit a0c2a1f

Please sign in to comment.