app/src/main/java/com/sdp/movemeet/view/map/MainMapFragment.java
File MainMapFragment.java
has 253 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
package com.sdp.movemeet.view.map;
import android.content.Intent;
import android.location.Location;
import android.os.Build;
Method chooseIcon
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
public int chooseIcon(Activity activity) {
switch (activity.getSport()) {
case Soccer:
return R.drawable.icon_soccer;
Method onCreateView
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@RequiresApi(api = Build.VERSION_CODES.N)
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_map, container, false);
Method onMarkerClick
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
@Override
public boolean onMarkerClick(final Marker marker) {
//If user accidently touches the marker instead of the infowindow, act like he clicked on the infowindow
if (marker.getTag().equals("new activity position")) onInfoWindowClick(marker);
else if (!marker.getTag().equals("my position")) {
- 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"