<commit_before># The Selfie Autograder How-to

[Selfie](http://selfie.cs.uni-salzburg.at) comes with an [autograder](self.py) implemented in Python that features compiler and operating systems [assignments](assignments). The autograder is publicly available and meant to be used by students for self-grading before submitting solutions of assignments.

In order to use the autograder [install](../README.md) selfie first.

## Running the Autograder

The autograder reports grades in the range from 2 to 5 where 2 is the best and 4 is the worst passing grade, and 5 is failed. Grade 1 is reserved for submitting solutions that autograde to 2 but also match the code quality and conventions of selfie as detailed below.

TODO: instructions on how to use the autograder

### For Students

### For Teachers

## Submitting Solutions for Grading

Solutions of assignments must be submitted as git commit links to a private clone of the selfie repository hosted on GitHub and exclusively shared with your teacher such as the GitHub user [ckirsch](https://github.com/ckirsch).

### Creating a private clone of selfie

First [install](../README.md) selfie either in the cloud or locally on your machine.

Then, on the web:

1. Create an account on [github.com](https://github.com) unless you already have one.
2. Create a [new](https://github.com/new), empty repository, name it `myselfie`, and set it to private.
3. Invite your teacher, for example, the GitHub user [ckirsch](https://github.com/ckirsch), to the repository as your only collaborator.

And then, in a terminal where your selfie installation is:

1. Change directory to the root directory of your selfie installation.
2. Change the `origin` remote name to `upstream`: `git remote rename origin upstream`
3. Add your `myselfie` repository on GitHub as `origin`: `git remote add origin https://github.com/<yourusername>/myselfie.git`
4. Update your installation from `upstream`: `git fetch upstream` (or, initially `git fetch --unshallow upstream` if you are on [repl.it](https://repl.it))
5. Mirror your installation to your `myselfie` repository on GitHub: `git push --mirror origin`
6. Set up the master branch of your installation to push to your `myselfie` repository: `git branch --set-upstream-to=origin/master master`

Your selfie installation as well as your `myselfie` repository on GitHub are successfully set up and ready for submitting solutions of assignments.

### Before working on an assignment

Update your selfie installation to the latest version of the official selfie repository:
<commit_msg>How-to on using the autograder [skip ci]<commit_after># The Selfie Autograder How-to

[Selfie](http://selfie.cs.uni-salzburg.at) comes with an [autograder](self.py) implemented in Python that features compiler and operating systems [assignments](assignments). The autograder is publicly available and meant to be used by students for self-grading before submitting solutions of assignments.

In order to use the autograder [install](../README.md) selfie first.

## Running the Autograder

The autograder reports grades in the range from 2 to 5 where 2 is the best and 4 is the worst passing grade, and 5 is failed. Grade 1 is reserved for submitting solutions that autograde to 2 but also match the code quality and conventions of selfie as detailed below.

The autograder is invoked as follows:

1. Change directory to the root directory of your selfie installation.
2. Invoke the autograder without any command line options: `./grader/self.py`
3. The autograder responds with its command line options and the list of supported assignments.

If the autograder does not respond, your version of python is probably outdated. Make sure you have at least version 3 of python.

### For Students

Whenever you changed selfie code you can check if selfie still self-compiles:

1. Invoke the autograder with the `self-compile` assignment: `./grader/self.py self-compile`
2. Selfie still self-compiles if the autograder responds with grade 2.

In order to find out about all other assignments supported by the autograder browse the [assignments](assignments).

### For Teachers

The autograder supports bulk grading of an `<assignment>` as follows:

1. Prepare a text file `commit-links.txt` that contains GitHub commit links to which you have read access, one per line and student.
2. Create an empty directory `student-repos`.
3. Invoke the autograder in bulk mode: `./grader/self.py -b commit-links.txt -d student-repos <assignment>`

The autograder clones, for each commit link in `commit-links.txt`, the corresponding repository from GitHub into `student-repos`, grades it for the given `<assignment>`, and reports the grade as well as details on which part of the assignment passes and which does not for each commit link. To suppress the details and just see the grades use `option -q`.

If you subsequently invoke the autograder in bulk mode on `student-repos` again, it only clones repositories for commit links in `commit-links.txt` that are not yet in `student-repos`. Repositories that are already in `student-repos` are just updated from GitHub.

## Submitting Solutions for Grading

Solutions of assignments must be submitted as git commit links to a private clone of the selfie repository hosted on GitHub and exclusively shared with your teacher such as the GitHub user [ckirsch](https://github.com/ckirsch).

### Creating a private clone of selfie

First [install](../README.md) selfie either in the cloud or locally on your machine.

Then, on the web:

1. Create an account on [github.com](https://github.com) unless you already have one.
2. Create a [new](https://github.com/new), empty repository, name it `myselfie`, and set it to private.
3. Invite your teacher, for example, the GitHub user [ckirsch](https://github.com/ckirsch), to the repository as your only collaborator.

And then, in a terminal where your selfie installation is:

1. Change directory to the root directory of your selfie installation.
2. Change the `origin` remote name to `upstream`: `git remote rename origin upstream`
3. Add your `myselfie` repository on GitHub as `origin`: `git remote add origin https://github.com/<yourusername>/myselfie.git`
4. Update your installation from `upstream`: `git fetch upstream` (or, initially `git fetch --unshallow upstream` if you are on [repl.it](https://repl.it))
5. Mirror your installation to your `myselfie` repository on GitHub: `git push --mirror origin`
6. Set up the master branch of your installation to push to your `myselfie` repository: `git branch --set-upstream-to=origin/master master`

Your selfie installation as well as your `myselfie` repository on GitHub are successfully set up and ready for submitting solutions of assignments.

### Before working on an assignment

Update your selfie installation to the latest version of the official selfie repository:

{'fraction_non_alphanumeric': 0.07217694994179279, 'fraction_numerical': 0.006111757857974389, 'mean_word_length': 4.596905537459284, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3342115', 'n_tokens_mistral': 1871, 'n_tokens_neox': 1791, 'n_words': 970}