Showing 5 of 7 total issues
Function remove
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public remove(obj: { [x: string]: string } | string | string[]): TypeError | undefined {
if (typeof obj === 'string') {
delete process.env[obj]
delete this.env[obj]
} else if (Object.prototype.toString.call(obj) === '[object Object]') {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __readSync
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private __readSync() {
const OBJ: {
[x: string]: string
} = {}
const file = fs.readFileSync(this.env_path, { encoding: this.encoding }).toString().split(/\r?\n/)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function remove
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public remove(obj: { [x: string]: string } | string | string[]): TypeError | undefined {
if (typeof obj === 'string') {
delete process.env[obj]
delete this.env[obj]
} else if (Object.prototype.toString.call(obj) === '[object Object]') {
Function add
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public add(obj: { [x: string]: string }, force = false): TypeError | undefined {
if (Object.prototype.toString.call(obj) !== '[object Object]') {
const errorMessage = new TypeError(
`[ADD_ERROR]: object must be [object Object] but received ${Object.prototype.toString.call(obj)}`
)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __save
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private __save() {
this.__sort()
let string = ''
for (const key in this.env) {
if (Object.prototype.hasOwnProperty.call(this.env, key)) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"