Showing 205 of 290 total issues
Function handleEmbedAlignmentChanges
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function handleEmbedAlignmentChanges(editor) {
function updateClassesForPreview(previewElem) {
const mediaTarget = previewElem.querySelector('iframe, video');
if (!mediaTarget) {
return;
Method isSortChangePermissible
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function isSortChangePermissible(BookSortMapItem $sortMapItem, BookChild $model, ?Entity $currentParent, ?Entity $newBook, ?Entity $newChapter): bool
{
// Stop if we can't see the current parent or new book.
if (!$currentParent || !$newBook) {
return false;
Function request
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function request(url, options = {}) {
let requestUrl = url;
if (!requestUrl.startsWith('http')) {
requestUrl = window.baseUrl(requestUrl);
Function init
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export async function init(editor) {
const Code = await window.importVersioned('code');
/**
* @param {ViewUpdate} v
- 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 formatSingle
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function formatSingle(Entity $entity): array
{
$result = [];
$values = (clone $entity)->toArray();
- 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 getConnection
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function getConnection()
{
if ($this->ldapConnection !== null) {
return $this->ldapConnection;
}
- 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 parse
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function parse(): int
{
$nodesAdded = 0;
$tags = $this->locateAndIsolateIncludeTags();
- 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 ensureDeletable
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function ensureDeletable(Entity $entity): void
{
$customHomeId = intval(explode(':', setting('app-homepage', '0:'))[0]);
$customHomeActive = setting('app-homepage-type') === 'page';
$removeCustomHome = false;
- 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 getConnection
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getConnection()
{
if ($this->ldapConnection !== null) {
return $this->ldapConnection;
}
Function buildForInput
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function buildForInput(options) {
// Set language
window.tinymce.addI18n(options.language, options.translationMap);
// BookStack Version
Function createUploadFromFile
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
createUploadFromFile(file) {
const {
dom, status, progress, dismiss,
} = this.createDomForFile(file);
this.statusArea.append(dom);
Method processUsers
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function processUsers(array $users, UserAvatars $userAvatar): int
{
$dryRun = !$this->option('force');
$this->info(count($users) . " user(s) found to update avatars for.");
Function setupListeners
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
setupListeners() {
this.elem.addEventListener('click', this.onClick.bind(this));
let lastSearch = 0;
this.searchInput.addEventListener('input', () => {
Function setupDropTargetHandlers
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
setupDropTargetHandlers() {
let depth = 0;
const reset = () => {
this.hideOverlay();
Method decode
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function decode(string $searchString): array
{
$terms = [
'searches' => [],
'exacts' => [],
Method getConverterEnvironment
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getConverterEnvironment(): Environment
{
$environment = new Environment([
'header_style' => 'atx', // Set to 'atx' to output H1 and H2 headers as # Header1 and ## Header2
'suppress_errors' => true, // Set to false to show warnings when loading malformed HTML
Method saveNew
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function saveNew(string $imageName, string $imageData, string $type, int $uploadedTo = 0): Image
{
$disk = $this->storage->getDisk($type);
$secureUploads = setting('app-secure-images');
$fileName = $this->storage->cleanImageFileName($imageName);
Method queryWithTotals
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function queryWithTotals(SimpleListOptions $listOptions, string $nameFilter): Builder
{
$searchTerm = $listOptions->getSearch();
$sort = $listOptions->getSort();
if ($sort === 'name' && $nameFilter) {
Function setup
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
setup() {
this.elem = this.$el;
this.pageId = this.$opts.pageId;
this.textDirection = this.$opts.textDirection;
Method handle
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(UserRepo $userRepo): int
{
$details = $this->snakeCaseOptions();
if (empty($details['email'])) {