Skip to content

Commit

Permalink
GH Action Standards
Browse files Browse the repository at this point in the history
  • Loading branch information
confused-Techie authored and github-actions[bot] committed Feb 10, 2024
1 parent fda9513 commit a9fdb83
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 50 deletions.
34 changes: 22 additions & 12 deletions docs/resources/complexity-report.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Complexity report, 2/10/2024

* Mean per-function logical LOC: 15.325757575757576
* Mean per-function parameter count: 0.15984848484848485
* Mean per-function cyclomatic complexity: 1.256060606060606
* Mean per-function Halstead effort: 3265.460654733948
* Mean per-module maintainability index: 67.56436449689599
* First-order density: 0.711662075298439%
* Change cost: 4.545454545454546%
* Mean per-function logical LOC: 15.14179104477612
* Mean per-function parameter count: 0.1574626865671642
* Mean per-function cyclomatic complexity: 1.2522388059701492
* Mean per-function Halstead effort: 3219.3977934951786
* Mean per-module maintainability index: 67.82180870506276
* First-order density: 0.7128536422365783%
* Change cost: 4.5444419692581866%
* Core size: 100%

## /home/runner/work/package-backend/package-backend/jest.config.js
Expand Down Expand Up @@ -51,13 +51,13 @@

## /home/runner/work/package-backend/package-backend/src/context.js

* Physical LOC: 20
* Logical LOC: 18
* Physical LOC: 21
* Logical LOC: 19
* Mean parameter count: 0
* Cyclomatic complexity: 1
* Cyclomatic complexity density: 5.555555555555555%
* Maintainability index: 57.55605134290526
* Dependency count: 16
* Cyclomatic complexity density: 5.263157894736842%
* Maintainability index: 56.91380338014516
* Dependency count: 17

## /home/runner/work/package-backend/package-backend/docs/resources/jsdoc_typedef.js

Expand Down Expand Up @@ -259,6 +259,16 @@
* Halstead volume: 75.28421251514429
* Halstead effort: 169.38947815907466

## /home/runner/work/package-backend/package-backend/src/models/callStack.js

* Physical LOC: 42
* Logical LOC: 2
* Mean parameter count: 0
* Cyclomatic complexity: 1
* Cyclomatic complexity density: 50%
* Maintainability index: 85.45537440682988
* Dependency count: 1

## /home/runner/work/package-backend/package-backend/src/models/ssoHTML.js

* Physical LOC: 12
Expand Down
26 changes: 5 additions & 21 deletions src/controllers/postPackages.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ module.exports = {
},

async logic(params, context) {

const callStack = new context.callStack();

const user = await context.auth.verifyAuth(params.auth, context.database);
Expand Down Expand Up @@ -142,10 +141,7 @@ module.exports = {
if (!gitowner.ok) {
const sso = new context.sso();

return sso
.notOk()
.addContent(gitowner)
.assignCalls(callStack);
return sso.notOk().addContent(gitowner).assignCalls(callStack);
}

// Now knowing they own the git repo, and it doesn't exist here, lets publish.
Expand Down Expand Up @@ -182,19 +178,13 @@ module.exports = {
// the server failed for some other bubbled reason
const sso = new context.sso();

return sso
.notOk()
.addContent(nameAvailable)
.assignCalls(callStack);
return sso.notOk().addContent(nameAvailable).assignCalls(callStack);
}
// But if the short is in fact "not_found" we can report the package as
// not being available at this name
const sso = new context.sso();

return sso
.notOk()
.addShort("package_exists")
.assignCalls(callStack);
return sso.notOk().addShort("package_exists").assignCalls(callStack);
}

// Now with valid package data, we can insert them into the DB
Expand All @@ -207,10 +197,7 @@ module.exports = {
if (!insertedNewPack.ok) {
const sso = new context.sso();

return sso
.notOk()
.addContent(insertedNewPack)
.assignCalls(callStack);
return sso.notOk().addContent(insertedNewPack).assignCalls(callStack);
}

// Finally we can return what was actually put into the databse.
Expand All @@ -226,10 +213,7 @@ module.exports = {
if (!newDbPack.ok) {
const sso = new context.sso();

return sso
.notOk()
.addContent(newDbPack)
.assignCalls(callStack);
return sso.notOk().addContent(newDbPack).assignCalls(callStack);
}

const packageObjectFull = await context.models.constructPackageObjectFull(
Expand Down
10 changes: 2 additions & 8 deletions src/controllers/postPackagesPackageNameStar.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ module.exports = {
if (!star.ok) {
const sso = new context.sso();

return sso
.notOk()
.addContent(star)
.assignCalls(callStack);
return sso.notOk().addContent(star).assignCalls(callStack);
}

// Now with a success we want to return the package back in this query
Expand All @@ -72,10 +69,7 @@ module.exports = {
if (!pack.ok) {
const sso = new context.sso();

return sso
.notOk()
.addContent(pack)
.assignCalls(callStack);
return sso.notOk().addContent(pack).assignCalls(callStack);
}

pack = await context.models.constructPackageObjectFull(pack.content);
Expand Down
5 changes: 1 addition & 4 deletions src/controllers/postPackagesPackageNameVersions.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,7 @@ module.exports = {
if (!packMetadata.ok) {
const sso = new context.sso();

return sso
.notOk()
.addContent(packMetadata)
.assignCalls(callStack);
return sso.notOk().addContent(packMetadata).assignCalls(callStack);
}

const newName = packMetadata.content.name;
Expand Down
9 changes: 4 additions & 5 deletions src/models/callStack.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const { performance } = require("node:perf_hooks");

module.exports =
class CallStack {
module.exports = class CallStack {
constructor() {
this.calls = {};

Expand All @@ -15,7 +14,7 @@ class CallStack {
addCall(id, content) {
this.calls[id] = {
content: this.sanitize(content),
time: performance.now()
time: performance.now(),
};
}

Expand All @@ -28,7 +27,7 @@ class CallStack {
let outContent = {};

for (const key in content) {
switch(key) {
switch (key) {
case "token":
outContent[key] = "*****";
break;
Expand All @@ -40,4 +39,4 @@ class CallStack {

return outContent;
}
}
};

0 comments on commit a9fdb83

Please sign in to comment.