gyrodraw/GyroDraw

View on GitHub

Showing 34 of 158 total issues

Method styleView has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    private void styleView(TextView view, String text, int color, int size, Typeface typeface,
                           LinearLayout.LayoutParams layoutParams) {
Severity: Minor
Found in app/src/main/java/ch/epfl/sweng/GyroDraw/BaseActivity.java - About 45 mins to fix

    Function startTimer has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    function startTimer(time, roomID, prevState, newState, nodeCreation, isWaiting) {
    Severity: Minor
    Found in functions/index.js - About 45 mins to fix

      Method decodeSampledBitmapFromByteArray has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public static Bitmap decodeSampledBitmapFromByteArray(byte[] array, int offset, int length,
                                                                int reqWidth, int reqHeight) {
      Severity: Minor
      Found in app/src/main/java/ch/epfl/sweng/GyroDraw/utils/BitmapManipulator.java - About 35 mins to fix

        Method bounceButton has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public static void bounceButton(final View view, double amplitude, int frequency,
                                            AnimMode animMode, Context context) {
        Severity: Minor
        Found in app/src/main/java/ch/epfl/sweng/GyroDraw/utils/LayoutUtils.java - About 35 mins to fix

          Function functionTimer has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function functionTimer (seconds, state, roomID, isWaiting, call) {
          Severity: Minor
          Found in functions/index.js - About 35 mins to fix

            Method createTextView has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public TextView createTextView(String text, int color, int size, Typeface typeface,
                                               LinearLayout.LayoutParams layoutParams) {
            Severity: Minor
            Found in app/src/main/java/ch/epfl/sweng/GyroDraw/BaseActivity.java - About 35 mins to fix

              Function createRoomAndJoin has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              function createRoomAndJoin(league, roomsList, username, id, gameMode) {
              Severity: Minor
              Found in functions/index.js - About 35 mins to fix

                Method generateTrophiesFromRanking has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static Integer[] generateTrophiesFromRanking(Integer[] ranking) {
                        Integer[] trophies = new Integer[ranking.length];
                
                        trophies[0] = ranking[0] >= 0 ? MAX_RANK : MIN_RANK;
                        for (int i = 1; i < trophies.length; ++i) {
                Severity: Minor
                Found in app/src/main/java/ch/epfl/sweng/GyroDraw/utils/RankingUtils.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 onActivityResult has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    @Override
                    public void onActivityResult(int requestCode, int resultCode, Intent data) {
                        super.onActivityResult(requestCode, resultCode, data);
                
                        if (requestCode == REQUEST_CODE_SIGN_IN) {
                Severity: Minor
                Found in app/src/main/java/ch/epfl/sweng/GyroDraw/auth/LoginActivity.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 generatePositionsFromRanking has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static Integer[] generatePositionsFromRanking(Integer[] ranking) {
                        Integer[] positions = new Integer[ranking.length];
                
                        positions[0] = ranking[0] >= 0 ? FIRST_POSITION : LAST_POSITION;
                        for (int i = 1; i < positions.length; ++i) {
                Severity: Minor
                Found in app/src/main/java/ch/epfl/sweng/GyroDraw/utils/RankingUtils.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

                Avoid too many return statements within this function.
                Open

                      return admin.database().ref(parentRoomID + roomID + "/ranking").once('value', (snapshot) => {
                        return updateDisconnectedUsers(snapshot, roomID);
                      });
                Severity: Major
                Found in functions/index.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                    return 0;
                  Severity: Major
                  Found in functions/index.js - About 30 mins to fix

                    Method getViewsByTag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static ArrayList<View> getViewsByTag(LinearLayout root, String tag) {
                            ArrayList<View> views = new ArrayList<>();
                    
                            final int childCount = root.getChildCount();
                            for (int i = 0; i < childCount; 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 getGameResultsFromDb has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        @Override
                        public List<GameResult> getGameResultsFromDb(Context context) {
                            String query = "Select * FROM " + TABLE_NAME + " ORDER BY " + COLUMN_ID + " DESC LIMIT 10";
                    
                            SQLiteDatabase db = this.getWritableDatabase();

                    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