-
Notifications
You must be signed in to change notification settings - Fork 0
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
test 10:11 #12
base: main
Are you sure you want to change the base?
test 10:11 #12
Conversation
* </ul> | ||
* about memory leaks. | ||
*/ | ||
public final class TermuxActivity extends Activity implements ServiceConnection { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.
This class references 65 other classes. By comparison, 99% of the classes in the CodeGuru reference dataset reference fewer. This indicates that this class is highly coupled with other classes. A class that is highly coupled with other classes is difficult to understand and its behavior might change unexpectedly when one of its referenced classes is updated. High coupling could also increase the integration test complexity, maintenance cost and technical debt. We recommend that you simplify this class or break it into multiple classes.
|
||
stackTracesString.append("\n```\n").append(stackTraceStringArray[i]).append("\n```\n"); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.
Similar code fragments were detected in the same file at the following lines: 210:219, 228:237.
Refactoring can help improve code maintainability. Consider reducing duplicate code by extracting it into a separate method. You can then replace duplicated code with calls to this new method.
final ClipboardManager clipboardManager = ContextCompat.getSystemService(context, ClipboardManager.class); | ||
|
||
if (clipboardManager != null) { | ||
clipboardManager.setPrimaryClip(ClipData.newPlainText(null, text)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.
Problem:
This line of code lacks validation when processing input data through the following parameter: 'text' (index: 1 | type: String). The parameter is exposed to external callers, because its enclosing class and method are publicly accessible. This means that upstream validation, if it exists, can be bypassed. Other validated parameters: 'toastString', 'context'. The same parameter type is validated here for example: app/src/main/java/com/termux/app/activities/SettingsActivity.java:52. Malicious, malformed, or unbounded inputs can cause unexpected runtime behavior or crashes, and can slow performance.
Fix:
Add checks to ensure the validity of the parameter's value, such as testing it for nullness (for example, using the @nonnull annotation as described in the Lombok library), emptiness, or equality. Or to prevent direct calls to it, reduce the method's visibility.
Learn more about potential threats and guidance from the Common Weakness Enumeration website and the OWASP Cheat Sheet series.
} | ||
|
||
// https://github.com/steven676/Android-Terminal-Emulator/commit/9a47042620bec87617f0b4f5d50568535668fe26 | ||
public void setChar(int columnToSet, int codePoint, long style) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.
The cyclomatic complexity of this method is 24. By comparison, 99% of the methods in the CodeGuru reference dataset have a lower cyclomatic complexity. This indicates the method has a high number of decisions and it can make the logic difficult to understand and test. We recommend that you simplify this method or break it into multiple methods.
return getCode(keyCode, keyMod, cursorKeysApplication, keypadApplication); | ||
} | ||
|
||
public static String getCode(int keyCode, int keyMode, boolean cursorApp, boolean keypadApplication) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.
This method contains 127 lines of code, not including blank lines or lines with only comments, Java punctuation characters, identifiers, or literals. By comparison, 99% of the methods in the CodeGuru reference dataset contain fewer lines of code. Large methods might be difficult to read and have logic that is hard to understand and test. We recommend that you simplify this method or break it into multiple methods.
} | ||
} | ||
|
||
public void processCodePoint(int b) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.
This method contains 252 lines of code, not including blank lines or lines with only comments, Java punctuation characters, identifiers, or literals. By comparison, 99% of the methods in the CodeGuru reference dataset contain fewer lines of code. Large methods might be difficult to read and have logic that is hard to understand and test. We recommend that you simplify this method or break it into multiple methods.
|
||
final Intent shareTextIntent = new Intent(Intent.ACTION_SEND); | ||
shareTextIntent.setType("text/plain"); | ||
shareTextIntent.putExtra(Intent.EXTRA_SUBJECT, subject); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.
Problem:
This line of code lacks validation when processing input data through the following parameter: 'subject' (index: 1 | type: String). The parameter is exposed to external callers, because its enclosing class and method are publicly accessible. This means that upstream validation, if it exists, can be bypassed. Other validated parameters: 'context'. The same parameter type is validated here for example: app/src/main/java/com/termux/app/activities/SettingsActivity.java:52. Malicious, malformed, or unbounded inputs can cause unexpected runtime behavior or crashes, and can slow performance.
Fix:
Add checks to ensure the validity of the parameter's value, such as testing it for nullness (for example, using the @nonnull annotation as described in the Lombok library), emptiness, or equality. Or to prevent direct calls to it, reduce the method's visibility.
Learn more about potential threats and guidance from the Common Weakness Enumeration website and the OWASP Cheat Sheet series.
} | ||
|
||
@Override | ||
public void updatePosition(TextSelectionHandleView handle, int x, int y) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.
The cyclomatic complexity of this method is 24. By comparison, 99% of the methods in the CodeGuru reference dataset have a lower cyclomatic complexity. This indicates the method has a high number of decisions and it can make the logic difficult to understand and test. We recommend that you simplify this method or break it into multiple methods.
* @return Returns the {@code errmsg} if path is not a regular file, or validating permissions | ||
* failed, otherwise {@code null}. | ||
*/ | ||
public static String validateRegularFileExistenceAndPermissions(@NonNull final Context context, String label, final String filePath, final String parentDirPath, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.
The cyclomatic complexity of this method is 20. By comparison, 99% of the methods in the CodeGuru reference dataset have a lower cyclomatic complexity. This indicates the method has a high number of decisions and it can make the logic difficult to understand and test. We recommend that you simplify this method or break it into multiple methods.
} | ||
|
||
/** Encountering a character in the {@link #ESC} state. */ | ||
private void doEsc(int b) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.
This method contains 79 lines of code, not including blank lines or lines with only comments, Java punctuation characters, identifiers, or literals. By comparison, 99% of the methods in the CodeGuru reference dataset contain fewer lines of code. Large methods might be difficult to read and have logic that is hard to understand and test. We recommend that you simplify this method or break it into multiple methods.
* | ||
* @param codePoint The code point of the character to display | ||
*/ | ||
private void emitCodePoint(int codePoint) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.
This method contains 124 lines of code, not including blank lines or lines with only comments, Java punctuation characters, identifiers, or literals. By comparison, 99% of the methods in the CodeGuru reference dataset contain fewer lines of code. Large methods might be difficult to read and have logic that is hard to understand and test.
We recommend that you simplify this method or break it into multiple methods. For example, consider extracting the code block on lines 2301-2334 into a separate method.
} | ||
|
||
/** Render the terminal to a canvas with at a specified row scroll, and an optional rectangular selection. */ | ||
public final void render(TerminalEmulator mEmulator, Canvas canvas, int topRow, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.
The cyclomatic complexity of this method is 29. By comparison, 99% of the methods in the CodeGuru reference dataset have a lower cyclomatic complexity. This indicates the method has a high number of decisions and it can make the logic difficult to understand and test. We recommend that you simplify this method or break it into multiple methods.
* "-_-" will input the string "-_-" | ||
*/ | ||
@SuppressLint("ClickableViewAccessibility") | ||
public void reload(ExtraKeysInfo infos) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.
The cyclomatic complexity of this method is 28. By comparison, 99% of the methods in the CodeGuru reference dataset have a lower cyclomatic complexity. This indicates the method has a high number of decisions and it can make the logic difficult to understand and test. We recommend that you simplify this method or break it into multiple methods.
} | ||
|
||
/** Select Graphic Rendition (SGR) - see http://en.wikipedia.org/wiki/ANSI_escape_code#graphics. */ | ||
private void selectGraphicRendition() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.
The cyclomatic complexity of this method is 51. By comparison, 99% of the methods in the CodeGuru reference dataset have a lower cyclomatic complexity. This indicates the method has a high number of decisions and it can make the logic difficult to understand and test. We recommend that you simplify this method or break it into multiple methods.
} | ||
|
||
/** Following a CSI - Control Sequence Introducer, "\033[". {@link #ESC_CSI}. */ | ||
private void doCsi(int b) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.
This method contains 253 lines of code, not including blank lines or lines with only comments, Java punctuation characters, identifiers, or literals. By comparison, 99% of the methods in the CodeGuru reference dataset contain fewer lines of code. Large methods might be difficult to read and have logic that is hard to understand and test. We recommend that you simplify this method or break it into multiple methods.
No description provided.