MarshallAsch/veil-droid

View on GitHub

Showing 97 of 98 total issues

Method findPostsByKeyword has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    @Nullable
    public List<DhtProto.Post> findPostsByKeyword(String keyword)
    {
        keyword = keyword.toLowerCase(Locale.getDefault());
Severity: Minor
Found in app/src/main/java/ca/marshallasch/veil/HashTableStore.java - About 1 hr to fix

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 getAllHashesByStatus has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @WorkerThread
    public List<String> getAllHashesByStatus(int status){
        String[] projection = {
                KnownPostsEntry.COLUMN_POST_HASH,
                KnownPostsEntry.COLUMN_COMMENT_HASH};
Severity: Minor
Found in app/src/main/java/ca/marshallasch/veil/database/Database.java - About 1 hr to fix

    Method findCommentsByPost has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Deprecated
        @Override
        @NonNull
        public List<DhtProto.Comment> findCommentsByPost(String postHash)
        {
    Severity: Minor
    Found in app/src/main/java/ca/marshallasch/veil/HashTableStore.java - About 1 hr to fix

      Method dumpKnownPosts has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @WorkerThread
          @NonNull
          public List<Pair<String, String>> dumpKnownPosts(@Nullable Date since) {
      
              List<Pair<String, String>> hashes = new ArrayList<>();
      Severity: Minor
      Found in app/src/main/java/ca/marshallasch/veil/database/Database.java - About 1 hr to fix

        Method getSync has 30 lines of code (exceeds 25 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();
        Severity: Minor
        Found in app/src/main/java/ca/marshallasch/veil/DataStore.java - About 1 hr to fix

          Method findUsersByName has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @Override
              @Nullable
              public List<Pair<String, DhtProto.User>> findUsersByName(String name)
              {
                  if (name == null) {
          Severity: Minor
          Found in app/src/main/java/ca/marshallasch/veil/HashTableStore.java - About 1 hr to fix

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                    try {
                        if (bundle != null) {
                            currentUser = DhtProto.User.parseFrom(bundle.getByteArray(getString(R.string.user_object_key)));
                        } else if (savedInstanceState != null) {
                            currentUser = DhtProto.User.parseFrom(savedInstanceState.getByteArray(getString(R.string.user_object_key)));
            app/src/main/java/ca/marshallasch/veil/FragmentAddComment.java on lines 55..65

            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 82.

            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

            Further Reading

            Method upgradeV6 has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                static void upgradeV6(SQLiteDatabase db){
            
                    // need to get the old values from the table
                    List<Pair<String, String>> knownPosts = new ArrayList<>();
            
            
            Severity: Minor
            Found in app/src/main/java/ca/marshallasch/veil/database/Migrations.java - About 1 hr to fix

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                      try {
              
                          if(bundle != null){
                              postObject = DhtProto.Post.parseFrom(bundle.getByteArray(getString(R.string.post_object_key)));
                          }
              app/src/main/java/ca/marshallasch/veil/FragmentChangePassword.java on lines 52..61

              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 82.

              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

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  public static final String SQL_CREATE_USERS = "CREATE TABLE " + UserEntry.TABLE_NAME +
                          "(" +
                          UserEntry._ID + " INTEGER PRIMARY KEY," +
                          UserEntry.COLUMN_ID + " VARCHAR(36) UNIQUE," +
                          UserEntry.COLUMN_FIRST_NAME + " VARCHAR," +
              app/src/main/java/ca/marshallasch/veil/database/SyncStatsContract.java on lines 17..24

              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 82.

              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

              Further Reading

              Method getCustomView has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private View getCustomView(int position, @Nullable View convertView, @NonNull ViewGroup parent)
                  {
                      ListState data = tagList.get(position);
              
                      ViewHolder holder;
              Severity: Minor
              Found in app/src/main/java/ca/marshallasch/veil/tagList/TagListAdapter.java - About 1 hr to fix

                Method onDoneClicked has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private void onDoneClicked()
                    {
                        String firstName = firstNameInput.getText().toString();
                        String lastName = lastNameInput.getText().toString();
                        String email = emailAddressInput.getText().toString();
                Severity: Minor
                Found in app/src/main/java/ca/marshallasch/veil/FragmentSignUp.java - About 1 hr to fix

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      static final String SQL_CREATE_SYNC_STATS = "CREATE TABLE " + SyncStatsEntry.TABLE_NAME + " (" +
                              SyncStatsEntry._ID + " INTEGER PRIMARY KEY," +
                              SyncStatsEntry.COLUMN_DATA_SEND_ID + " VARCHAR UNIQUE," +
                              SyncStatsEntry.COLUMN_PEER_ID + " VARCHAR," +
                              SyncStatsEntry.COLUMN_PACKET_SIZE + " INTEGER," +
                  app/src/main/java/ca/marshallasch/veil/database/UserContract.java on lines 16..24

                  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 82.

                  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

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      @WorkerThread
                      public boolean unblockUser(@Size(max = 36) String userID)
                      {
                          if (userID == null) {
                              return false;
                  app/src/main/java/ca/marshallasch/veil/database/Database.java on lines 306..325

                  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 80.

                  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

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      @WorkerThread
                      public boolean unregisterForNotification(@Size(max = 36) String hash) {
                  
                          if (hash == null) {
                              return false;
                  app/src/main/java/ca/marshallasch/veil/database/Database.java on lines 222..243

                  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 80.

                  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

                  Further Reading

                  Method getTimeLastSentData has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      @WorkerThread
                      public Date getTimeLastSentData(String peerID) {
                  
                          Date time = new Date(0);
                  
                  
                  Severity: Minor
                  Found in app/src/main/java/ca/marshallasch/veil/database/Database.java - About 1 hr to fix

                    Method getFilter has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        @Override
                        public Filter getFilter() {
                            /*
                             * This class is the tag filter. The CharSequence must be a list of tags that are
                             * denominated with a ':' character.
                    Severity: Minor
                    Found in app/src/main/java/ca/marshallasch/veil/PostListAdapter.java - About 1 hr to fix

                      Method onCreateView has 28 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_signup, container, false);
                      Severity: Minor
                      Found in app/src/main/java/ca/marshallasch/veil/FragmentSignUp.java - About 1 hr to fix

                        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();
                        Severity: Minor
                        Found in app/src/main/java/ca/marshallasch/veil/FragmentChangePassword.java - About 1 hr to fix

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                                  personalForumsBtn.setOnClickListener(view1 -> {
                                      Log.i(TAG, "Your forums button pressed");
                          
                                      FragmentDiscoverForums frag = new FragmentDiscoverForums();
                          
                          
                          app/src/main/java/ca/marshallasch/veil/FragmentDashBoard.java on lines 82..90

                          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 76.

                          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

                          Further Reading

                          Severity
                          Category
                          Status
                          Source
                          Language