Showing 28 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()
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()
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();
Similar blocks of code found in 2 locations. Consider refactoring. Open
public void goToProfileFragment(){
// Fragments are managed by transactions
FragmentManager fragmentManager = getSupportFragmentManager();
if(!fragmentManager.isDestroyed())
{
- 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 61.
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
public void goToRegisterFragment()
{
// Fragments are managed by transactions
FragmentManager fragmentManager = getSupportFragmentManager();
if(!fragmentManager.isDestroyed())
- 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 61.
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 getCurrentPosition
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public LatLng getCurrentPosition()
{
if(!locationOverride)
{
Location loc = null;
- 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
Similar blocks of code found in 3 locations. Consider refactoring. Open
for(var i = 0, size = sections.length; i < size ; i++){
sectionsUserCount.set(sections[i], 0);
}
- 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 48.
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 3 locations. Consider refactoring. Open
for(var i = 0, size = sections.length; i < size ; i++){
sectionsScores.set(sections[i], 0);
}
- 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 48.
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