Skip to content

Commit

Permalink
Fixed code smells - bumped dev deps (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
petruki authored Oct 25, 2023
1 parent 84aca4a commit 096ce9f
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 20 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Roger Floriano (petruki) and Contributors
Copyright (c) 2019-present Roger Floriano (petruki) and Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
"node-fetch": "^2.7.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"babel-eslint": "^10.1.0",
"chai": "^4.3.10",
"chai-as-promised": "^7.1.1",
Expand Down
5 changes: 2 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

const Bypasser = require('./lib/bypasser');
const ExecutionLogger = require('./lib/utils/executionLogger');
const TimedMatch = require('./lib/utils/timed-match');
Expand Down Expand Up @@ -384,8 +382,9 @@ class Switcher {
const response = await checkCriteriaOffline(
this._key, this._input, Switcher.snapshot);

if (Switcher.options.logger)
if (Switcher.options.logger) {
ExecutionLogger.add(response, this._key, this._input);
}

return response.result;
}
Expand Down
2 changes: 0 additions & 2 deletions src/lib/bypasser/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

const Key = require('./key');
const bypassedKeys = new Array();

Expand Down
2 changes: 0 additions & 2 deletions src/lib/bypasser/key.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

/**
* Type definition for Switcher Keys which are used to mock results
*/
Expand Down
6 changes: 4 additions & 2 deletions src/lib/resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ async function checkGroup(groups, key, input) {
* @return true if Switcher found
*/
async function checkConfig(group, config, input) {
if (!config)
if (!config) {
return false;
}

if (!group.activated) {
throw new CriteriaFailed('Group disabled');
Expand All @@ -81,8 +82,9 @@ async function checkStrategy(config, input) {
const entry = services.getEntry(input);

for (const strategy of strategies) {
if (!strategy.activated)
if (!strategy.activated) {
continue;
}

await checkStrategyInput(entry, strategy);
}
Expand Down
5 changes: 3 additions & 2 deletions src/lib/snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const { parseJSON, payloadReader } = require('./utils/payloadReader');
const loadDomain = (snapshotLocation, environment) => {
try {
let dataBuffer;
const snapshotFile = `${snapshotLocation}${environment}.json`;
const snapshotFile = `${snapshotLocation}/${environment}.json`;
if (fs.existsSync(snapshotFile)) {
dataBuffer = fs.readFileSync(snapshotFile);
} else {
Expand Down Expand Up @@ -221,8 +221,9 @@ async function processREGEX(operation, input, values) {

function processPAYLOAD(operation, input, values) {
const inputJson = parseJSON(input);
if (!inputJson)
if (!inputJson) {
return false;
}

const keys = payloadReader(inputJson);
switch(operation) {
Expand Down
2 changes: 0 additions & 2 deletions src/lib/utils/datemoment.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

class DateMoment {
constructor(date, time) {
this.date = new Date(date);
Expand Down
2 changes: 0 additions & 2 deletions src/lib/utils/executionLogger.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

const logger = new Array();

class ExecutionLogger {
Expand Down
2 changes: 0 additions & 2 deletions src/lib/utils/ipcidr.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

class IPCIDR {
constructor(cidr) {
this.cidr = cidr;
Expand Down

0 comments on commit 096ce9f

Please sign in to comment.