Arthelh/NCNF

View on GitHub

Showing 80 of 80 total issues

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

    private void showUserPublicProfile(User user) {

        FragmentManager fragmentManager = getParentFragmentManager();

        if(user.getUuid().equals(this.user.getUuid())) {
app/src/main/java/com/ncnf/views/fragments/group/GroupDisplayFragmentOwner.java on lines 244..260

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

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

    private void prepareAllFields() {

        groupName.setText(group.getName());
        groupDescription.setText(group.getDescription());
        groupAddress.setText(group.getAddress());

    Method getLocation has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private void getLocation() {
            LocationRequest mLocationRequestHighAccuracy = new LocationRequest();
            mLocationRequestHighAccuracy.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
            mLocationRequestHighAccuracy.setInterval(UPDATE_INTERVAL);
            mLocationRequestHighAccuracy.setFastestInterval(FASTEST_INTERVAL);
    Severity: Minor
    Found in app/src/main/java/com/ncnf/utilities/user/LocationService.java - About 1 hr to fix

      Method performFiltering has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

              @Override
              protected FilterResults performFiltering(CharSequence constraint) {
                  List<SocialObject> filteredList = new ArrayList<>();
      
                  if (constraint == null || constraint.length() == 0) {
      Severity: Minor
      Found in app/src/main/java/com/ncnf/adapters/EventListAdapter.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 verifyGenericInput has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public static boolean verifyGenericInput(EditText textField){
              if(textField == null) {
                  throw new IllegalArgumentException("EditText passed as argument cannot be null");
              }
              if(textField.getText() == null) {
      Severity: Minor
      Found in app/src/main/java/com/ncnf/utilities/InputValidator.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 createDateOnClickListener has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private View.OnClickListener createDateOnClickListener(boolean isMin) {
              DatePickerDialog.OnDateSetListener oDSL = (view1, year, month, dayOfMonth) -> {
                  selYear = year;
                  selMonth = month;
                  selDay = dayOfMonth;

        Method setupAddFriendView has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private void setupAddFriendView(){
                addFriendButton.setIcon(requireContext().getDrawable(R.drawable.ic_baseline_format_list_bulleted_24));
        
                // Show search bar
                materialSearchBar.setVisibility(View.VISIBLE);

          Method addMapMarkers has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private void addMapMarkers() {
          
                  if(mMap != null) {
          
                      if(clusterManager == null) {

            Method onClusterItemInfoWindowClick has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @Override
                public void onClusterItemInfoWindowClick(CustomMapMarker item) {
                    Fragment fragment;
            
                    if (item.isEvent()) {

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

                  private void addMapMarkers() {
              
                      if(mMap != null) {
              
                          if(clusterManager == null) {

              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 createDateOnClickListener has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  private View.OnClickListener createDateOnClickListener(boolean isMin) {
                      DatePickerDialog.OnDateSetListener oDSL = (view1, year, month, dayOfMonth) -> {
                          selYear = year;
                          selMonth = month;
                          selDay = dayOfMonth;

              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

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

                  private void updateGroupLocation(ActivityResult result) {
                      if (result.getResultCode() == Activity.RESULT_OK) {
                          Place place = Autocomplete.getPlaceFromIntent(result.getData());
                          String meetingPointAddress = place.getName() + ", " + place.getAddress();
                          this.meetingPointLocation = new GeoPoint(place.getLatLng().latitude, place.getLatLng().longitude);
              app/src/main/java/com/ncnf/views/fragments/organization/EventCreateFragment.java on lines 265..273

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

              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 void updateEventLocation(ActivityResult result){
              
                      if (result.getResultCode() == Activity.RESULT_OK) {
                          Place place = Autocomplete.getPlaceFromIntent(result.getData());
                          String meetingPointAddress = place.getName() + ", " + place.getAddress();
              app/src/main/java/com/ncnf/views/fragments/group/GroupEditingFragment.java on lines 190..197

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

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

                  @Override
                  public <T> CompletableFuture<List<T>> geoQuery(LatLng location, double radius, String collectionPath, Class<T> collectionType){
                      radius *= (radius < 1000) ? 1000 : 1; //Check if radius is still in km, convert to m
              
                      List<GeoQueryBounds> bounds = GeoFireUtils.getGeoHashQueryBounds(new GeoLocation(location.latitude, location.longitude), radius);
              Severity: Minor
              Found in app/src/main/java/com/ncnf/database/firebase/FirebaseDatabase.java - About 1 hr to fix

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

                    @Override
                    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
                        super.onViewCreated(view, savedInstanceState);
                
                        if (user != null) {

                  Method checkInputs has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private boolean checkInputs(){
                          boolean passed = true;
                  
                          String emailString = this.email.getText().toString();
                          String passwordString = this.password.getText().toString();

                    Method initViews has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private void initViews(View view){
                            // Set Header Image
                            ImageView headerImageView = view.findViewById(R.id.eventHeaderPicture);
                            fileStore.setContext(this.getContext());
                            fileStore.setPath(SocialObject.IMAGE_PATH, String.format(SocialObject.IMAGE_NAME, event.getUuid()));
                    Severity: Minor
                    Found in app/src/main/java/com/ncnf/views/fragments/event/EventFragment.java - About 1 hr to fix

                      Method getUserLocations has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private void getUserLocations() {
                      
                              for(int i = 0; i < friendsUUID.size(); ++i) {
                      
                                  String userId = friendsUUID.get(i);

                        Method addEventMarkers has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private void addEventMarkers(List<Event> events){
                                Map<LatLng, List<Event>> eventMap = new HashMap<>();
                                for (Event p : events) {
                                    LatLng event_position = new LatLng(p.getLocation().getLatitude(), p.getLocation().getLongitude());
                        
                        
                        Severity: Minor
                        Found in app/src/main/java/com/ncnf/utilities/map/MapHandler.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 verifyGenericInput has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static boolean verifyGenericInput(EditText textField){
                                if(textField == null) {
                                    throw new IllegalArgumentException("EditText passed as argument cannot be null");
                                }
                                if(textField.getText() == null) {
                        Severity: Minor
                        Found in app/src/main/java/com/ncnf/utilities/InputValidator.java - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language