Skip to content

refactor: Refactored to remove hasH2Console boolean flag and replace … #1309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

mscibilia
Copy link
Contributor

@mscibilia mscibilia commented Apr 1, 2020

…it with a check on the H2 console properties/path.

Addressed to #1307

@mscibilia mscibilia requested a review from php-coder as a code owner April 1, 2020 00:27
@mystamps-bot
Copy link

mystamps-bot commented Apr 1, 2020

1 Message
📖 @mscibilia thank you for the PR! All quality checks have been passed! Next step is to wait when @php-coder will review this code

Generated by 🚫 Danger

@mscibilia mscibilia linked an issue Apr 1, 2020 that may be closed by this pull request
@@ -85,7 +84,6 @@ public void onIndexPageWithLocalResources() {
ContentSecurityPolicyHeaderWriter writer = new ContentSecurityPolicyHeaderWriter(
false,
true,
bool(),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everywhere where we used bool(), I suggest to use nullOr(H2_CONSOLE_PATH) to have the similar behavior as before.

Copy link
Owner

@php-coder php-coder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall, just a small improvement.

@php-coder
Copy link
Owner

php-coder commented Apr 1, 2020

PMD complains:

[INFO] --- maven-pmd-plugin:3.12.0:check (default-cli) @ mystamps ---
[INFO] PMD Failure: ru.mystamps.web.support.spring.security.SecurityConfig:95 Rule:ConfusingTernary Priority:3 Avoid if (x != y) ..; else ..;.
[INFO] PMD Failure: ru.mystamps.web.support.spring.security.SecurityConfig:100 Rule:ConfusingTernary Priority:3 Avoid if (x != y) ..; else ..;.

See https://travis-ci.org/github/php-coder/mystamps/jobs/669489779

@mscibilia mscibilia force-pushed the gh1307_Remove-boolean-flag-hasH2Console branch from 86b25fc to f7f8b1d Compare April 1, 2020 12:49

// @todo #226 Introduce app.use-public-hostname property
boolean usePublicHostname = environment.acceptsProfiles("prod");
String hostname = usePublicHostname ? SiteUrl.PUBLIC_URL : SiteUrl.SITE;

String h2ConsolePath = hasH2Console ? h2ConsoleProperties.getPath() : null;
String h2ConsolePath = h2ConsoleProperties == null ? null: h2ConsoleProperties.getPath();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CheckStyle complains on this line:

[ERROR] src/main/java/ru/mystamps/web/support/spring/security/SecurityConfig.java:[95,66] (whitespace) WhitespaceAround: ':' is not preceded with whitespace.

See https://travis-ci.org/github/php-coder/mystamps/jobs/669672924

Everything else looks good. Ping me when it will be ready to be merged.

Copy link
Contributor Author

@mscibilia mscibilia Apr 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@php-coder ping

…it with a check on the H2 console properties/path.

Fix php-coder#1307
@mscibilia mscibilia force-pushed the gh1307_Remove-boolean-flag-hasH2Console branch from f7f8b1d to 6af47d6 Compare April 2, 2020 00:40
Copy link
Owner

@php-coder php-coder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Thank you!

@php-coder php-coder merged commit c4d9e27 into php-coder:master Apr 2, 2020
@php-coder
Copy link
Owner

@mscibilia Thank you again for your contribution! 👍

If you want to work on something else, please, let me know -- you can pick whatever you want and I'll explain in details what is needed or I can select something for you (for example, #603 is simple as it only requires to modify regexp and related tests).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove or replace usage of hasH2Console variable
3 participants