anyone-oslo/pages

View on GitHub

Showing 85 of 147 total issues

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

  render() {
    const props = this.props;
    const index = props.index;
    const dragging = props.dragging;
    const editing = this.node().editing;
Severity: Minor
Found in app/javascript/components/PageTree/Node.tsx - About 25 mins to fix

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 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

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 hovering has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

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

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 getNodeByTop has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  getNodeByTop(top: Trees.Id) {
    const indexes = this.indexes;
    for (const id in indexes) {
      if (Object.prototype.hasOwnProperty.call(indexes, id)) {
        if (indexes[id].top === top) {
Severity: Minor
Found in app/javascript/lib/Tree.ts - About 25 mins to fix

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 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

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

Severity
Category
Status
Source
Language