Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Lint

Oliver Günther5e48ad29277a
diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb
index ae8a53fd4e0..15d2c0e1e1a 100644
--- a/app/controllers/account_controller.rb
+++ b/app/controllers/account_controller.rb
@@ -377,7 +377,7 @@ class AccountController < ApplicationController
end
end
- def password_authentication(username, password)
+ def password_authentication(username, password) # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity
user = User.try_to_login(username, password, session)
if user.nil?
# login failed, now try to find out why and do the appropriate thing
diff --git a/app/controllers/attribute_help_texts_controller.rb b/app/controllers/attribute_help_texts_controller.rb
index 87637eed4bb..062a2733782 100644
--- a/app/controllers/attribute_help_texts_controller.rb
+++ b/app/controllers/attribute_help_texts_controller.rb
@@ -44,7 +44,7 @@ class AttributeHelpTextsController < ApplicationController
def edit; end
- def create
+ def create # rubocop:disable Metrics/AbcSize
call = ::AttributeHelpTexts::CreateService
.new(user: current_user)
.call(permitted_params_with_attachments)
@@ -59,7 +59,7 @@ class AttributeHelpTextsController < ApplicationController
end
end
- def update
+ def update # rubocop:disable Metrics/AbcSize
call = ::AttributeHelpTexts::UpdateService
.new(user: current_user, model: @attribute_help_text)
.call(permitted_params_with_attachments)
diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb
index 0d8db7a9324..286f766e469 100644
--- a/app/controllers/categories_controller.rb
+++ b/app/controllers/categories_controller.rb
@@ -38,7 +38,7 @@ class CategoriesController < ApplicationController
@category = @project.categories.build
end
- def create
+ def create # rubocop:disable Metrics/AbcSize
@category = @project.categories.build
@category.attributes = permitted_params.category
diff --git a/app/controllers/concerns/custom_fields/shared_actions.rb b/app/controllers/concerns/custom_fields/shared_actions.rb
index 6ef1aee1df7..3fab2fca572 100644
--- a/app/controllers/concerns/custom_fields/shared_actions.rb
+++ b/app/controllers/concerns/custom_fields/shared_actions.rb
@@ -47,7 +47,7 @@ module CustomFields
end
end
- def create
+ def create # rubocop:disable Metrics/AbcSize
call = ::CustomFields::CreateService
.new(user: current_user)
.call(get_custom_field_params.merge(type: permitted_params.custom_field_type))
diff --git a/app/controllers/enterprises_controller.rb b/app/controllers/enterprises_controller.rb
index 1c3dffe176e..4f07aa40012 100644
--- a/app/controllers/enterprises_controller.rb
+++ b/app/controllers/enterprises_controller.rb
@@ -47,7 +47,7 @@ class EnterprisesController < ApplicationController
end
end
- def create
+ def create # rubocop:disable Metrics/AbcSize
@token = EnterpriseToken.current || EnterpriseToken.new
saved_encoded_token = @token.encoded_token
@token.encoded_token = params[:enterprise_token][:encoded_token]
diff --git a/app/controllers/placeholder_users_controller.rb b/app/controllers/placeholder_users_controller.rb
index 809fd062e27..65ce10e47e4 100644
--- a/app/controllers/placeholder_users_controller.rb
+++ b/app/controllers/placeholder_users_controller.rb
@@ -79,7 +79,7 @@ class PlaceholderUsersController < ApplicationController
@individual_principal = @placeholder_user
end
- def create
+ def create # rubocop:disable Metrics/AbcSize
service = PlaceholderUsers::CreateService.new(user: User.current)
service_result = service.call(permitted_params.placeholder_user)
@placeholder_user = service_result.result
@@ -100,7 +100,7 @@ class PlaceholderUsersController < ApplicationController
end
end
- def update
+ def update # rubocop:disable Metrics/AbcSize
service_result = PlaceholderUsers::UpdateService
.new(user: User.current,
model: @placeholder_user)
diff --git a/app/controllers/types_controller.rb b/app/controllers/types_controller.rb
index 37330a6f6b4..8534e384390 100644
--- a/app/controllers/types_controller.rb
+++ b/app/controllers/types_controller.rb
@@ -60,7 +60,7 @@ class TypesController < ApplicationController
end
end
- def create
+ def create # rubocop:disable Metrics/AbcSize
CreateTypeService
.new(current_user)
.call(permitted_type_params, copy_workflow_from: params[:copy_workflow_from]) do |call|
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 4c382a9ee2f..d667d29e9c4 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -97,7 +97,7 @@ class UsersController < ApplicationController
end
end
- def update
+ def update # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity
update_params = build_user_update_params
call = ::Users::UpdateService.new(model: @user, user: current_user).call(update_params)
diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb
index a61732e9fdb..f3c8853a944 100644
--- a/app/controllers/wiki_controller.rb
+++ b/app/controllers/wiki_controller.rb
@@ -149,7 +149,7 @@ class WikiController < ApplicationController
end
# Creates a new page or updates an existing one
- def update
+ def update # rubocop:disable Metrics/AbcSize
@old_title = params[:id]
@page = @wiki.find_or_new_page(@old_title)
if @page.nil?
diff --git a/app/controllers/wiki_menu_items_controller.rb b/app/controllers/wiki_menu_items_controller.rb
index 94ac13da4a1..51ad5b23af8 100644
--- a/app/controllers/wiki_menu_items_controller.rb
+++ b/app/controllers/wiki_menu_items_controller.rb
@@ -62,7 +62,7 @@ class WikiMenuItemsController < ApplicationController
get_data_from_params(params)
end
- def update
+ def update # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity
wiki_menu_setting = wiki_menu_item_params[:setting]
parent_wiki_menu_item = params[:parent_wiki_menu_item]
diff --git a/app/helpers/password_helper.rb b/app/helpers/password_helper.rb
index 70003b97eac..398a824aac4 100644
--- a/app/helpers/password_helper.rb
+++ b/app/helpers/password_helper.rb
@@ -58,7 +58,7 @@ module PasswordHelper
controller = with_data.fetch(:controller, "")
if password_confirmation_required?
- with_data.merge("controller": "#{controller} password-confirmation-dialog".strip)
+ with_data.merge(controller: "#{controller} password-confirmation-dialog".strip)
else
with_data
end
diff --git a/app/models/custom_actions/conditions/role.rb b/app/models/custom_actions/conditions/role.rb
index 71703a7f85d..12b09dc8267 100644
--- a/app/models/custom_actions/conditions/role.rb
+++ b/app/models/custom_actions/conditions/role.rb
@@ -39,9 +39,9 @@ class CustomActions::Conditions::Role < CustomActions::Conditions::Base
def roles_in_project(work_packages, user)
with_request_store(projects_of(work_packages)) do |projects|
- projects.map do |project|
+ projects.filter_map do |project|
user.roles_for_project(project)
- end.compact.flatten
+ end.flatten
end
end
diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts
index ed65337b75f..a35c22a3565 100644
--- a/frontend/src/app/app.module.ts
+++ b/frontend/src/app/app.module.ts
@@ -398,7 +398,6 @@ export function initializeServices(injector:Injector) {
export class OpenProjectModule implements DoBootstrap {
// noinspection JSUnusedGlobalSymbols
ngDoBootstrap(appRef:ApplicationRef) {
-
this.runBootstrap(appRef);
// Connect ui router to turbo drive
@@ -415,7 +414,6 @@ export class OpenProjectModule implements DoBootstrap {
if (root) {
appRef.bootstrap(ApplicationBaseComponent, root);
}
-
}
private registerCustomElements(injector:Injector) {
diff --git a/frontend/src/app/core/current-user/current-user.module.ts b/frontend/src/app/core/current-user/current-user.module.ts
index 0516cfa2e93..5fb26d3f90d 100644
--- a/frontend/src/app/core/current-user/current-user.module.ts
+++ b/frontend/src/app/core/current-user/current-user.module.ts
@@ -3,7 +3,6 @@ import { Injector, NgModule } from '@angular/core';
import { CurrentUserService } from './current-user.service';
import { CurrentUserStore } from './current-user.store';
import { CurrentUserQuery } from './current-user.query';
-import { ErrorReporterBase } from 'core-app/core/errors/error-reporter-base';
import { firstValueFrom } from 'rxjs';
function loadUserMetadata(currentUserService:CurrentUserService) {
@@ -18,13 +17,12 @@ function loadUserMetadata(currentUserService:CurrentUserService) {
export function bootstrapModule(injector:Injector):void {
const currentUserService = injector.get(CurrentUserService);
- (window.ErrorReporter as ErrorReporterBase)
+ window.ErrorReporter
.addHook(
() => firstValueFrom(currentUserService.user$)
.then(({ id }) => ({ user: id || 'anon' })),
);
-
loadUserMetadata(currentUserService);
document.addEventListener('turbo:load', () => loadUserMetadata(currentUserService));
}
diff --git a/frontend/src/app/features/admin/types/type-form-configuration.component.ts b/frontend/src/app/features/admin/types/type-form-configuration.component.ts
index 94c498e4885..d6c0bbe3c49 100644
--- a/frontend/src/app/features/admin/types/type-form-configuration.component.ts
+++ b/frontend/src/app/features/admin/types/type-form-configuration.component.ts
@@ -1,4 +1,4 @@
-import { AfterViewInit, Component, ElementRef, OnInit, OnDestroy } from '@angular/core';
+import { AfterViewInit, Component, ElementRef, OnDestroy, OnInit } from '@angular/core';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import {
ExternalRelationQueryConfigurationService,
@@ -167,6 +167,7 @@ export class TypeFormConfigurationComponent extends UntilDestroyedMixin implemen
ngOnDestroy():void {
this.dragula.destroy('groups');
this.dragula.destroy('attributes');
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call
this.autoscroll.destroy();
}
diff --git a/frontend/src/stimulus/controllers/password-confirmation-dialog.controller.ts b/frontend/src/stimulus/controllers/password-confirmation-dialog.controller.ts
index c5c3b71334b..5244b17b91a 100644
--- a/frontend/src/stimulus/controllers/password-confirmation-dialog.controller.ts
+++ b/frontend/src/stimulus/controllers/password-confirmation-dialog.controller.ts
@@ -34,7 +34,7 @@ import {
} from 'core-app/shared/components/modals/request-for-confirmation/password-confirmation.modal';
export default class PasswordConfirmationDialogController extends ApplicationController {
- private formListener = this.onFormSubmit.bind(this);
+ private formListener:(evt:SubmitEvent) => unknown = this.onFormSubmit.bind(this);
private activeDialog = false;
diff --git a/frontend/src/turbo/turbo-global-listeners.ts b/frontend/src/turbo/turbo-global-listeners.ts
index f6565353959..1b715fe5c1b 100644
--- a/frontend/src/turbo/turbo-global-listeners.ts
+++ b/frontend/src/turbo/turbo-global-listeners.ts
@@ -15,7 +15,7 @@ import {
} from 'core-app/core/setup/globals/global-listeners/setup-server-response';
export function addTurboGlobalListeners() {
- document.addEventListener('turbo:load', (event) => {
+ document.addEventListener('turbo:load', () => {
// Add to content if warnings displayed
if (document.querySelector('.warning-bar--item')) {
const content = document.querySelector('#content') as HTMLElement;
@@ -42,7 +42,7 @@ export function addTurboGlobalListeners() {
setupToggableFieldsets();
// Action menu logic
- jQuery('.toolbar-items').each((idx:number, menu:HTMLElement) => {
+ jQuery('.toolbar-items').each((_, menu:HTMLElement) => {
installMenuLogic(jQuery(menu));
});
diff --git a/modules/costs/app/controllers/cost_types_controller.rb b/modules/costs/app/controllers/cost_types_controller.rb
index 07db5d36403..099e123d435 100644
--- a/modules/costs/app/controllers/cost_types_controller.rb
+++ b/modules/costs/app/controllers/cost_types_controller.rb
@@ -87,7 +87,7 @@ class CostTypesController < ApplicationController
render action: :edit, layout: !request.xhr?
end
- def create
+ def create # rubocop:disable Metrics/AbcSize
@cost_type = CostType.new(permitted_params.cost_type)
if @cost_type.save
diff --git a/modules/costs/app/controllers/hourly_rates_controller.rb b/modules/costs/app/controllers/hourly_rates_controller.rb
index 768bf891d99..50feea32249 100644
--- a/modules/costs/app/controllers/hourly_rates_controller.rb
+++ b/modules/costs/app/controllers/hourly_rates_controller.rb
@@ -57,7 +57,7 @@ class HourlyRatesController < ApplicationController
end
end
- def edit
+ def edit # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity
# TODO: split into edit and update
# remove code where appropriate
if @project
@@ -85,7 +85,7 @@ class HourlyRatesController < ApplicationController
:budgets
end
- def update
+ def update # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity
# TODO: copied over from edit
# remove code where appropriate
if @project
diff --git a/modules/meeting/app/controllers/meeting_contents_controller.rb b/modules/meeting/app/controllers/meeting_contents_controller.rb
index a4c29b88831..ba3657c217b 100644
--- a/modules/meeting/app/controllers/meeting_contents_controller.rb
+++ b/modules/meeting/app/controllers/meeting_contents_controller.rb
@@ -58,7 +58,7 @@ class MeetingContentsController < ApplicationController
render "meeting_contents/show"
end
- def update
+ def update # rubocop:disable Metrics/AbcSize
call = attachable_update_call ::MeetingContents::UpdateService,
model: @content,
args: content_params
diff --git a/modules/two_factor_authentication/app/controllers/two_factor_authentication/users/two_factor_devices_controller.rb b/modules/two_factor_authentication/app/controllers/two_factor_authentication/users/two_factor_devices_controller.rb
index 3f04b5085c2..002d9829033 100644
--- a/modules/two_factor_authentication/app/controllers/two_factor_authentication/users/two_factor_devices_controller.rb
+++ b/modules/two_factor_authentication/app/controllers/two_factor_authentication/users/two_factor_devices_controller.rb
@@ -22,7 +22,7 @@ module ::TwoFactorAuthentication
##
# Register the device and let the user confirm
- def register
+ def register # rubocop:disable Metrics/AbcSize
@device_type = params[:key].to_sym
@device = new_device_type! @device_type
diff --git a/spec/helpers/sort_helper_spec.rb b/spec/helpers/sort_helper_spec.rb
index 322bd6e1109..1c4e9b2ff5f 100644
--- a/spec/helpers/sort_helper_spec.rb
+++ b/spec/helpers/sort_helper_spec.rb
@@ -264,9 +264,9 @@ RSpec.describe SortHelper do
<div class="generic-table--sort-header-outer">
<div class="generic-table--sort-header">
<span>
- <a title="Sort by &quot;Id&quot;"
- data-turbo-stream="true"
- rel="nofollow"
+ <a title="Sort by &quot;Id&quot;"
+ data-turbo-stream="true"
+ rel="nofollow"
target="_top"
href="/work_packages?sort=sort_criteria_params">
Id