Showing 5 of 35 total issues
File SearchFragment.java
has 289 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
package com.github.sdp.mediato.ui;
import static com.github.sdp.mediato.data.UserDatabase.followUser;
import static com.github.sdp.mediato.data.UserDatabase.getAllUser;
import static com.github.sdp.mediato.data.UserDatabase.unfollowUser;
File ReviewPostListAdapter.java
has 272 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
package com.github.sdp.mediato.utility.adapters;
import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
SearchFragment
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
Open
public class SearchFragment extends Fragment implements View.OnClickListener, SearchView.OnQueryTextListener, UserAdapter.OnUserInteractionListener {
private static String COLLECTION_NAME;
private static String USERNAME;
// Only one instance of the cache should be used
Method onCreateView
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for the search fragment
Method handlePhotoPickerResult
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
private void handlePhotoPickerResult(int resultCode, Intent data) {
if (resultCode == Activity.RESULT_OK && data != null) {
profileImageUri = data.getData();
imageView.setImageURI(profileImageUri);
if (listener != null) {
- 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"