Skip to content

Commit cd542e7

Browse files
committed
Lint
1 parent 8d932e3 commit cd542e7

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

functions/imagemagick/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,18 @@ exports.blurOffensiveImages = (event) => {
4141
}
4242

4343
const file = storage.bucket(object.bucket).file(object.name);
44-
const file_uri = `gs://${object.bucket}/${object.name}`;
44+
const fileUri = `gs://${object.bucket}/${object.name}`;
4545

4646
console.log(`Analyzing ${file.name}.`);
4747

48-
return client.safeSearchDetection(file_uri)
48+
return client.safeSearchDetection(fileUri)
4949
.catch((err) => {
5050
console.error(`Failed to analyze ${file.name}.`, err);
5151
return Promise.reject(err);
5252
})
5353
.then(([result]) => {
54-
if (result.safeSearchAnnotation.adult == 'VERY_LIKELY' ||
55-
result.safeSearchAnnotation.violence == 'VERY_LIKELY') {
54+
if (result.safeSearchAnnotation.adult === 'VERY_LIKELY' ||
55+
result.safeSearchAnnotation.violence === 'VERY_LIKELY') {
5656
console.log(`The image ${file.name} has been detected as inappropriate.`);
5757
return blurImage(file, result);
5858
} else {

functions/imagemagick/test/index.test.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,20 @@ function getSample (filename) {
4242
bucket: sinon.stub().returns(bucket)
4343
};
4444
const StorageMock = sinon.stub().returns(storageMock);
45-
var safeSearchDetectionStub = sinon.stub()
45+
var safeSearchDetectionStub = sinon.stub();
4646
safeSearchDetectionStub.withArgs(`gs://${bucketName}/${safeFilename}`).returns(Promise.resolve([{
47-
safeSearchAnnotation: {
48-
adult: 'VERY_LIKELY',
49-
violence: 'VERY_LIKELY'
50-
}
47+
safeSearchAnnotation: {
48+
adult: 'VERY_LIKELY',
49+
violence: 'VERY_LIKELY'
50+
}
5151
}]));
5252
safeSearchDetectionStub.withArgs(`gs://${bucketName}/${unsafeFilename}`).returns(Promise.resolve([{
53-
safeSearchAnnotation: {
54-
adult: 'VERY_UNLIKELY',
55-
violence: 'VERY_UNLIKELY'
56-
}
53+
safeSearchAnnotation: {
54+
adult: 'VERY_UNLIKELY',
55+
violence: 'VERY_UNLIKELY'
56+
}
5757
}]));
58-
var imageAnnotatorClientStub = sinon.stub(vision, "ImageAnnotatorClient");
58+
var imageAnnotatorClientStub = sinon.stub(vision, 'ImageAnnotatorClient');
5959
imageAnnotatorClientStub.returns({
6060
safeSearchDetection: safeSearchDetectionStub
6161
});
@@ -84,7 +84,7 @@ function getSample (filename) {
8484

8585
test.beforeEach(tools.stubConsole);
8686
test.afterEach.always(tools.restoreConsole);
87-
test.afterEach.always(function() {
87+
test.afterEach.always(function () {
8888
vision.ImageAnnotatorClient.restore();
8989
});
9090

@@ -114,9 +114,9 @@ test.serial(`blurOffensiveImages blurs images`, async (t) => {
114114
test.serial(`blurOffensiveImages ignores safe images`, async (t) => {
115115
const sample = getSample(unsafeFilename);
116116
await sample.program.blurOffensiveImages({
117-
data: {
117+
data: {
118118
bucket: bucketName,
119-
name: unsafeFilename
119+
name: unsafeFilename
120120
}
121121
});
122122
t.is(console.log.callCount, 2);

0 commit comments

Comments
 (0)