njomeau/zuluzulu

View on GitHub

Showing 27 of 77 total issues

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

    private void printTimeRemaining(long nb_days, long nb_hours, StringBuilder sb) {
        long nb_hours_end = (getEndDate().getTime() - new Date().getTime()) / 3600000;
        long nb_days_end = nb_hours_end / 24;

        Calendar calendar = Calendar.getInstance();
Severity: Minor
Found in app/src/main/java/ch/epfl/sweng/zuluzulu/structure/EventDate.java - About 45 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 put has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public void put(AuthenticatedUser user) {
        // Gets the data repository in write mode
        SQLiteDatabase db = mDbHelper.getWritableDatabase();

        ContentValues values = new ContentValues();
Severity: Minor
Found in app/src/main/java/ch/epfl/sweng/zuluzulu/localDatabase/UserDatabase.java - About 35 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 onFragmentInteraction has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public void onFragmentInteraction(CommunicationTag tag, Object data) {
        switch (tag) {
            case SET_USER:
                Map<Integer, Object> received = (HashMap<Integer, Object>) data;
Severity: Minor
Found in app/src/main/java/ch/epfl/sweng/zuluzulu/MainActivity.java - About 35 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 handleMemento has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private void handleMemento(List<String> result) {
        if (result != null) {
            for (int i = 0; i < result.size(); i++) {
                if (result.get(i) != null && !result.get(i).isEmpty()) {
                    addEvent(result.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 isBetterLocation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private static boolean isBetterLocation(Location location, Location currentBestLocation) {
        if (currentBestLocation == null) {
            // A new location is always better than no location
            return true;
        }
Severity: Minor
Found in app/src/main/java/ch/epfl/sweng/zuluzulu/structure/GPS.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 followEventOnClick has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private void followEventOnClick(final Event event, final EventHolder holder, final ViewGroup parent){
        if (user != null && user.isConnected()) {
            if (!user.isFollowedEvent(event.getId())) {
                event.addFollower(user.getSciper());
                user.addFollowedEvent(event.getId());
Severity: Minor
Found in app/src/main/java/ch/epfl/sweng/zuluzulu/adapters/EventArrayAdapter.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 getUserWithIdOrCreateIt has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public void getUserWithIdOrCreateIt(String sciper, OnResult<AuthenticatedUser> onResult) {
        if (sciper != null && userMap.containsKey(sciper)) {
            onResult.apply(userMap.get(sciper));
        } else if (sciper != null && !userMap.containsKey(sciper)) {

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