Skip to content

Commit

Permalink
fix backend formatter for annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Dec 9, 2024
1 parent bdaadc5 commit 8ecae6f
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 29 deletions.
2 changes: 1 addition & 1 deletion backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,10 @@
<eclipse>
<version>4.26</version>
<file>${project.basedir}/src/main/resources/formatting.xml</file>
<!-- <file>${project.basedir}/src/main/resources/formatters/Default-2.xml</file>-->
</eclipse>
<removeUnusedImports />
<importOrder />
<formatAnnotations />
</java>
</configuration>
</plugin>
Expand Down
42 changes: 25 additions & 17 deletions backend/src/main/java/ch/puzzle/okr/models/Objective.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package ch.puzzle.okr.models;

import jakarta.persistence.*;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;

import jakarta.validation.constraints.*;
import java.time.LocalDateTime;
import java.util.Objects;

@Entity
@Table(indexes = { @Index(name = "idx_objective_title", columnList = "title") })
@Table(indexes = {@Index(name = "idx_objective_title", columnList = "title")})
public class Objective implements WriteableInterface {
@Id
@GeneratedValue(strategy = GenerationType.AUTO, generator = "sequence_objective")
Expand Down Expand Up @@ -163,30 +160,41 @@ public void setWriteable(boolean writeable) {
@Override
public String toString() {
return "Objective{" + "id=" + id + ", version=" + version + ", title='" + title + '\'' + ", createdBy="
+ createdBy + ", team=" + team + ", quarter=" + quarter + ", description='" + description + '\''
+ ", modifiedOn=" + modifiedOn + ", state=" + state + ", createdOn=" + createdOn + ", modifiedBy="
+ modifiedBy + ", writeable=" + writeable + '\'' + '}';
+ createdBy + ", team=" + team + ", quarter=" + quarter + ", description='" + description + '\''
+ ", modifiedOn=" + modifiedOn + ", state=" + state + ", createdOn=" + createdOn + ", modifiedBy="
+ modifiedBy + ", writeable=" + writeable + '\'' + '}';
}

@Override
public boolean equals(Object o) {
if (this == o)
if (this == o) {
return true;
if (o == null || getClass() != o.getClass())
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Objective objective = (Objective) o;
return Objects.equals(id, objective.id) && version == objective.version
&& Objects.equals(title, objective.title) && Objects.equals(createdBy, objective.createdBy)
&& Objects.equals(team, objective.team) && Objects.equals(quarter, objective.quarter)
&& Objects.equals(description, objective.description)
&& Objects.equals(modifiedOn, objective.modifiedOn) && state == objective.state
&& Objects.equals(createdOn, objective.createdOn) && Objects.equals(modifiedBy, objective.modifiedBy);
&& Objects.equals(title, objective.title) && Objects.equals(createdBy, objective.createdBy)
&& Objects.equals(team, objective.team) && Objects.equals(quarter, objective.quarter)
&& Objects.equals(description, objective.description) && Objects.equals(modifiedOn, objective.modifiedOn)
&& state == objective.state && Objects.equals(createdOn, objective.createdOn)
&& Objects.equals(modifiedBy, objective.modifiedBy);
}

@Override
public int hashCode() {
return Objects.hash(id, version, title, createdBy, team, quarter, description, modifiedOn, state, createdOn,
modifiedBy);
return Objects.hash(id,
version,
title,
createdBy,
team,
quarter,
description,
modifiedOn,
state,
createdOn,
modifiedBy);
}

public static final class Builder {
Expand Down
4 changes: 2 additions & 2 deletions backend/src/main/resources/formatters/Default-2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line" value="one_line_never"/>
Expand Down Expand Up @@ -345,7 +345,7 @@
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_enum_constant" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_annotations" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
Expand Down
12 changes: 6 additions & 6 deletions backend/src/main/resources/formatters/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line" value="one_line_never"/>
Expand All @@ -295,9 +295,9 @@
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="18"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="81"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="81"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="18"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="82"/>
Expand Down Expand Up @@ -343,11 +343,11 @@
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_enum_constant" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field" value="48"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_annotations" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_annotations" value="48"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_module_statements" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="120"/>
Expand Down
23 changes: 20 additions & 3 deletions backend/src/main/resources/formatting.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,29 @@
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="82"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="82"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="82"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>


<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>




<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_enum_constant" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotation_on_method" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_annotations" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter" value="49"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable" value="49"/>



Expand Down

0 comments on commit 8ecae6f

Please sign in to comment.