Skip to content
This repository has been archived by the owner on Jul 14, 2020. It is now read-only.

Fail when no success #15

Merged
merged 12 commits into from
May 2, 2019
Merged

Fail when no success #15

merged 12 commits into from
May 2, 2019

Conversation

jessitron
Copy link
Contributor

@jessitron jessitron commented Apr 27, 2019

Fixes #14

and I moved a bunch of functions out of the big function, and then put them in files because it complained about file length

@jessitron jessitron requested a review from ddgenome April 28, 2019 20:36
Copy link
Contributor

@ddgenome ddgenome left a comment

Choose a reason for hiding this comment

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

This is a good improvement. Feel free to merge, we can address the comments at a later time.

lib/putS3.ts Outdated
}

export function escapeSpecialCharacters(filename: string): RegExp {
return new RegExp(filename.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&") + "$");
Copy link
Contributor

Choose a reason for hiding this comment

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

It is good to clarify this by extracting it into a descriptively-named function. Technically, the escaping of special characters is just the filename.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&") part. The rest is turning it into an anchored regular expression. I wonder if we just shouldn't replace this mess with a slice using the length of the file name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good idea

import * as assert from "power-assert";
import { filterKeys } from "../lib/deleteS3";
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to move the test for this into its own file.

import { PublishToS3Options } from "./options";

type FilesAttempted = number;
type SuccessfullyPushedKey = string;
Copy link
Contributor

Choose a reason for hiding this comment

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

You define this two different places. Perhaps define once and import the other?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the aliases are just for naming, not really doing anything. If they were types with some structure, I would.


type FilesAttempted = number;
type SuccessfullyPushedKey = string;
type Warning = string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same, defined twice.

Jessica Kerr and others added 3 commits May 2, 2019 15:59
[atomist:generated] [atomist:autofix=typescript_header]
@jessitron jessitron merged commit f97f1b5 into master May 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fail when no files are uploaded
3 participants