opf/openproject

View on GitHub

Showing 635 of 1,693 total issues

Method event_type has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def self.event_type
        Proc.new do |o|
          journal = o.last_journal
          t = "work_package"

Severity: Minor
Found in app/models/work_package/journalized.rb - About 1 hr 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 rate_updated has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def rate_updated
    o = Methods.new(self)

    unless saved_change_to_valid_from?
      # We have not moved a rate, maybe just changed the rate value
Severity: Minor
Found in modules/costs/app/models/rate.rb - About 1 hr 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 to_html has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def to_html
        words = self.words.map { |word| h(word) }
        words_add = 0
        words_del = 0
        dels = 0
Severity: Minor
Found in lib/redmine/helpers/diff.rb - About 1 hr 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 head has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def head
    content_tag :thead do
      content_tag :tr do
        FIELDS.map do |field|
          concat content_tag(:th) {
Severity: Minor
Found in modules/reporting/lib/widget/table/entry_table.rb - About 1 hr 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 compactdiffs has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def compactdiffs
    diffs = []
    @diffs.each do |df|
      i = 0
      curdiff = []
Severity: Minor
Found in lib_static/redmine/diff/array_string_diff.rb - About 1 hr 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 reinsert has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export function reinsert(el:HTMLElement, previousIndex:number|string, container:HTMLElement) {
  const prev = typeof previousIndex === 'string' ? parseInt(previousIndex, 10) : previousIndex;
  const currentIndex = el.parentNode ? Array.from(el.parentNode.children).indexOf(el) : null;
  const children = Array.from(container.children);

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

  public addError(obj:HttpErrorResponse|IToast|string, additionalErrors:unknown[]|string = []):IToast|null {
    let message:IToast|string;
    let errors:string[];

    if (typeof additionalErrors === 'string') {
Severity: Minor
Found in frontend/src/app/shared/components/toaster/toast.service.ts - About 1 hr 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 handleError has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  public handleError(error:unknown):void {
    let message:string = this.text.internal_error;

    // Angular wraps our errors into uncaught promises if
    // no one catches the error explicitly. Unwrap the error in that case
Severity: Minor
Found in frontend/src/app/features/hal/services/hal-aware-error-handler.ts - About 1 hr 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 updateTimeframe has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  async updateTimeframe(
    fetchInfo:{ start:Date, end:Date, timeZone:string },
    projectIdentifier:string|undefined,
  ):Promise<unknown> {
    await this.requireNonWorkingDays(fetchInfo.start);

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

  private initialize():void {
    const initialData = this.loadGonData();
    if (initialData) {
      if (initialData.available_search_types) {
        this._tabs.next(initialData.available_search_types);

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 EditableInplace has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

RB.EditableInplace = (function ($) {
  return RB.Object.create(RB.Model, {

    displayEditor: function (editor) {
      this.$.addClass("editing");

    Method index has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def index
          # If there are no query_props given, redirect to the default query
          if params[:query_props].nil? && params[:query_id].nil?
            if @project.present?
              return redirect_to(
    Severity: Minor
    Found in modules/gantt/app/controllers/gantt/gantt_controller.rb - About 1 hr to fix

      Function workPackageMeetingsCount has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function workPackageMeetingsCount(
        workPackage:WorkPackageResource,
        injector:Injector,
      ):Observable<number> {
        const pathHelperService = injector.get(PathHelperService);
      Severity: Minor
      Found in modules/meeting/frontend/module/main.ts - About 1 hr to fix

        Method extract_params has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def extract_params(payload)
              {
                github_id: payload.fetch("id"),
                github_user: github_user_id(payload.fetch("user")),
                number: payload.fetch("number"),

          Function select has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private select(area:GridArea) {
              return new Promise<GridWidgetResource>((resolve, reject) => {
                this.opModalService.show(
                  AddGridWidgetModalComponent,
                  this.injector,
          Severity: Minor
          Found in frontend/src/app/shared/components/grids/grid/add-widget.service.ts - About 1 hr to fix

            Function ngOnInit has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              ngOnInit() {
                // Get element
                // We use this more complicated approach of taking the last element of the class as it allows
                // to still work in case an element is duplicated by Angular.
                const elements = document.getElementsByClassName(this.elementClass);

              Function listenToFormSubmit has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                private listenToFormSubmit() {
                  const form = this.elementRef.nativeElement.closest('form') as HTMLFormElement;
                  form.addEventListener('submit', (evt:Event) => {
                    if (!this.form_submitted
                      && (this.nonWorkingDaysModified() || this.workingDaysModified())) {

                Function initDrake has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  initDrake() {
                    this.setContainerTargetsAndConfigs();
                
                    // reinit drake if it already exists
                    if (this.drake) {

                  Function ngOnInit has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    ngOnInit():void {
                      this.observeWorkPackage();
                  
                      const wpId = this.$state.params.workPackageId as string;
                      const focusedWP = this.wpTableFocus.focusedWorkPackage;

                    Function updateWorkPackageCreationState has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      private updateWorkPackageCreationState(change:WorkPackageChangeset) {
                        const resource = change.projectedResource;
                        if (!this.currentProject.inProjectContext) {
                          this.projectContext.field = this.getFields(change, ['project']);
                          this.workPackage.project = resource.project as HalResource;
                      Severity
                      Category
                      Status
                      Source
                      Language