Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ihalaij1 committed Dec 5, 2024
1 parent 094ecf8 commit ae2a07b
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions .prospector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pylint:
- relative-beyond-top-level
- cyclic-import
- imported-auth-user
- too-many-positional-arguments
options:
jobs: 0

Expand Down
5 changes: 2 additions & 3 deletions exercise/cache/basetypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class EqById:
id: int

def __eq__(self, other: Any) -> bool:
if type(self) != type(other): # pylint: disable=unidiomatic-typecheck
if type(self) != type(other): # pylint: disable=unidiomatic-typecheck # noqa: E721
return False
return self.id == other.id

Expand Down Expand Up @@ -573,8 +573,7 @@ def _generate_data( # pylint: disable=too-many-locals
_add_to(categories[entry.category_id], exercise)
_add_to(total, exercise)

if exercise.max_group_size > total.max_group_size:
total.max_group_size = exercise.max_group_size
total.max_group_size = max(total.max_group_size, exercise.max_group_size)
if exercise.max_group_size > 1 and exercise.min_group_size < total.min_group_size:
total.min_group_size = exercise.min_group_size

Expand Down
3 changes: 2 additions & 1 deletion exercise/cache/points.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,8 @@ class ExercisePoints(LearningObjectPoints):
(Notification, [post_delete, post_save], with_user_ids(model_exercise_siblings_confirms_the_level)),
]
DBCLS = LearningObjectPoints.DBCLS
submissions: List[SubmissionEntry] = field(default_factory=list)
# field() works because LearningObjectPoints inherits CommonPointData, which is a dataclass
submissions: List[SubmissionEntry] = field(default_factory=list) # pylint: disable=invalid-field-call
_true_best_submission: Optional[SubmissionEntry]
_best_submission: Optional[SubmissionEntry]
graded: bool
Expand Down
1 change: 1 addition & 0 deletions exercise/staff_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ def get_common_objects(self) -> None:
elif self.exercise.grading_mode == BaseExercise.GRADING_MODE.LAST:
mode = _('GRADING_MODE_LAST')
else:
mode = _('UNKNOWN')
logger.warning("Missing description for grading mode.")
self.grading_mode_text = format_lazy(_('GRADING_MODE_TITLE -- {}'), mode)

Expand Down
1 change: 1 addition & 0 deletions external_services/api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def mk_sourced_id(self, lti_exercise, user=None, enrollment=None):
elif user and not lti_exercise.lti_service.is_anonymous:
user_id = 'i' + str(user.pk)
else:
user_id = 'unknown'
self.fail('mk_sourced_id requires the enrollment argument for anonymous LTI services and user otherwise.')
return '{}-{}'.format(lti_exercise.pk, user_id)

Expand Down
11 changes: 9 additions & 2 deletions lint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#!/bin/bash

docker build -f .github/workflows/lint.Dockerfile -q . -t aplus_prospector
docker run --rm -v ${PWD}:/app -w /app aplus_prospector sh -c 'prospector'
# Build the image if it doesn't exist yet
if [ -z "$(docker images -q aplus_prospector 2> /dev/null)" ]; then
echo "Building prospector image..."
docker build -f .github/workflows/lint.Dockerfile -q . -t aplus_prospector
else
echo "Using existing prospector image."
fi
echo "Running prospector..."
docker run --rm -v "${PWD}":/app -w /app aplus_prospector sh -c 'prospector'
2 changes: 2 additions & 0 deletions selenium_test/test/page_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ def __init__(self, driver, course=CourseName.APLUS):
path = "/aplus1/basic_instance"
elif (course == CourseName.HOOK):
path = "/aplus1/hook_instance"
else:
raise Exception(f"Unknown course: {course}") # pylint: disable=broad-exception-raised

self.load(path, HomePageLocators.MAIN_SCORE)

Expand Down

0 comments on commit ae2a07b

Please sign in to comment.