opf/openproject

View on GitHub

Showing 620 of 1,668 total issues

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

  def restructured
    rows = []
    columns = []
    current = query.chain
    @all_fields = []
Severity: Minor
Found in modules/reporting/lib/report/transformer.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

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

  def update_demo_xkt_models
    project = Project.find_by(identifier: "demo-bcf-management-project")
    return unless project

    ifc_models = project.ifc_models.joins(:attachments)
Severity: Minor
Found in modules/bim/db/migrate/20210521080035_update_xkt_to_version8.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

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

        def search_entries(parts, identifier)
          search_path = parts[0..-2].join("/")
          search_name = parts[-1]

          if search_path.blank? && search_name.blank?
Severity: Minor
Found in lib/open_project/scm/adapters/base.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

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

      def code_block_transformer
        lambda { |env|
          name = env[:node_name]
          code = env[:node]

Severity: Minor
Found in lib/open_project/text_formatting/filters/sanitization_filter.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

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

    def write_offsets
      if @added > 0 && @added == @removed
        @added.times do |i|
          line = self[-(1 + i)]
          removed = @type == "sbs" ? line : self[-(1 + @added + i)]
Severity: Minor
Found in lib/redmine/diff_table.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

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

  def caption(project = nil)
    if @caption.is_a?(Proc)
      c = @caption.call(project).to_s
      c = @name.to_s.humanize if c.blank?
      c
Severity: Minor
Found in lib/redmine/menu_manager/menu_item.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

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

      def call
        attachments = get_attachments

        rewriter = ::OpenProject::TextFormatting::Helpers::LinkRewriter.new context

Severity: Minor
Found in lib/open_project/text_formatting/filters/attachment_filter.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

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

  def parse_number_string(value)
    return value unless value&.is_a?(String) && value.present?

    value = value.strip

Severity: Minor
Found in modules/costs/app/helpers/costs/number_helper.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

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

        def parse_id(resource_link,
                     property:,
                     expected_version: nil,
                     expected_namespace: nil)
          raise ArgumentError unless resource_link
Severity: Minor
Found in lib/api/utilities/resource_link_parser.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 toggleMultiSelect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  toggleMultiSelect({ params: { filterName } }:{ params:{ filterName:string } }) {
    const valueContainer = this.filterValueContainerTargets.find((filterValueContainer) => filterValueContainer.getAttribute('data-filter-name') === filterName);
    const singleSelect = this.filterValueSelectTargets.find((selectField) => !selectField.multiple && selectField.getAttribute('data-filter-name') === filterName);
    const multiSelect = this.filterValueSelectTargets.find((selectField) => selectField.multiple && selectField.getAttribute('data-filter-name') === filterName);
    if (valueContainer && singleSelect && multiSelect) {
Severity: Minor
Found in frontend/src/stimulus/controllers/dynamic/filters.controller.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

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

          def searchable_column_conditions
            searchable_options[:columns].map do |column|
              name, scope = column.is_a?(Hash) ? column.values_at(:name, :scope) : column
              match_condition = "(#{Arel.sql(name)} ILIKE ?)"

Severity: Minor
Found in lib_static/plugins/acts_as_searchable/lib/acts_as_searchable.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 showSuccessNotification has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private showSuccessNotification(formResponse:HalSource|any):void {
    const submitMessage = (() => {
      if (formResponse?.jobId) {
        const title = formResponse?.payload?.title;

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

function redistribute(
  delta:QueryOrder,
  order:string[],
  minIndex:number,
  maxIndex:number,
Severity: Minor
Found in frontend/src/app/shared/helpers/drag-and-drop/reorder-delta-builder.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 triggerLimitWarningIfReached has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  triggerLimitWarningIfReached(evt:CustomEvent) {
    this.selectedValues = evt.detail as IUserAutocompleteItem[];

    if (this.hasLimitWarningTarget && this.hasOpenSeatsValue) {
      if (this.numberOfNewUsers > 0 && this.numberOfNewUsers > this.openSeatsValue) {
Severity: Minor
Found in frontend/src/stimulus/controllers/dynamic/user-limit.controller.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 getFieldOptions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private getFieldOptions(field:IOPFieldSchemaWithKey, currentValue:HalLink|null):Observable<IOPAllowedValue[]>|undefined {
    const allowedValues = field._embedded?.allowedValues || field._links?.allowedValues;
    let options;

    if (!allowedValues) {

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

  public updateZoomWithDelta(delta:number):void {
    const level = this.current.zoomLevel;
    if (level !== 'auto') {
      return this.applyZoomLevel(level, delta);
    }

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

export function makeSplitViewRoutes(baseRoute:string,
  menuItemClass:string|undefined,
  showComponent:ComponentType<unknown>,
  newComponent:ComponentType<unknown> = WorkPackageNewSplitViewComponent,
  makeFullWidth?:boolean,

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

  private getAriaLabel(field:DisplayField, schema:SchemaResource):string {
    let titleContent;
    const labelContent = this.getLabelContent(field);

    if (field.isFormattable && !field.isEmpty()) {

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

  renderMultiple(
    container:HTMLElement,
    users:(PrincipalLike|IPrincipal)[],
    name:NameOptions = { hide: false, link: false },
    avatar:AvatarOptions = { hide: false, size: 'default' },

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

  updateDate(val:string|null):void {
    // Expected minimal format YYYY-M-D => 8 characters OR empty
    if (val !== null && (val.length >= 8 || val.length === 0)) {
      if (validDate(val) && this.datePickerInstance) {
        const dateValue = parseDate(val) || undefined;

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