Showing 97 of 98 total issues
File Database.java
has 986 lines of code (exceeds 250 allowed). Consider refactoring. Open
package ca.marshallasch.veil.database;
import android.content.ContentValues;
import android.content.Context;
import android.content.SharedPreferences;
Method mainUITest
has 175 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Test
public void mainUITest() {
//on the start page click the sign up button
ViewInteraction materialButton = onView(
allOf(withId(R.id.sign_up_btn), withText("Sign Up"),
Database
has 49 methods (exceeds 20 allowed). Consider refactoring. Open
@ThreadSafe
public class Database extends SQLiteOpenHelper
{
private static String DATABASE_NAME = "contentDiscoveryTables";
private static final int DATABASE_VERSION = 10;
File HashTableStore.java
has 396 lines of code (exceeds 250 allowed). Consider refactoring. Open
package ca.marshallasch.veil;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
Method handleDataReceived
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void handleDataReceived(MeshManager.RightMeshEvent e) {
final MeshManager.DataReceivedEvent event = (MeshManager.DataReceivedEvent) e;
Sync.Message message;
try {
Method onCreateView
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
{
Method handleDataReceived
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
private void handleDataReceived(MeshManager.RightMeshEvent e) {
final MeshManager.DataReceivedEvent event = (MeshManager.DataReceivedEvent) e;
Sync.Message message;
try {
- 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 RightMeshController.java
has 283 lines of code (exceeds 250 allowed). Consider refactoring. Open
package ca.marshallasch.veil.controllers;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
Similar blocks of code found in 2 locations. Consider refactoring. Open
@WorkerThread
public double getFastestTime(@IntRange(from = 0, to = 3) int protocolVersion) {
String selection = SyncStatsEntry.COLUMN_MESSAGE_TYPE + " = ? AND " +
SyncStatsEntry.COLUMN_TIMESTAMP_RECEIVED + " not NULL";
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 146.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
@WorkerThread
public double getSlowestTime(@IntRange(from = 0, to = 3) int protocolVersion) {
String selection = SyncStatsEntry.COLUMN_MESSAGE_TYPE + " = ? AND " +
SyncStatsEntry.COLUMN_TIMESTAMP_RECEIVED + " not NULL";
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 146.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
DataStore
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
public class DataStore
{
private final Database db;
private final HashTableStore hashTableStore;
Similar blocks of code found in 2 locations. Consider refactoring. Open
@Override
@Nullable
public DhtProto.Comment findCommentByHash(String hash) throws TooManyResultsException
{
ArrayList<DhtProto.DhtWrapper> entries;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 134.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
@Override
@Nullable
public DhtProto.Post findPostByHash(String hash) throws TooManyResultsException
{
ArrayList<DhtProto.DhtWrapper> entries;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 134.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method upgradeV10
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
static void upgradeV10(SQLiteDatabase db){
class KnownPostObject{
private String postHash;
private String commentHash;
Method onCreateView
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
Method onCreateView
has 49 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_sync_stats, container, false);
Method onCreateView
has 49 lines of code (exceeds 25 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();
Method onCreateView
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
@SuppressLint("ClickableViewAccessibility") // added to remove the linter warning on the setOnTouchListener{line 46}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
Method onCreateView
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_add_comment, container, false);
Activity activity = getActivity();
Method onCreateView
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
{
Activity activity = getActivity();