Skip to content

Commit

Permalink
Impliment deepcode suggestions (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
drazisil authored Feb 22, 2021
1 parent 7b2c1e6 commit 83d0664
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@ codecov-macos
codecov.exe
.DS_Store
.idea/*
.dccache
2 changes: 1 addition & 1 deletion src/ci_providers/provider_circleci.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function getServiceParams(inputs) {
commit: _getSHA(inputs),
job: _getJob(inputs.envs),
pr: _getPR(inputs),
service: _getService(inputs),
service: _getService(),
slug: _getSlug(inputs)
};
}
Expand Down
6 changes: 2 additions & 4 deletions src/helpers/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ async function uploadToCodecovPUT(uploadURL, uploadFile) {
.retry()
.send(uploadFile) // sends a JSON post body
.set("Content-Type", "application/x-gzip")
.set("Content-Encoding", "gzip")
.set("Content-Length", Buffer.byteLength(uploadFile));
.set("Content-Encoding", "gzip");

if (result.status === 200) {
return { status: "success", resultURL: codecovResultURL };
Expand All @@ -45,8 +44,7 @@ async function uploadToCodecov(uploadURL, token, query, uploadFile, version) {
.retry()
.send(uploadFile) // sends a JSON post body
.set("X-Reduced-Redundancy", "false")
.set("X-Content-Type", "application/x-gzip")
.set("Content-Length", Buffer.byteLength(uploadFile));
.set("X-Content-Type", "application/x-gzip");

return result.res.text;
} catch (error) {
Expand Down
3 changes: 1 addition & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@ async function main(args) {
);
const result = await webHelpers.uploadToCodecovPUT(
uploadURL,
gzippedFile,
inputs
gzippedFile
);
console.log(result);
}
Expand Down
3 changes: 3 additions & 0 deletions test/helpers/web.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe("Web Helpers", function() {
query = "hello";
version = "0.0.1";

// deepcode ignore WrongNumberOfArgs/test: believe this is a false positive
nock("https://codecov.io")
.put("/")
.query(true)
Expand All @@ -29,6 +30,7 @@ afterEach(function() {

it("Can POST to the uploader endpoint (HTTP)", async function() {
uploadURL = "http://codecov.io";
// deepcode ignore WrongNumberOfArgs/test: believe this is a false positive
nock("http://codecov.io")
.post("/upload/v4")
.query(true)
Expand All @@ -51,6 +53,7 @@ afterEach(function() {

it("Can POST to the uploader endpoint (HTTPS)", async function() {
uploadURL = "https://codecov.io";
// deepcode ignore WrongNumberOfArgs/test: believe this is a false positive
nock("https://codecov.io")
.post("/upload/v4")
.query(true)
Expand Down

0 comments on commit 83d0664

Please sign in to comment.