Campus-Capture/campus-capture

View on GitHub

Showing 19 of 28 total issues

File FirebaseBackend.java has 342 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package com.github.campus_capture.bootcamp.firebase;

import android.util.Log;

import androidx.annotation.NonNull;

    File MapsFragment.java has 335 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    package com.github.campus_capture.bootcamp.fragments;
    
    import android.Manifest;
    import android.annotation.SuppressLint;
    import android.content.pm.PackageManager;

      FirebaseBackend has 28 methods (exceeds 20 allowed). Consider refactoring.
      Open

      public class FirebaseBackend implements BackendInterface{
          @Override
          public CompletableFuture<Boolean> voteZone(String uid, Section s, String zonename) {
      
              AppContext context = AppContext.getAppContext();

        Function countVotesScheduledFunction has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        exports.countVotesScheduledFunction = functions.region('europe-west1').pubsub.schedule("15 * * * *").onRun((context) => {
        
            console.log("It's minute 15!")
          
            const db = getDatabase()
        Severity: Major
        Found in functions/index.js - About 2 hrs to fix

          Method getColor has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static int getColor(Section s, Context context)
              {
                  int id = -1;
                  switch(s)
                  {

            Method initUserInDB has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @Override
                public CompletableFuture<Boolean> initUserInDB(String uid, Section section){
                    AppContext context = AppContext.getAppContext();
                    FirebaseDatabase db = context.getFirebaseDB();
            
            

              Function giveMoneyScheduledFunction has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              exports.giveMoneyScheduledFunction = functions.region('europe-west1').pubsub.schedule("0 12 * * *").onRun((context) => {
              
                  console.log("It's noon!")
                
                  const db = getDatabase()
              Severity: Minor
              Found in functions/index.js - About 1 hr to fix

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

                    @Override
                    public CompletableFuture<Boolean> voteZone(String uid, Section s, String zonename) {
                
                        AppContext context = AppContext.getAppContext();
                        FirebaseDatabase db = context.getFirebaseDB();

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

                      private void refreshCurrentAttacks(Marker m, GoogleMap map)
                      {
                          Section zoneOwner = scheduler.getCurrentZoneOwner(m.getTitle());
                          String displayOwner = (zoneOwner == null) ? "None" : zoneOwner.toString();
                          if(scheduler.isTakeover())

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

                        @Override
                        public CompletableFuture<List<PowerUp>> getPowerUps() {
                            CompletableFuture<List<PowerUp>> futureResult = new CompletableFuture<>();
                    
                            AppContext context = AppContext.getAppContext();

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

                          @Override
                          protected void onCreate(@Nullable Bundle savedInstanceState) {
                              super.onCreate(savedInstanceState);
                      
                              setContentView(R.layout.activity_login);

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

                                @Override
                                public void run() {
                        
                                    String label = upper.getString(R.string.current_zone_text);
                                    LatLng position = upper.getCurrentPosition();

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

                              public void startAll() {
                                  long millisSinceHour = time.get(Calendar.MINUTE) * MILLIS_PER_MIN
                                          + time.get(Calendar.SECOND) * MILLIS_PER_SEC
                                          + time.get(Calendar.MILLISECOND);
                          
                          

                            Method onCompleteLoginListenerContent has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private void onCompleteLoginListenerContent(Task<AuthResult> task){
                                    if (task.isSuccessful()) {
                                        // Sign in success, set the signed-in user's information and go to main
                                        FirebaseUser user = mAuth.getCurrentUser();
                            
                            

                              Method addSpendButtonListener has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private void addSpendButtonListener(ViewHolder holder, String powerUpName){
                                      holder.powerUpButton.setOnClickListener(view -> {
                                          int spendValue = holder.powerUpSeekBar.getProgress();
                                          if(spendValue > userMoney){
                                              Toast.makeText(powerUpMoney.getContext(), "Well... you are too broke.", Toast.LENGTH_LONG).show();

                                Method getCurrentPosition has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public LatLng getCurrentPosition()
                                    {
                                        if(!locationOverride)
                                        {
                                            Location loc = 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 equals has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    @Override
                                    public boolean equals(@Nullable Object otherZone) {
                                        if(!(otherZone instanceof  Zone))
                                        {
                                            return false;

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

                                    public void refreshZoneColors(Map<String, Section> zoneState)
                                    {
                                        Log.i("MapsFragment", "Refreshing zone colours");
                                        if(zoneState == null || polygonMap == 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 voteZone has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    @Override
                                    public CompletableFuture<Boolean> voteZone(String uid, Section s, String zonename) {
                                
                                        AppContext context = AppContext.getAppContext();
                                        FirebaseDatabase db = context.getFirebaseDB();

                                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