Showing 30 of 60 total issues
Function _put
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async _put({ key, data }: { key: string; data: any }) {
const lengthRaw = isString(data)
? data.length
: JSON.stringify(data).length;
Function getAll
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getAll() {
if (this.s3Cache) {
const cached = await this.s3Cache.get({ action: "getAll" });
if (cached) return cached;
}
Function getAll
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
async getAll() {
if (this.s3Cache) {
const cached = await this.s3Cache.get({ action: "getAll" });
if (cached) return cached;
}
- 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 map
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
map(data: any) {
let obj: any = { ...data };
for (const [attribute, actions] of Object.entries(this.options.beforeMap)) {
for (const action of actions as string[]) {
- 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 deleteObject
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async deleteObject(key: string) {
try {
const options: any = {
Bucket: this.bucket,
Key: this.keyPrefix ? path.join(this.keyPrefix, key) : 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"
Further reading
Function headObject
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async headObject(key: string) {
try {
const options: any = {
Bucket: this.bucket,
Key: this.keyPrefix ? path.join(this.keyPrefix, key) : 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"
Further reading
Function getKeysPage
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async getKeysPage({
prefix,
offset = 0,
amount = 100,
}: {
- 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
Avoid too many return
statements within this function. Open
return null;
Function getObject
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async getObject(key: string) {
try {
const options = {
Bucket: this.bucket,
Key: path.join(this.keyPrefix, 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"
Further reading
Function _delete
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async _delete({ key }: { key: string }) {
try {
await this.s3Client.deleteObject(key);
} catch (error) {
if (error instanceof Error) {
- 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"