Showing 63 of 98 total issues
Method onDoneClicked
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void onDoneClicked()
{
String oldPassword = oldPasswordInput.getText().toString();
String newPassword = newPasswordInput.getText().toString();
String newPasswordConf = newPasswordConfInput.getText().toString();
Method onCreate
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
protected void onCreate(Bundle savedInstanceState) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
Intent startedIntent = getIntent();
Method onCreateView
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
{
View view = inflater.inflate(R.layout.fragment_change_password, container, false);
Method findPostsByKeyword
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
@Nullable
public List<DhtProto.Post> findPostsByKeyword(String keyword)
{
keyword = keyword.toLowerCase(Locale.getDefault());
Method checkPasswords
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static PasswordState checkPasswords(@NonNull String password, @NonNull String passwordConf)
{
if (password.length() == 0 || passwordConf.length() == 0) {
return PasswordState.MISSING;
}
Method dumpKnownPosts
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
@WorkerThread
@NonNull
public List<Pair<String, String>> dumpKnownPosts() {
String[] projection = {
Method getCommentHashes
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
@WorkerThread
public List<String> getCommentHashes(String postHash) {
String[] projection = {
KnownPostsEntry.COLUMN_COMMENT_HASH
Method insertPost
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public String insertPost(DhtProto.Post post)
{
if (post == null) {
return null;
Method handlePeerChanged
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private void handlePeerChanged(MeshManager.RightMeshEvent e) {
// Update peer list.
MeshManager.PeerChangedEvent event = (MeshManager.PeerChangedEvent) e;
- 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 onCreateView
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_view_post, container, false);
activity = getActivity();
- 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 handleMessage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void handleMessage(Message msg) {
switch (msg.what){
case ACTION_VIEW_MESH_SETTINGS:
rightMeshController.showMeshSettings();
- 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 performFiltering
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@Override
protected FilterResults performFiltering(CharSequence charSequence) {
lastFilter = charSequence;
List<DhtProto.Post> filteredList = new ArrayList<>();
- 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 createPost
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static DhtProto.Post createPost(String title, String message, @NonNull DhtProto.User author, @Nullable List<String> tags, boolean anonymous) {
Method entryEquals
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static boolean entryEquals(DhtProto.DhtWrapper a, DhtProto.DhtWrapper b) {
if (a == null && b == null) {
return true;
}
- 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 onUpgrade
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
if(oldVersion < 3){
Migrations.upgradeV3(db);
}
- 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 getPostOrComment
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@Nullable
public DhtProto.DhtWrapper getPostOrComment(String hash) {
List<DhtProto.DhtWrapper> list = hashMap.get(hash);
- 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 sort
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@UiThread
public void sort(SortOption option) {
switch (option) {
case ALPHA_TITLE_ASC:
- 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
Avoid too many return
statements within this method. Open
return;
Method getSync
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@NonNull
public Sync.SyncMessage getSync(MeshId peer, int version) {
// get time last sent data
Sync.SyncMessage.Builder builder = Sync.SyncMessage.newBuilder();
- 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 getPostsByAuthorId
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public List<DhtProto.Post> getPostsByAuthorId(String authorHash) {
List<String> hashes = db.getPostHashes();
DhtProto.Post post;
- 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"