anyone-oslo/pages

View on GitHub

Showing 130 of 130 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

y:
dragState.startY +
e.clientY -
dragState.offsetY +
(document.body.scrollTop - dragState.scrollTop)
Severity: Minor
Found in app/javascript/components/PageTree.tsx and 1 other location - About 30 mins to fix
app/javascript/components/PageTree.tsx on lines 116..120

Function hovering has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function hovering<T>(
dragState: Drag.State<T>,
target: Drag.DraggableOrFiles<T> | React.MutableRefObject<HTMLDivElement>
) {
const { x, y } = dragState;
Severity: Minor
Found in app/javascript/components/drag/draggedOrder.ts - About 25 mins to fix

Function relativeUrl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function relativeUrl(str: string): string {
let url: URL = null;
 
if (!str.match(/^https:\/\//) || !document || !document.location) {
return str;
Severity: Minor
Found in app/javascript/components/RichTextArea/actions.ts - About 25 mins to fix

Function collectionOrder has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function collectionOrder<T>(
collection: Drag.Collection<T>,
dragState: Drag.State<T>
): Array<Drag.DraggableOrFiles<T>> {
const { draggables, ref } = collection;
Severity: Minor
Found in app/javascript/components/drag/draggedOrder.ts - About 25 mins to fix

Function unconfiguredBlocks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function unconfiguredBlocks(state: PageEditor.State): Template.Block[] {
const allBlocks: Record<string, Template.Block> = state.templates
.flatMap((t) => t.blocks)
.reduce((bs, b) => ({ [b.name]: b, ...bs }), {});
 
 
Severity: Minor
Found in app/javascript/components/PageForm/utils.ts - About 25 mins to fix

Function modifyDate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function modifyDate(original: Date, options: ModifyOptions = {}): Date {
const newDate = new Date(original);
if ("year" in options) {
newDate.setFullYear(options.year);
}
Severity: Minor
Found in app/javascript/components/DateTimeSelect.tsx - About 25 mins to fix

Method reify_options has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def reify_options(block)
return block unless block.key?(:options)
 
opts = block[:options]
opts = opts.call if opts.is_a?(Proc)
Severity: Minor
Found in app/resources/admin/template_configuration_resource.rb - About 25 mins to fix

Method setting has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def self.setting(key, type, default = nil)
settings[key] = SettingStruct.new(type, default)
 
define_method key do |*args|
args.any? ? set(key, *args) : get(key)
Severity: Minor
Found in lib/pages_core/configuration/base.rb - About 25 mins to fix

Method redirect_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def redirect_path(params = {})
path = redirect_to.dup
if path.start_with? "/"
params.each do |key, value|
unless value.is_a?(String) || value.is_a?(Symbol)
Severity: Minor
Found in app/models/concerns/pages_core/page_model/redirectable.rb - About 25 mins to fix

Function DragElement has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export default function DragElement(props: Props) {
const { draggable, dragState, container } = props;
 
if (draggable === "Files") {
return "";
Severity: Minor
Found in app/javascript/components/ImageGrid/DragElement.tsx - About 25 mins to fix
Severity
Category
Status
Source
Language