Skip to content
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

Add needle management #2132

Merged
merged 2 commits into from Jun 21, 2022
Merged

Add needle management #2132

merged 2 commits into from Jun 21, 2022

Conversation

antarus
Copy link
Contributor

@antarus antarus commented Jun 16, 2022

Close #2104

It's a quick first draft

It's a quick first draft
@@ -8,6 +8,7 @@

abstract class JHipsterModuleReplacements {

public static final String LF = "\n";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps use System.getProperty("line.separator") ? or get from project ? instead of "\n"

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should "force" \n as line break everywhere, using something else is always a pain

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok but shouldn't that be set as a project property?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is a mistake to use a property for that since anything else that \n will be a nightmare for the project

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok

Copy link
Member

Choose a reason for hiding this comment

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

yes, there were several discussion about that at the beginning of this project. If we can force the use of \n for Windows too, it would be nice.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we can make an issue to make this on the module part so this will naturally make it's way :)

@codecov
Copy link

codecov bot commented Jun 16, 2022

Codecov Report

Merging #2132 (cc17dee) into main (b6faf90) will not change coverage.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##                main     #2132   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity      2407      2425   +18     
===========================================
  Files            517       521    +4     
  Lines           8886      8929   +43     
  Branches         201       203    +2     
===========================================
+ Hits            8886      8929   +43     
Impacted Files Coverage Δ
...r/lite/generator/module/domain/JHipsterModule.java 100.00% <100.00%> (ø)
...domain/replacement/JHipsterModuleReplacements.java 100.00% <100.00%> (ø)
...generator/module/domain/replacement/JustAfter.java 100.00% <100.00%> (ø)
...enerator/module/domain/replacement/JustBefore.java 100.00% <100.00%> (ø)
...rator/module/domain/replacement/JustLineAfter.java 100.00% <100.00%> (ø)
...ator/module/domain/replacement/JustLineBefore.java 100.00% <100.00%> (ø)
...erator/module/domain/replacement/RegexMatcher.java 100.00% <100.00%> (ø)
...nerator/module/domain/replacement/TextMatcher.java 100.00% <100.00%> (ø)
src/main/webapp/app/common/domain/Service.ts 100.00% <0.00%> (ø)
.../main/webapp/app/common/secondary/RestServiceId.ts 100.00% <0.00%> (ø)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c608cd3...cc17dee. Read the comment docs.

Assert.notNull("element", element);
}
public String updateReplacement(String value) {
return element.searchMatcher().concat(value);
Copy link
Collaborator

Choose a reason for hiding this comment

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

element -> element()

public JustAfter {
Assert.notNull("element", element);
}
public String updateReplacement(String value) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missing line break before method

public JustBefore {
Assert.notNull("element", element);
}
public String updateReplacement(String value) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missing line break before method

Assert.notNull("element", element);
}
public String updateReplacement(String value) {
return value.concat(element.searchMatcher());
Copy link
Collaborator

Choose a reason for hiding this comment

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

element -> element()

Assert.notNull("element", element);
}
public String updateReplacement(String value) {
return element.searchMatcher().concat(value);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Assert.notBlank(value)

@@ -8,6 +8,7 @@

abstract class JHipsterModuleReplacements {

public static final String LF = "\n";
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should "force" \n as line break everywhere, using something else is always a pain

public JustAfter {
Assert.notNull("element", element);
}
public String updateReplacement(String value) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Override

public JustBefore {
Assert.notNull("element", element);
}
public String updateReplacement(String value) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Override

@@ -0,0 +1,7 @@
package tech.jhipster.lite.generator.module.domain.replacement;

interface PositionalMatcher {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it a needle matcher?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not specifically needle, but all matcher.

@antarus antarus marked this pull request as ready for review June 20, 2022 08:44
@DamnClin
Copy link
Collaborator

There are some conversation left open but it's OK for me, @antarus still want to work on this?

@antarus
Copy link
Contributor Author

antarus commented Jun 21, 2022

I Can work on it but i think I made all the requests

@pascalgrimaud pascalgrimaud merged commit 6ca30eb into jhipster:main Jun 21, 2022
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.

Add needle management in modules replacements
3 participants