Skip to content

Commit

Permalink
Prettier: fix warnings on generated app
Browse files Browse the repository at this point in the history
  • Loading branch information
qmonmert committed Jul 14, 2024
1 parent aa04692 commit b16e688
Show file tree
Hide file tree
Showing 151 changed files with 465 additions and 531 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
],
"prHourlyLimit": 20,
"docker-compose": {
"fileMatch": [
"^src/main/docker/[^/]*\\.ya?ml$"
]
"fileMatch": ["^src/main/docker/[^/]*\\.ya?ml$"]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,7 @@ describe('axiosHttp', () => {
axiosInstance.put.resolves(responseResult());
const axiosHttp = new AxiosHttp(axiosInstance);
const result = await axiosHttp.put<Result, Payload>(
'/uri',
fakePayload(),
);
const result = await axiosHttp.put<Result, Payload>('/uri', fakePayload());
const [uri, payload] = axiosInstance.put.getCall(0).args;
expect(payload).toEqual<Payload>(fakePayload());
Expand All @@ -99,10 +96,7 @@ describe('axiosHttp', () => {
axiosInstance.post.resolves(responseResult());
const axiosHttp = new AxiosHttp(axiosInstance);
const result = await axiosHttp.post<Result, Payload>(
'/uri',
fakePayload(),
);
const result = await axiosHttp.post<Result, Payload>('/uri', fakePayload());
const [uri, payload] = axiosInstance.post.getCall(0).args;
expect(payload).toEqual<Payload>(fakePayload());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ export default defineConfig({
'@': path.resolve(__dirname, './src/main/webapp/app'),
},
},
plugins: [
vue(),
],
plugins: [vue()],
build: {
outDir: '../../../{{projectBuildDirectory}}/classes/static',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@ export default defineConfig({
autoUpdate: true,
100: true,
},
exclude: ['src/main/webapp/**/*.component.ts', 'src/main/webapp/app/main.ts', '.eslintrc.cjs', '.lintstagedrc.cjs', 'src/test/**/*', '{{projectBuildDirectory}}/**'],
exclude: [
'src/main/webapp/**/*.component.ts',
'src/main/webapp/app/main.ts',
'.eslintrc.cjs',
'.lintstagedrc.cjs',
'src/test/**/*',
'{{projectBuildDirectory}}/**',
],
provider: 'istanbul',
reportsDirectory: '{{projectBuildDirectory}}/test-results/',
reporter: ['html', 'json-summary', 'text', 'text-summary', 'lcov', 'clover'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,11 @@ export class AxiosHttp {
return this.axiosInstance.get<Result>(uri, config);
}

async put<Result, Payload = never>(
uri: string,
data?: Payload,
): Promise<AxiosResponse<Result>> {
async put<Result, Payload = never>(uri: string, data?: Payload): Promise<AxiosResponse<Result>> {
return this.axiosInstance.put<Result>(uri, data);
}

async post<Result, Payload = never>(
uri: string,
data?: Payload,
config?: AxiosRequestConfig,
): Promise<AxiosResponse<Result>> {
async post<Result, Payload = never>(uri: string, data?: Payload, config?: AxiosRequestConfig): Promise<AxiosResponse<Result>> {
return this.axiosInstance.post<Result>(uri, data, config);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/generator/prettier/.prettierrc.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ printWidth: 140
singleQuote: true
tabWidth: {{indentSize}}
useTabs: false
endOfLine: "{{endOfLine}}"
endOfLine: '{{endOfLine}}'

plugins:
- '@prettier/plugin-xml'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class AnnotationArchTest {
.and(not(equivalentTo(ComponentTest.class))))
)
);
//@formatter:on
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@ class HexagonalArchTest {
// the empty package is related to: https://github.com/TNG/ArchUnit/issues/191#issuecomment-507964792
private static final Collection<String> vanillaPackages = List.of("java..", "");
private static final Collection<String> commonToolsAndUtilsPackages = List.of(
"org.apache.commons..",
"org.jmolecules..",
"org.slf4j.."
);
private static final Collection<String> commonToolsAndUtilsPackages = List.of("org.apache.commons..", "org.jmolecules..", "org.slf4j..");
private static Collection<String> buildPackagesPatterns(Collection<String> packages) {
return packages.stream().map(path -> path + "..").toList();
Expand Down Expand Up @@ -93,27 +89,23 @@ class HexagonalArchTest {
@Test
void shouldNotDependOnOtherBoundedContextDomains() {
Stream
.concat(businessContexts.stream(), sharedKernels.stream())
.forEach(context -> {
noClasses()
.that()
.resideInAnyPackage(context + "..")
.should()
.dependOnClassesThat()
.resideInAnyPackage(otherBusinessContextsDomains(context))
.because("Contexts can only depend on classes in the same context or shared kernels")
.check(classes);
});
Stream.concat(businessContexts.stream(), sharedKernels.stream()).forEach(context -> {
noClasses()
.that()
.resideInAnyPackage(context + "..")
.should()
.dependOnClassesThat()
.resideInAnyPackage(otherBusinessContextsDomains(context))
.because("Contexts can only depend on classes in the same context or shared kernels")
.check(classes);
});
}

@Test
void shouldBeAnHexagonalArchitecture() {
Stream
.concat(businessContexts.stream(), sharedKernels.stream())
.forEach(context ->
Architectures
.layeredArchitecture()
Stream.concat(businessContexts.stream(), sharedKernels.stream()).forEach(
context ->
Architectures.layeredArchitecture()
.consideringOnlyDependenciesInAnyPackage(context + "..")
.withOptionalLayers(true)
.layer("domain models")
Expand All @@ -134,7 +126,7 @@ class HexagonalArchTest {
.mayNotBeAccessedByAnyLayer()
.because("Each bounded context should implement an hexagonal architecture")
.check(classes)
);
);
}

@Test
Expand Down Expand Up @@ -176,8 +168,7 @@ class HexagonalArchTest {
}

private String[] authorizedDomainPackages() {
return Stream
.of(List.of("..domain.."), vanillaPackages, commonToolsAndUtilsPackages, sharedKernelsPackages)
return Stream.of(List.of("..domain.."), vanillaPackages, commonToolsAndUtilsPackages, sharedKernelsPackages)
.flatMap(Collection::stream)
.toArray(String[]::new);
}
Expand Down Expand Up @@ -237,18 +228,16 @@ class HexagonalArchTest {

@Test
void shouldNotDependOnSameContextPrimary() {
Stream
.concat(businessContexts.stream(), sharedKernels.stream())
.forEach(context -> {
noClasses()
.that()
.resideInAPackage(context + ".infrastructure.secondary..")
.should()
.dependOnClassesThat()
.resideInAPackage(context + ".infrastructure.primary")
.because("Secondary should not loop to its own context's primary")
.check(classes);
});
Stream.concat(businessContexts.stream(), sharedKernels.stream()).forEach(context -> {
noClasses()
.that()
.resideInAPackage(context + ".infrastructure.secondary..")
.should()
.dependOnClassesThat()
.resideInAPackage(context + ".infrastructure.primary")
.because("Secondary should not loop to its own context's primary")
.check(classes);
});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@

This application comes with two package level annotations:

* `SharedKernel` used to mark packages containing classes shared between multiple contexts;
* `BusinessContext` used to mark packages containing classes to answer a specific business need. Classes in this package can't be used in another package.
- `SharedKernel` used to mark packages containing classes shared between multiple contexts;
- `BusinessContext` used to mark packages containing classes to answer a specific business need. Classes in this package can't be used in another package.

To mark a package, you have to add a `package-info.java` file at the package root with:

```java
@{{basePackage}}.SharedKernel
package {{packageName}};

```

or:

```java
@{{basePackage}}.BusinessContext
package {{packageName}};

```
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package {{packageName}}.shared.collection.domain;

import static org.assertj.core.api.Assertions.*;

import {{packageName}}.UnitTest;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
Expand All @@ -13,6 +12,7 @@ import java.util.Set;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import {{packageName}}.UnitTest;

@UnitTest
class {{ baseName }}CollectionsTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package {{packageName}}.shared.error.domain;

import static org.assertj.core.api.Assertions.*;

import {{packageName}}.UnitTest;
import java.math.BigDecimal;
import java.time.Instant;
import java.util.Arrays;
Expand All @@ -14,6 +13,7 @@ import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import {{packageName}}.UnitTest;

@UnitTest
class AssertTest {
Expand Down Expand Up @@ -1015,7 +1015,9 @@ class AssertTest {
@ParameterizedTest
@ValueSource(ints = { 3, 4 })
void shouldValidateCollectionWithSizeUnderMaxSize(int maxSize) {
assertThatCode(() -> Assert.field(FIELD_NAME, List.of("value1", "value2", "value3")).maxSize(maxSize)).doesNotThrowAnyException();
assertThatCode(
() -> Assert.field(FIELD_NAME, new String[] { "value1", "value2", "value3" }).maxSize(maxSize)
).doesNotThrowAnyException();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package {{packageName}}.shared.error.domain;

import static org.assertj.core.api.Assertions.*;

import {{packageName}}.UnitTest;
import org.junit.jupiter.api.Test;
import {{packageName}}.UnitTest;

@UnitTest
class MissingMandatoryValueExceptionTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package {{packageName}}.shared.error.domain;

import static org.assertj.core.api.Assertions.assertThat;

import {{packageName}}.UnitTest;
import java.time.Instant;
import org.junit.jupiter.api.Test;
import {{packageName}}.UnitTest;

@UnitTest
class NotAfterTimeExceptionTest {
Expand All @@ -26,8 +26,9 @@ class NotAfterTimeExceptionTest {
NotAfterTimeException exception = NotAfterTimeException.strictlyNotAfter().value(VALUE).field(FIELD).other(OTHER);
assertDefaultInformation(exception);
assertThat(exception.getMessage())
.isEqualTo("Time 1970-01-01T00:22:17Z in \"myField\" must be strictly after 2024-02-21T21:00:00Z but wasn't");
assertThat(exception.getMessage()).isEqualTo(
"Time 1970-01-01T00:22:17Z in \"myField\" must be strictly after 2024-02-21T21:00:00Z but wasn't"
);
}

private void assertDefaultInformation(NotAfterTimeException exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package {{packageName}}.shared.error.domain;

import static org.assertj.core.api.Assertions.assertThat;

import {{packageName}}.UnitTest;
import java.time.Instant;
import org.junit.jupiter.api.Test;
import {{packageName}}.UnitTest;

@UnitTest
class NotBeforeTimeExceptionTest {
Expand All @@ -22,15 +22,15 @@ class NotBeforeTimeExceptionTest {

@Test
void shouldGetNotStrictlyAfterExceptionInformation() {
NotBeforeTimeException exception = NotBeforeTimeException
.strictlyNotBefore()
NotBeforeTimeException exception = NotBeforeTimeException.strictlyNotBefore()
.value(VALUE)
.field(FIELD)
.other(Instant.ofEpochSecond(1337));
assertDefaultInformation(exception);
assertThat(exception.getMessage())
.isEqualTo("Time 2024-02-21T21:00:00Z in \"myField\" must be strictly before 1970-01-01T00:22:17Z but wasn't");
assertThat(exception.getMessage()).isEqualTo(
"Time 2024-02-21T21:00:00Z in \"myField\" must be strictly before 1970-01-01T00:22:17Z but wasn't"
);
}

private void assertDefaultInformation(NotBeforeTimeException exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package {{packageName}}.shared.error.domain;

import static org.assertj.core.api.Assertions.*;

import {{packageName}}.UnitTest;
import org.junit.jupiter.api.Test;
import {{packageName}}.UnitTest;

@UnitTest
class NullElementInCollectionExceptionTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package {{packageName}}.shared.error.domain;

import static org.assertj.core.api.Assertions.*;

import {{packageName}}.UnitTest;
import org.junit.jupiter.api.Test;
import {{packageName}}.UnitTest;

@UnitTest
class NumberValueTooHighExceptionTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package {{packageName}}.shared.error.domain;

import static org.assertj.core.api.Assertions.*;

import {{packageName}}.UnitTest;
import org.junit.jupiter.api.Test;
import {{packageName}}.UnitTest;

@UnitTest
class NumberValueTooLowExceptionTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package {{packageName}}.shared.error.domain;

import static org.assertj.core.api.Assertions.*;

import {{packageName}}.UnitTest;
import org.junit.jupiter.api.Test;
import {{packageName}}.UnitTest;

@UnitTest
class StringTooLongExceptionTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package {{packageName}}.shared.error.domain;

import static org.assertj.core.api.Assertions.*;

import {{packageName}}.UnitTest;
import org.junit.jupiter.api.Test;
import {{packageName}}.UnitTest;

@UnitTest
class StringTooShortExceptionTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package {{packageName}}.shared.error.domain;

import static org.assertj.core.api.Assertions.*;

import {{packageName}}.UnitTest;
import org.junit.jupiter.api.Test;
import {{packageName}}.UnitTest;

@UnitTest
class TooManyElementsExceptionTest {
Expand Down
Loading

0 comments on commit b16e688

Please sign in to comment.