CIS 1100 Style Rubric

This page outlines the style rubric we look at when grading your homework assignment so that you can quickly refresh yourself on things to do when writing code. Note that this is NOT a general outline of why style is important or why a specific style error is considered in error. You can read more about that on the Style Guide resource page.

Note: We do not list how many points these deductions are worth. This is because the point weighting varies from assignment to assignment.


Overall Errors

These two style errors don’t follow a specific category and usually indicate more significant issues in the submission:

  • Incomplete Assignment. (Style points are only awarded for complete assignments)
  • Code did not compile, TA fixed errors and resubmitted.

Checkstyle Errors

There are two types of Checkstyle errors, one for the number of checkstyle errors, and one for the number of Checkstyle error types.

These two types of deductions are independent.

Number of Checkstyle Errors

  • More than 3 checkstyle errors
  • Less than 3 checkstyle errors

Number of Checkstyle Error Types

  • More than 3 types of checkstyle errors
  • Less than 3 types of checkstyle errors

File Header Errors

  • Missing or incorrect file header comment(s) with name and PennKey
  • File header contains PennID instead of PennKey
  • File header has no/incorrect program description (compounds with not having a header at all)
  • File header has no/incorrect program execution (compounds with not having a header at all)

Variable Naming and Declaration Errors

  • Variable names are not descriptive
  • Variable names are not snake_case (except for constants, which should be ALL_CAPS_WITH_UNDERSCORES)

Commenting Errors

  • No commenting where it would be useful
  • Too many comments where it is not useful
  • Comments are below the code they reference
  • TODO comments left in code when that TODO was completed. These should be replaced by your own comments as you fill in your code.
  • Commented-out code left in your submission

If Statement and Loop Errors

  • Single line if statement or loop statement.
  • Uses an “indexing loop” (either a while or for idx in range(n)) where a for loop over an iterable would work just as well.
  • Conditional check in the form of if boolean_expression == True: - since the variable is a bool already, you don’t need to compare it to True.
  • If statement to the effect of
    if x == y:
      return True
    else:
      return False
    

    Instead of evaluating the conditional, we can just use it directly since it already results in a boolean. For the example provded above, we could rewrite it as just:

    return x == y
    

Inefficiency Errors

  • Obvious code innefficiency
  • Overly complicated logic
  • Unnecessary print statements

Spacing Errors

  • Whitespace left at the end of a line
  • No blank lines left between functions/classes
  • Unnecessary spacing
  • Inconsistent spacing
  • No spacing at all