gyrodraw/GyroDraw

View on GitHub

Showing 117 of 158 total issues

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

Line is longer than 100 characters (found 669).
Open

        android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"

Checks for long lines.

Rationale: Long lines are hard to read in printouts or if developershave limited screen space for the source code, e.g. if the IDEdisplays additional information like project tree, class hierarchy,etc.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Parameter name 'y' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'.
Open

        private FloodFillRange(int startX, int endX, int y) {

Checks that method parameter names conform to a specified pattern.By using accessModifiers property it is possibleto specify different formats for methods at different visibility levels.

To validate catch parameters please useCatchParameterName.

To validate lambda parameters please useLambdaParameterName.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Member name 'mActivityRule' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'.
Open

    public final ActivityTestRule<WaitingPageActivity> mActivityRule =

Member name 'mActivityRule' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'.
Open

    public final ActivityTestRule<ShopActivity> mActivityRule =

Member name 'mActivityRule' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'.
Open

    public final ActivityTestRule<LeaguesActivity> mActivityRule =

Distance between variable 'greyColor' declaration and its first usage is 4, but allowed 3. Consider making that variable final if you still need to store its value in advance (before method calls that might have side effects on the original value).
Open

            int greyColor = getResources().getColor(R.color.colorGrey);

Checks the distance between declaration of variable and its first usage.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Local variable name 'x' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'.
Open

        int x = getRandomIntWithinBounds(paintView.getWidth());

Checks that local, non-final variable names conform to a specified pattern.A catch parameter is considered to be a local variable.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Distance between variable 'previousStars' declaration and its first usage is 8, but allowed 3. Consider making that variable final if you still need to store its value in advance (before method calls that might have side effects on the original value).
Open

        int previousStars = starsAnimation.getNumStars();

Checks the distance between declaration of variable and its first usage.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Local variable name 'y' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'.
Open

        int y = getRandomIntWithinBounds(paintView.getHeight());

Checks that local, non-final variable names conform to a specified pattern.A catch parameter is considered to be a local variable.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Parameter name 'y' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'.
Open

    void floodFill(int x, int y) {

Checks that method parameter names conform to a specified pattern.By using accessModifiers property it is possibleto specify different formats for methods at different visibility levels.

To validate catch parameters please useCatchParameterName.

To validate lambda parameters please useLambdaParameterName.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Distance between variable 'counter' declaration and its first usage is 4, but allowed 3. Consider making that variable final if you still need to store its value in advance (before method calls that might have side effects on the original value).
Open

        short counter = activityRule.getActivity().getChangeDrawingCounter();

Checks the distance between declaration of variable and its first usage.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Distance between variable 'previousStars' declaration and its first usage is 6, but allowed 3. Consider making that variable final if you still need to store its value in advance (before method calls that might have side effects on the original value).
Open

        int previousStars = starsAnimation.getNumStars();

Checks the distance between declaration of variable and its first usage.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Member name 'xSpeed' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'.
Open

        private float xSpeed;

Distance between variable 'functions' declaration and its first usage is 5, but allowed 3. Consider making that variable final if you still need to store its value in advance (before method calls that might have side effects on the original value).
Open

        FirebaseFunctions functions = FirebaseFunctions.getInstance();

Checks the distance between declaration of variable and its first usage.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Member name 'x' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'.
Open

        private float x;

Member name 'ySpeed' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'.
Open

        private float ySpeed;

'(' should be on the previous line.
Open

                (league, R.color.colorLeague1, R.color.colorLeague2, R.color.colorLeague3);

Checks the padding between the identifier of a method definition,constructor definition, method call, or constructor invocation; andthe left parenthesis of the parameter list. That is, if theidentifier and left parenthesis are on the same line, checks whethera space is required immediately after the identifier or such a spaceis forbidden. If they are not on the same line, reports a violation,unless configured to allow line breaks. To allow linebreaks afterthe identifier, set property allowLineBreaks to true.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Line is longer than 100 characters (found 143).
Open

        android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"

Checks for long lines.

Rationale: Long lines are hard to read in printouts or if developershave limited screen space for the source code, e.g. if the IDEdisplays additional information like project tree, class hierarchy,etc.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Severity
Category
Status
Source
Language