Showing 635 of 1,693 total issues
Function constructor
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor() {
jQuery('costs-subform').each((i, match) => {
const el = jQuery(match);
const container = el.find('.subform-container');
Function handleUploadError
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private handleUploadError(error:HttpErrorResponse, fileName:string):void {
if (error.status === 500 && (error.error as IHalErrorBase).errorIdentifier === v3ErrorIdentifierMissingEnterpriseToken) {
this.toastService.addError(error);
return;
}
Function buildItems
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected buildItems(permittedActions:WorkPackageAction[]):OpContextMenuItem[] {
const configureFormLink = this.workPackage.configureForm;
this.items = permittedActions.map((action:WorkPackageAction) => {
const { key } = action;
Function render
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public render(element:HTMLElement, displayText:string):void {
if (!this.value) {
return;
}
Function submit
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public async submit():Promise<T> {
if (this.change.isEmpty() && !isNewResource(this.resource)) {
this.closeEditFields();
return Promise.resolve(this.resource);
}
Function selectNextResult
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private selectNextResult(activeID:ID|null, allProjects:IProjectData[]):void {
if (activeID === null) {
return;
}
Function create
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public async create(
wrapper:HTMLElement,
context:ICKEditorContext,
initialData:string|null = null,
):Promise<ICKEditorWatchdog> {
Function ngOnInit
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ngOnInit() {
this.polling$ = merge(
timer(10, this.interval).pipe(filter(() => this.activeWindow.isActive)),
timer(10, this.interval * 10).pipe(filter(() => !this.activeWindow.isActive)),
)
Function checkForNewNotifications
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@EffectCallback(notificationCountIncreased)
private checkForNewNotifications() {
this.onReload.pipe(take(1)).subscribe((collection) => {
const { activeCollection } = this.query.getValue();
const hasNewNotifications = !collection.ids.reduce(
Function handleUserSubmit
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public async handleUserSubmit():Promise<unknown> {
if (this.inFlight || !this.rawComment) {
return Promise.resolve();
}
Function ngAfterViewInit
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ngAfterViewInit() {
this.$element = jQuery(this.elementRef.nativeElement);
const scrollBar = document.querySelector('.work-packages-tabletimeline--timeline-side');
if (scrollBar) {
Function onValidatedSubmit
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
onValidatedSubmit():void {
if (this.principalForm.invalid) {
return;
}
Function buildGroupRow
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public buildGroupRow(group:GroupObject, colspan:number) {
const row = document.createElement('tr');
let togglerIconClass; let
text;
Function setLinksAsProperties
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function setLinksAsProperties() {
halResource.$linkableKeys().forEach((linkName:string) => {
OpenprojectHalModuleHelpers.lazy(halResource, linkName,
() => {
const link:any = halResource.$links[linkName].$link || halResource.$links[linkName];
Function bootstrapAttributeGroups
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static bootstrapAttributeGroups(injector:Injector):void {
if (this.bootstrapAttributeGroupsCalled) {
return;
}
Function getAllowedRelationActions
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private getAllowedRelationActions(workPackage:WorkPackageResource, allowSplitScreenActions:boolean) {
const allowedActions:WorkPackageAction[] = [];
if (!!workPackage.addRelation && this.wpViewTimeline.isVisible) {
allowedActions.push({
Function handleEvent
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public handleEvent(view:TableEventComponent, evt:JQuery.TriggeredEvent) {
const target = jQuery(evt.target);
// Ignore links
if (target.is('a') || target.parent().is('a')) {
Function listParamsString
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function listParamsString(params?:ApiV3ListParameters):string {
const queryProps = [];
if (params && params.sortBy) {
queryProps.push(`sortBy=${JSON.stringify(params.sortBy)}`);
Method set_colors
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
def set_colors
return unless params[:colors]
# reset all colors if a new theme is set
if params[:theme].present?
- Read upRead up
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 modify_joins
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
def modify_joins(arel)
arel.instance_variable_get(:@ast).instance_variable_get(:@cores).each do |core|
core.instance_variable_get(:@source).right.each do |node|
if node.kind_of? Arel::Nodes::StringJoin
gsub_table_names_in_sql_string!(node.left)
- Read upRead up
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"