app/src/main/java/ch/epfl/culturequest/ui/map/MapsFragment.java
Method getDeviceLocation
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
Open
private void getDeviceLocation() {
/*
* Get the best and most recent location of the device, which may be null in rare
* cases when a location is not available.
*/
- 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
File MapsFragment.java
has 297 lines of code (exceeds 250 allowed). Consider refactoring. Wontfix
Wontfix
package ch.epfl.culturequest.ui.map;
import android.Manifest;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
Method onLocationResult
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
Open
@Override
public void onLocationResult(@NonNull LocationResult result) {
super.onLocationResult(result);
if (result != null) {
for (Location location : result.getLocations()) {
- 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 getDeviceLocation
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Wontfix
Wontfix
private void getDeviceLocation() {
/*
* Get the best and most recent location of the device, which may be null in rare
* cases when a location is not available.
*/
Method getMarkers
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Wontfix
Wontfix
private void getMarkers(LatLng latestLocation) {
CompletableFuture<List<OTMLocation>> places;
float distance[] = new float[1];
if (viewModel.getCenterOfLocations() == null) {
viewModel.setCenterOfLocations(latestLocation); // Just put a default value, this should only happen at the beginning