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

Terasology engine #5192

Merged
merged 12 commits into from
Dec 24, 2023
Merged

Terasology engine #5192

merged 12 commits into from
Dec 24, 2023

Conversation

soloturn
Copy link
Contributor

@soloturn soloturn commented Dec 6, 2023

inttelij, checkstyle, pmd warnings removed:

  • case of constants
  • line length
  • make fields final
  • remove unnecessary toString()
  • ordering of declarations
  • unused fields
  • simplify conditions

@soloturn
Copy link
Contributor Author

soloturn commented Dec 7, 2023

is there a way to retrigger the jenkins build, apart from force pushing?

@BenjaminAmos
Copy link
Contributor

Under the checks tab on GitHub you should be able to re-run the tests if they fail. That appears to trigger a Jenkins re-run, as of recently (give https://github.com/MovingBlocks/Terasology/pull/5188/checks?check_run_id=19397149388 a try, for example). Some of the core contributors can force retrigger a build from the Jenkins UI but this relies on being added to a manual whitelist in the Logistics repository right now. If you're on that list then you can sign-in to Jenkins with your GitHub account to do that.

@soloturn
Copy link
Contributor Author

soloturn commented Dec 8, 2023

ok now checks are green. @BenjaminAmos @jdrueckert you mind merging?

@jdrueckert
Copy link
Member

Under the checks tab on GitHub you should be able to re-run the tests if they fail. That appears to trigger a Jenkins re-run, as of recently (give https://github.com/MovingBlocks/Terasology/pull/5188/checks?check_run_id=19397149388 a try, for example). Some of the core contributors can force retrigger a build from the Jenkins UI but this relies on being added to a manual whitelist in the Logistics repository right now. If you're on that list then you can sign-in to Jenkins with your GitHub account to do that.

Alternatively, instead of force pushing, you can create an empty commit using the allow-empty parameter for git commit.

Comment on lines 37 to 46
/**
* The mono 16 bit format
*/
private static final int FORMAT_MONO16 = 1;

/**
* The stereo 16 bit format
*/
private static final int FORMAT_STEREO16 = 2;

Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you remove these constants? They still appear to be relevant. It may be unused now but it could have been useful in the future.

Comment on lines 419 to 420
convbuffer[ptr + 0] = (byte) (bigEndian ? val >>> 8 : val);
convbuffer[ptr + 1] = (byte) (bigEndian ? val : val >>> 8);
CONVBUFFER[ptr] = (byte) (bigEndian ? val >>> 8 : val);
CONVBUFFER[ptr + 1] = (byte) (bigEndian ? val : val >>> 8);
Copy link
Contributor

Choose a reason for hiding this comment

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

In this case, the ptr + 0 may have been for clarity. It helps to keep the lines in alignment.

private String join(String[] words, String sep) {
return Arrays.stream(words).collect(joining(sep));
private String join(String[] words) {
return String.join(" ", words);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

If you're going to change the purpose of the method, you might as well re-name it too. joinWithWhitespace seems more appropriate now than just a generic join.

if (hibernationSettings.isPresent()) {
hibernationSettings.get().setHibernationAllowed(false);
}
hibernationSettings.ifPresent(hibernationManager -> hibernationManager.setHibernationAllowed(false));
Copy link
Contributor

Choose a reason for hiding this comment

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

Using functional methods, whilst more concise, have in the past caused performance issues. Streams and List#forEach were particularly poor in comparison to a for-each loop, Since this is in network code, I am slightly concerned about the potential impact here.

@@ -448,7 +444,7 @@ public void registerNetworkEntity(EntityRef entity) {
netComponent.setNetworkId(nextNetId++);
entity.saveComponent(netComponent);
netIdToEntityId.put(netComponent.getNetworkId(), entity.getId());
switch (netComponent.replicateMode) {
switch (java.util.Objects.requireNonNull(netComponent.replicateMode)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason why this is fully-qualified? Usually you'd add an import for this, unless the name conflicts with another imported class.

Comment on lines 71 to 72
/** unused since Linux 2.6 */
LIB(4),
/** data + stack */
DATA(5),
/** unused since Linux 2.6 */
DT(6);
DATA(5);
Copy link
Contributor

Choose a reason for hiding this comment

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

I know that this says unused but as an enum the order of members matters. Removing enum members will re-order the existing ones, which might cause them to have the wrong ordinal values. It's quite normal for structs mapping low-level OS fields to contain "unused" or obsolete values. It's to maintain ABI compatibility.

@soloturn
Copy link
Contributor Author

apart from one, reverted as mentioned in your review @BenjaminAmos .

@soloturn
Copy link
Contributor Author

@BenjaminAmos i did your requested change, but still it shows "change requested". it means you need to close this?

Comment on lines -37 to +41
if (!nuiManager.isOpen("engine:console") && message.getType() != CoreMessageType.CHAT
&& message.getType() != CoreMessageType.NOTIFICATION || !nuiManager.isOpen("engine:chat")) {
// make sure the message isn't already shown in the chat overlay
// make sure the message isn't already shown in the chat overlay
if (!nuiManager.isOpen("engine:console")
&& (message.getType() != CoreMessageType.CHAT
&& message.getType() != CoreMessageType.NOTIFICATION
|| !nuiManager.isOpen("engine:chat"))) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a difficult condition to parse. I think you have rearranged it correctly but if a bug appears in this area then we might have to re-visit it.

checkstyle and pmd warnings handled. drop the whole class as it seems not to be used?
fix checkstyle and pmd warnings.
fix checkstyle, pmd warnings.
fix checkstyle, pmd warnings.
fix checkstyle, pmd warnings, like "unchecked assignment" of TeraArray.Factory<? extends TeraArray>[] slotFactories;
fix checkstyle, pmd warnings.
fix checkstyle, pmd warnings.
fix checkstyle, pmd warnings.
@soloturn soloturn merged commit 14937d2 into MovingBlocks:develop Dec 24, 2023
9 checks passed
@soloturn soloturn deleted the terasology-engine branch December 24, 2023 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants