Showing 666 of 666 total issues
Method getPathFromFile
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
@NonNull
private String getPathFromFile(@NonNull final Uri uri) {
logger.info("Parsing path:" + Arrays.toString(uri.getPathSegments().toArray()));
validatePathIsAccessible(uri);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method setUp
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Before
@CallSuper
public void setUp() {
final String methodName = Thread.currentThread().getStackTrace()[2].getMethodName();
logger.info(methodName + ": " + this.testName.getMethodName());
Method perform
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void perform(@NonNull final UiController uiController, @NonNull final View view) {
final String methodName = Thread.currentThread().getStackTrace()[2].getMethodName();
logger.info(methodName);
Method renderScene
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
synchronized void renderScene(@NonNull final Config config) {
logger.info(ConstantsMethods.RENDER_SCENE);
MainActivity.resetErrno();
stopDrawing();
Method initializePickerResolutions
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void initializePickerResolutions(final int pickerSizes) {
logger.info("initializePickerResolutions start");
final int maxSizes = 9;
this.pickerResolutions.setMinValue(1);
this.pickerResolutions.setMaxValue(maxSizes - 1);
Method setupRenderer
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void setupRenderer(final TextView textView, final Button renderButton) {
logger.info("setupRenderer start");
this.drawView.setVisibility(View.INVISIBLE);
this.drawView.setEGLContextClientVersion(MyEglContextFactory.EGL_CONTEXT_CLIENT_VERSION);
Method loadShader
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
@VisibleForTesting
public static int loadShader(final int shaderType,
@NonNull final String source) {
logger.info("loadShader");
final int shader = UtilsGL.run(() -> GLES20.glCreateShader(shaderType));
Method getPathFromFile
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
@NonNull
private String getPathFromFile(@NonNull final Uri uri) {
logger.info("Parsing path:" + Arrays.toString(uri.getPathSegments().toArray()));
validatePathIsAccessible(uri);
Method createConfigFromUI
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
@NonNull
private Config createConfigFromUI(@NonNull final String scenePath) {
final Pair<Integer, Integer> resolution =
Utils.getResolutionFromPicker(this.pickerResolutions);
Method readFile
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void readFile(@NonNull final Uri uri) {
logger.info("readFile");
final List<String> allowedPaths = List.of(UtilsContext.getSdCardPath(this), UtilsContext.getInternalStoragePath(this));
final boolean isAllowedPath;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
Method setUpAll
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
@BeforeClass
@CallSuper
public static void setUpAll() {
final String methodName = Thread.currentThread().getStackTrace()[2].getMethodName();
logger.info(methodName);
Method getSdCardPath
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
@NonNull
public static String getSdCardPath(@NonNull final Context context) {
logger.info("Getting SD card path.");
// The new method to get the SD card path.
Method computeTestMethods
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
protected List<FrameworkMethod> computeTestMethods() {
logger.info("Sorting tests execution order.");
final List<FrameworkMethod> originalTestsOrder = super.computeTestMethods();
final List<FrameworkMethod> orderedTests = new ArrayList<>(originalTestsOrder);
Method grantPermissions
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static void grantPermissions() {
InstrumentationRegistry.getInstrumentation().waitForIdleSync();
Espresso.onIdle();
logger.info("Granting permissions to the MainActivity to be able to read files from an external storage.");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
Method createAndGetIndexOfShader
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private int createAndGetIndexOfShader(final String shaderCode, final int shaderType)
throws InterruptedException {
final DrawView drawView = UtilsT.getPrivateField(activity, "drawView");
Preconditions.checkNotNull(drawView, "drawView shouldn't be null");
Method isPathReadable
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static boolean isPathReadable(final File file) {
final boolean readable = file.setReadable(true);
if (!file.canRead() && !readable) {
final File parentFile = file.getParentFile();
if (parentFile == null) {
Method onDrawFrame
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void onDrawFrame(@NonNull final GL10 gl) {
logger.info("onDrawFrame");
// Reset OpenGL frame buffer before drawing the new frame.
Method assertRenderScene
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
protected void assertRenderScene(final Scene scene,
final Shader shader,
final Accelerator accelerator,
final int spp,
final int spl,
Method cleanStoragePath
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@NonNull
public static String cleanStoragePath(@NonNull final String storagePath) {
String storagePathCleaned = storagePath;
// Remove Android path
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method isActivityRunning
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@SuppressWarnings({"deprecation"})
private static boolean isActivityRunning(@NonNull final Activity activity) {
// Note that 'Activity#isDestroyed' only exists on Android API 17+.
// More info: https://developer.android.com/reference/android/app/Activity#isDestroyed()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"