Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ cargo run -p tmc-langs-cli help

## Development

Format using `cargo fmt`, use `cargo clippy` for linting.
Format using `cargo fmt`, use `cargo clippy` for linting. All crates should have the clippy lints `print_stdout` and `print_stderr` set to deny. The CLI has one function where writing to stdout is allowed.

If using vscode and rust-analyzer, be sure to turn on the setting `loadOutDirsFromCheck` to avoid a spurious unresolved import error from `isolang`.

Expand Down
2 changes: 2 additions & 0 deletions plugins/csharp/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(clippy::print_stdout, clippy::print_stderr)]

//! TMC language plugin for C#.

mod cs_test_result;
Expand Down
2 changes: 1 addition & 1 deletion plugins/csharp/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ mod test {
}

#[test]
#[ignore = "requires newer version of C# runner that always includes all points in the tests"]
// #[ignore = "requires newer version of C# runner that always includes all points in the tests"]
fn doesnt_give_points_unless_all_relevant_exercises_pass() {
init();

Expand Down
2 changes: 2 additions & 0 deletions plugins/java/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(clippy::print_stdout, clippy::print_stderr)]

//! Java plugins for ant and maven

mod ant_plugin;
Expand Down
2 changes: 2 additions & 0 deletions plugins/make/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(clippy::print_stdout, clippy::print_stderr)]

//! TMC plugin for make.

mod check_log;
Expand Down
2 changes: 2 additions & 0 deletions plugins/notests/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(clippy::print_stdout, clippy::print_stderr, clippy::unwrap_used)]

//! Language plugin for no_tests exercises.

mod plugin;
Expand Down
2 changes: 2 additions & 0 deletions plugins/python3/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(clippy::print_stdout, clippy::print_stderr)]

//! Implementation of LanguagePlugin for Python 3.

mod error;
Expand Down
2 changes: 2 additions & 0 deletions plugins/r/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(clippy::print_stdout, clippy::print_stderr)]

//! Language plugin for the R language

mod error;
Expand Down
2 changes: 2 additions & 0 deletions tmc-client/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(clippy::print_stdout, clippy::print_stderr)]

//! Used to communicate with the TMC server. See the TmcClient struct for more details.
//!
//! ```rust,no_run
Expand Down
13 changes: 9 additions & 4 deletions tmc-client/src/tmc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,12 @@ impl TmcClient {
None,
);

// for each exercise, check if there's already something on disk
// if yes, check if it needs updating
// if not, check if there's a previous submission
// if yes, download it
// if not, download the exercise template

let thread_count = exercises_len.min(4); // max 4 threads
let mut handles = vec![];
let exercises = Arc::new(Mutex::new(exercises));
Expand All @@ -248,7 +254,7 @@ impl TmcClient {
// repeat until out of exercises
loop {
// acquiring mutex
let mut exercises = exercises.lock().unwrap(); // the threads should never panic
let mut exercises = exercises.lock().expect("the threads should never panic");
let (exercise_id, target) = if let Some((id, path)) = exercises.pop() {
(id, path)
} else {
Expand Down Expand Up @@ -319,8 +325,7 @@ impl TmcClient {
let mut successful = vec![];
let mut failed = vec![];
for handle in handles {
// the threads should never panic
match handle.join().unwrap() {
match handle.join().expect("the threads should never panic") {
Ok(s) => successful.extend(s),
Err((s, f)) => {
successful.extend(s);
Expand Down Expand Up @@ -370,7 +375,7 @@ impl TmcClient {

pub fn get_exercises_details(
&self,
exercise_ids: Vec<usize>,
exercise_ids: &[usize],
) -> Result<Vec<ExercisesDetails>, ClientError> {
self.core_exercise_details(exercise_ids)
}
Expand Down
2 changes: 1 addition & 1 deletion tmc-client/src/tmc_client/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ impl TmcClient {

pub(super) fn core_exercise_details(
&self,
exercise_ids: Vec<usize>,
exercise_ids: &[usize],
) -> Result<Vec<ExercisesDetails>, ClientError> {
if self.0.token.is_none() {
return Err(ClientError::NotLoggedIn);
Expand Down
7 changes: 3 additions & 4 deletions tmc-langs-cli/src/app.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
//! Create clap app

use crate::output::{
CombinedCourseData, DownloadOrUpdateCourseExercisesResult, LocalExercise, UpdatedExercise,
};
use crate::output::{LocalExercise, UpdatedExercise};
use clap::{App, AppSettings, Arg, SubCommand};
use schemars::JsonSchema;
use std::path::PathBuf;
use tmc_langs::{
data::{CombinedCourseData, DownloadOrUpdateCourseExercisesResult},
CourseData, CourseDetails, CourseExercise, ExerciseDesc, ExerciseDetails,
ExercisePackagingConfiguration, NewSubmission, Organization, Review, RunResult,
StyleValidationResult, Submission, SubmissionFeedbackResponse, SubmissionFinished,
Expand Down Expand Up @@ -311,7 +310,7 @@ fn create_core_app() -> App<'static, 'static> {
.subcommand(SubCommand::with_name("download-old-submission")
.about("Downloads an old submission. Resets the exercise at output-path if any, downloading the exercise base from the server. The old submission is then downloaded and extracted on top of the base, using the student file policy to retain student files")
.long_about(SCHEMA_NULL)
.arg(Arg::with_name("save-old-state")
.arg(Arg::with_name("save-old-state") // TODO: unnecessary, remove (submission-url is enough, but probaly needs a rename if the flag is removed)
.help("If set, the exercise is submitted to the server before resetting it.")
.long("save-old-state")
.requires("submission-url"))
Expand Down
229 changes: 0 additions & 229 deletions tmc-langs-cli/src/config.rs

This file was deleted.

Loading