Arthelh/NCNF

View on GitHub

Showing 36 of 80 total issues

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

              Method createGroup has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  private void createGroup(View view) {
                      List<User> members = ((FriendSelectionGroupFragment)this.friendSelectorFragment).getMembers();
                      if(members.size() == 0){
                          Snackbar.make(findViewById(android.R.id.content), "You can't create a group with nobody in it.", LENGTH_SHORT).show();
                      } else {

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

                  @Override
                  public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
                      super.onViewCreated(view, savedInstanceState);
              
                      if (user != 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 getUserLocations has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

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

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

                  @Override
                  public void onActivityResult(int requestCode, int resultCode, @Nullable @org.jetbrains.annotations.Nullable Intent data) {
                      super.onActivityResult(requestCode, resultCode, data);
                      if(requestCode == IMG_PICK_CODE ){
                          if(resultCode == AppCompatActivity.RESULT_OK){

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

                  private boolean checkAllFieldsAreFilledAndCorrect() {
              
                      EditText[] fields = new EditText[] {eventName, eventDescription, eventEmail, eventAddress};
                      boolean interm = Arrays.stream(fields).map(InputValidator::verifyGenericInput).reduce(true, (a, b) -> a && b) && eventType != Event.Type.NOTHING;
                      if(!interm) {

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

                  @Override
                  public boolean equals(Object o) {
                      if (this == o) return true;
                      if (o == null || getClass() != o.getClass()) return false;
                      User user = (User) o;
              Severity: Minor
              Found in app/src/main/java/com/ncnf/models/User.java - About 25 mins 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 checkInputs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  private boolean checkInputs(){
                      boolean passed = true;
              
                      String emailString = this.email.getText().toString();
                      String passwordString = this.password.getText().toString();
              Severity: Minor
              Found in app/src/main/java/com/ncnf/views/fragments/login/SignUpFragment.java - About 25 mins 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 switchViews has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  private void switchViews(View view) {
              
                      if(firstStep){
                          LocalTime time = this.groupEditionFragment.getGroupTime();
                          LocalDate date = this.groupEditionFragment.getGroupDate();

              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

              Severity
              Category
              Status
              Source
              Language