Showing 22 of 138 total issues
File file.ts
has 362 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { a11yClick, alertUser } from "./menu";
import { formatBytes } from "./lib/utils";
import { initTabs } from "./lib/tabs";
const modal = document.getElementById("modal") as HTMLDialogElement;
Function uploadFile
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function uploadFile(file: File) {
const formData = new FormData();
formData.append("uploaded_file", file);
modal.showModal();
Function triggerCallback
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
function triggerCallback(e: DragEvent | Event, callback: () => {}) {
if (!callback || typeof callback !== "function") {
return;
}
- 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 makeDroppable
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
function makeDroppable(element: HTMLElement, callback: any) {
const input = document.createElement("input");
input.setAttribute("type", "file");
input.setAttribute("multiple", "false");
input.style.display = "none";
Function uploadFile
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export async function uploadFile(file: File) {
const formData = new FormData();
formData.append("uploaded_file", file);
modal.showModal();
- 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
File menu.ts
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
import sweetAlert, { SweetAlertOptions } from "sweetalert2";
import * as DarkModeToggle from "dark-mode-toggle";
// Get the modal
const settingsModal = document.getElementById("settingsModal")!;
Function validate
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function validate()
{
// Start the session
if (session_status() !== 2) {
session_start();
- 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
Method createClip
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createClip($url)
{
noteLimit();
$err = "";
Function handleRequest
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
async function handleRequest(request) {
const method = request.url.split("/")[3];
const { searchParams } = new URL(request.url);
const urlRegex = new RegExp(
/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)((?:\/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w]*))?)/
- 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 handleTabNavigation
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
const handleTabNavigation = (e) => {
const key = e.key;
const currentTab = e.target.parentElement as HTMLUListElement;
const tabsArray = Array.from(tabs) as HTMLUListElement[];
Function createClip
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function createClip($url)
{
noteLimit();
$err = "";
- 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 triggerCallback
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function triggerCallback(e: DragEvent | Event, callback: () => {}) {
if (!callback || typeof callback !== "function") {
return;
}
Method getOS
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getOS()
{
global $user_agent;
Function updateFileStats
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const updateFileStats = async () => {
if (!(filesSpan && filesSizeSpan)) {
return;
}
Function writeDb
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function writeDb($url)
{
include_once "includes/lib/init.php";
include_once "includes/components/new.php";
- 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 noteLimit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function noteLimit()
{
if ($GLOBALS["redisAvailable"]) {
// The IP is from the shared internet
- 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 new Response(
JSON.stringify({
status: "error",
result: "there is nothing to do, specify a method",
}),
Avoid too many return
statements within this function. Open
return new Response(JSON.stringify({ status: "success", result: code }), {
headers: {
"content-type": "application/json;charset=UTF-8",
},
status: 200,
Avoid too many return
statements within this function. Open
return new Response(
JSON.stringify({ status: "error", result: "invalid URL specified" }),
{
headers: {
"content-type": "application/json;charset=UTF-8",
Function storeRedis
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function storeRedis($key, $value, $expiration = 60 * 60 * 24 * 7)
{
if ($GLOBALS["redisAvailable"] && $GLOBALS["redis"]->ping()) {
$redisCached = $GLOBALS["redis"]->get($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"