Git Product home page Git Product logo

cargo-compete's People

Contributors

aoriso avatar bors[bot] avatar bouzuya avatar gitter-badger avatar matsu7874 avatar nebocco avatar qryxip avatar sgthr7 avatar tamuhey avatar yosuke-oka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cargo-compete's Issues

cannot create files and testcases for "Ex" problem in ABC

This problem happens ABC233 and later ABCs.
In these contest, the name of 8th problem is changed to "Ex" while the URL's letter is "h".

The "run" function of new.rs creates "file_paths", the vector of pair of src path and testcase path.
At the moment of the creation, the order of src_path is alphabetical order, while testcase is problem order.
This makes unexpected "file_paths" variable like this: [ ... (e.rs, e.yml), (ex.rs, f.yml), (f.rs, g.yml), (g.rs, ex.yml)]

Generate Rust unit tests

このようなテンプレートにRustのユニットテストを生成するようにすればVSCodeとかのGUIデバッガで動かせて便利なのではという考え。やるとすればproc-macroも良いが完全にstdのみで動く簡潔なテストがベストか。

use proconio::source::once::OnceSource;
use std::io::Write;

fn main() {
    let mut input = ::std::string::String::new();
    ::std::io::Read::read_to_string(&mut std::io::stdin(), &mut input).unwrap();
    let stdout = ::std::io::stdout();
    let mut output = ::std::io::BufWriter::new(stdout.lock());
    crate::solve(&input, &mut output);
    ::std::io::Write::flush(&mut output).unwrap();
}

fn solve<S: AsRef<str>, W: Write>(input: S, mut output: W) {
    let input = input.as_ref();
    let mut input = OnceSource::from(input);
    macro_rules! input(($($tt:tt)*) => (proconio::input!(from &mut input, $($tt)*)));
    macro_rules! println(($($tt:tt)*) => (writeln!(output, $($tt)*).unwrap()));

    input! {
        n: usize,
    }

    println!("{}", 2 * n);
}

Output of `cargo compete open` is cleared in Windows Terminal

It seems that the terminal is cleared after printing message when using Windows Terminal.

example

How to reproduce

cargo new practice  # platform=atcoder
cd practice
cargo compete open

Note:
This works flawlessly in a terminal of VS Code.

Expected output:

$ cargo compete open    
     Opening https://atcoder.jp/contests/practice/tasks/practice_1
     Opening https://atcoder.jp/contests/practice/tasks/practice_2

Environment

OS: Ubuntu 20.04.3 on Windows10 21H1 (WSL2)
Windows Terminal: 1.10.2383.0
cargo-compete: 0.9.0

Tests fail when the expected output is empty

  • 環境: macOS Big Sur
  • cargo-compete version 0.8.7

cargo compete test の際に、期待出力が空文字だと、
println!("")のような空文字(改行あり)出力はWrong Answerになります。

print!("")だと通るので、"" != \nなのだと思います。

AtCoderではprintln!("") でも空文字として通ります。

例えば、↓などです。
https://atcoder.jp/contests/dp/tasks/dp_f

よろしくお願いします🙇‍♂️

Add mention for --exclude-atcoder-crates for submit.transpile in README.md

cargo equip を使ってatcoderに提出する際、compete.toml の submit.transpile のコメントアウトを外すだけだとエラーが起きます。
エラーメッセージで"--exclude-atcoder-crates"、を足せばいいと出るので修正自体は楽なのですが、README.md やREADME-ja.mdに記載があると親切かなと思いましたが、いかがでしょうか。

`cargo compete new` fails if the contest name contains '-'.

nikkei2019-2-qualdwacon6th-prelimsなどのコンテスト名にハイフンが入る場合処理の途中でエスケープされてしまい、cargo compete newが失敗するようです

$ cargo compete -V
cargo-compete 0.7.1
$ cargo compete new nikkei2019-2-qual
error: Invalid character `%` in crate name: `nikkei2019%2D2%2Dqual`
error: `*********/.rustup/toolchains/1.42.0-x86_64-unknown-linux-gnu/bin/cargo new -q --vcs none --name 'nikkei2019%2D2%2Dqual' '*************/./nikkei2019%2D2%2Dqual'` didn't exit successfully: exit code: 101

(一部パスを伏せました)

v0.7.0からこの問題が発生してるようです(v0.7.1, v0.7.0で発生を確認しましたが、v0.6.5では発生しませんでした)

Use `krates` crate

krates

cargo_metadataクレートの拡張。cargo-denyの一部として作られたっぽい。 cargo metadataコマンドの発行が改善されてるしpackage specのパースまである。

Use independent `target_dir` for the `test`

Hello from rust-analyzer! We might still revert the change that prompted this, but this PR seems like a good idea anyway.

My suggestion here would be to set a different target directory (CARGO_TARGET_DIR) for cargo-compete. If you use the same one, rust-analyzer's check on save and cargo-compete will block each other and overwrite their build artifacts.

Originally posted by @lnicola in #172 (comment)

テストケースを取得できないコンテストがある

abc003のテストケースを取得しようとしたのですが下記エラーが発生しテストケースを取得できませんでした。

再現方法

$ cargo compete new abc003
error: Could not extract the timelimit

環境

macOS 10.13.6

$ cargo compete --version
cargo-compete 0.4.1
$ rustc --version
rustc 1.42.0 (b8cedc004 2020-03-09)

Is `cross` working?

まさかとは思うが... (cross、rootless Dockerで動かないみたいだしrootlessじゃない方なりPodmanなりで試さないと)

Ex 問題を読み込めない

% cargo compete new abc234
warning: Could not parse the title: "Ex - Enumerate Pairs"
warning: Could not find `EX` in `tasks_print`
     Created `abc234` package at /xx/atcoder/./abc234
       Saved 3 test cases to /xxx/atcoder/./abc234/testcases/{a.yml, a/}
       Saved 2 test cases to /xxx/atcoder/./abc234/testcases/{b.yml, b/}
       Saved 3 test cases to /xxx/atcoder/./abc234/testcases/{c.yml, c/}
       Saved 2 test cases to /xxx/atcoder/./abc234/testcases/{d.yml, d/}
       Saved 3 test cases to /xxx/atcoder/./abc234/testcases/{e.yml, e/}
       Saved 3 test cases to /xxx/atcoder/./abc234/testcases/{f.yml, f/}
       Saved 3 test cases to /xxx/atcoder/./abc234/testcases/{g.yml, g/}

おそらくここを

https://github.com/qryxip/snowchains/blob/519a454bc6087dbc81fad276a86d9b53d492844b/snowchains_core/src/web/atcoder.rs#L1537

A-Za-z0-9 にすればパースできるようになりそうです

ただ二個目の警告文から分かる通り、内部のどこかで "Ex""EX" に変換されてしまっていることに起因しているエラーもあるように思うのですが、正確な発生箇所は分かりませんでした

No such file or directory (os error 2)

Arch Linux on Windows 10 x86_64にて cargo compete test or cargo compete submit を実行すると以下のようなエラーが起きる

❯ cargo compete test c
error: /home/user/atcoder/abc238/testcases/c: IO error for operation on /home/user/atcoder/abc238/testcases/c: No such file or directory (os error 2)

New format for `package.metadata.cargo-compete.bin`

このような形式を追加する。この"a""b"bin_indexのような適当な名前で呼んでいたが、「bin.nameのalias」という形にしてしまう。

 [package.metadata.cargo-compete.bin]
-a = { name = "practice-a", problem = "https://atcoder.jp/contests/practice/tasks/practice_1" }
-b = { name = "practice-b", problem = "https://atcoder.jp/contests/practice/tasks/practice_2" }
+practice-a = { alias = "a", problem = "https://atcoder.jp/contests/practice/tasks/practice_1" }
+practice-b = { alias = "b", problem = "https://atcoder.jp/contests/practice/tasks/practice_2" }

compete test process becomes Zombie when the program has infinite loop

  • 環境: macOS Big Sur
  • cargo-compete version 0.8.4

プログラムに無限ループ箇所がある状態で cargo compete test abcxxx-x としてテストすると Timelimit Exceeded になりますが、
その際に親プロセスだけがkillされてゾンビ子プロセスが残ります

Screen Shot 2021-02-22 at 14 49 43

軽くコードを見たところ、judge自体は snowchains でやっているようなのでそちらの問題なのかもしれませんが。
ひとまずこちらにIssueを投げます

よろしくお願いします🙇‍♂️

Open problem pages in the reverse order

Currently, cargo compete open open pages in ascending order of difficulty (A to F in AtCoder), but I think this should be done in the reverse order.
This is because the most difficult problem is shown in a browser after executing the command.

possibly related code:

for url in urls {
let url = url.borrow();
shell.status("Opening", url)?;
opener::open(url.as_str())?;
}

Add `test.toolchain` configuration

rust-analyzerはRust 1.47+に対してはproc-macroの展開をやってくれるようなのでrust-toolchainファイルを1.47.0にしてtest1.42.0で、という運用を可能にするための設定。

Stop managing workspaces

パッケージをワークスペースで管理する意味が薄くなってきたんじゃないかと思って。

というのも数十数百のパッケージを一度に登録するとrust-analyzer等に負担がかかってくる。

omg

そもそもワークスペースで管理し始めたのがビルドキャッシュの共有するためであるが、target dirをsymlinkしたりしたら動作は保証されないしCLIで--target-dirを指定するにしてもエディタの設定に食い込む必要がある... と思っていたのだがcargo configurationの設定にbuild.target-dirというやつがあった。

以下のような方針でやればよさそう。

  • cargo compete newの起点をワークスペースからcompete.tomlにして、それの場所をpackage.metadataに記載する
  • rust-toolchaincompete.tomlに書いたやつをnew時に生成
  • binのリネームはそのまま (target dirを使い回す以上、バッティングはしないほうが良い)

現在の懸念は以下の通り。

  1. 設定ファイル(Cargo.tomlを含む)のbreaking change
  2. VimとEmacsとIntelliJ *で動くか

(request) more default size for display-limit for stderr

stderrが発生した時のログについて、デフォルト値を大きくすることはできないでしょうか?
stderrに何も表示されない場合、デバッグに苦労します。
RUST_BACKTRACE=1をセットしていることもあり、REが発生すると、すぐにデフォルトの4096バイトを超えてしまいます。

(English)
I want to set more large size of display-limit as default value.
When "stderr" does not displays error test itself, it is difficult for me to find the cause.
This happens mainly in RE case, because I set =RUST_BACKTRACE=1` for debugging.

URLに英大文字が含まれていると`cargo compete submit`できない

Cargo.toml内のpackage.metadata.cargo-compete.binproblemに設定されているURLに英大文字が含まれているとerror: Could not extract screen name of the problemというエラーが出てきてcargo compete submitができません

この事象はAtCoderのCODE FESTIVAL 2016 qual Aで発生しました
このコンテストでは、各タスクのURLに英大文字が含まれています (例: https://atcoder.jp/contests/code-festival-2016-quala/tasks/codefestival_2016_qualA_a の最後のqualAの部分)
URLのqualAの部分を手動でqualaへ置き換えたところ、問題なく提出できましたが、バグだと思われるので念のため報告しておきます

実行環境:
OS: MacOS Monterey 12.1 Beta (21C5039b)
Version:

  • cargo-compete 0.10.0
  • cargo 1.42.0 (86334295e 2020-01-31)

Simplify `package.metadata.cargo-compete.bin.*.problem`

URLだけで問題を識別するようにする。ojが長年これで上手くいってるしURL単体からでもコンテストのIDは取れるはず。

[package.metadata.cargo-compete.bin]
a = { name = "practice-a", problem = "https://atcoder.jp/contests/practice/tasks/practice_1" }
b = { name = "practice-b", problem = "https://atcoder.jp/contests/practice/tasks/practice_2" }

`new.template.lockfile` is not read

なんか最近コンテストの度にクレートが再コンパイルされるなと思ったらCargo.lockが展開されてなかった...

cargo compete n abc191
     Created `abc191` package at /home/ryo/src/competitive/atcoder/./abc191
       Saved 2 test cases to /home/ryo/src/competitive/atcoder/./abc191/testcases/a.yml
       Saved 2 test cases to /home/ryo/src/competitive/atcoder/./abc191/testcases/b.yml
       Saved 1 test case to /home/ryo/src/competitive/atcoder/./abc191/testcases/c.yml
       Saved 3 test cases to /home/ryo/src/competitive/atcoder/./abc191/testcases/d.yml
       Saved 3 test cases to /home/ryo/src/competitive/atcoder/./abc191/testcases/e.yml
       Saved 3 test cases to /home/ryo/src/competitive/atcoder/./abc191/testcases/f.ymlll abc191 
.rw-r--r-- 3.2k ryo ryo 2021-02-19 16:15 -N Cargo.toml
drwxr-xr-x    - ryo ryo 2021-02-19 16:15 -N src
drwxr-xr-x    - ryo ryo 2021-02-19 16:15 -N testcases

Add `new.template.profile`

profileを書くことでdebug-assertionsoverflow-checksを有効にしたままTLEしない程度のopt-levelを設定できる。しかし現在、設定ファイルにはこれに対応する項目が無い。

[profile.dev]
opt-level = 2

Add an option that creates one package for the `init` command, and remove the `new` function for yukicoder

yukicoder(やLibrary Checker)用にはinit時にこのようなパッケージを作り,コンテストに参加するときはaddコマンドを使ってもらう.

.
├── Cargo.lock
├── compete.toml
├── rust-toolchain
└── src
    └── bin
        └── dummy.rs
[package.metadata.cargo-compete.bin]
dummy = { problem = "https://example.com" }
  • compete.tomlnew.templateをどこかに移動
  • compete.tomlnewをoptionalに

The `add` command should sort `package.metadata.cargo-compete.bin`

今の仕様だと単にappendするだけなので適切な場所に挿入するか,末尾に追加したあとにソートする.

[package.metadata.cargo-compete.bin]
9001 = {problem = "https://yukicoder.me/problems/no/9001"}
1358 = {problem = "https://yukicoder.me/problems/no/1358"}
1359 = {problem = "https://yukicoder.me/problems/no/1359"}
1360 = {problem = "https://yukicoder.me/problems/no/1360"}
1361 = {problem = "https://yukicoder.me/problems/no/1361"}
1362 = {problem = "https://yukicoder.me/problems/no/1362"}
1363 = {problem = "https://yukicoder.me/problems/no/1363"}
1364 = {problem = "https://yukicoder.me/problems/no/1364"}
1365 = {problem = "https://yukicoder.me/problems/no/1365"}

"--display-limit" option does not work

stderrの内容が表示されないことが多いため、デバッグに苦労します。
これ場合にほとんど表示されないため、
このため--display-limit の指定を試しているのですが、"no multiple"というよくわからないエラーが返ってきます。(複数の値を受け付けられない?)
このオプションはどう使えばよいのでしょうか?

> cargo compete new abc240
> cd abc240
> cargo compete test --display-limit 10000 e
error: Invalid value for '--display-limit <SIZE>': no multiple
> cargo compete test e --display-limit 10000
error: Invalid value for '--display-limit <SIZE>': no multiple

`error: expected [200, 302], got 404 Not Found`

Successfully submitted the code
┌───────────────────┬───────────────────────────────────────────────────────────┐
│ Language ID       │ 4050                                                      │
├───────────────────┼───────────────────────────────────────────────────────────┤
│ Size              │ 228                                                       │
├───────────────────┼───────────────────────────────────────────────────────────┤
│ URL (submissions) │ https://atcoder.jp/contests/practice/submissions/me       │
├───────────────────┼───────────────────────────────────────────────────────────┤
│ URL (detail)      │ https://atcoder.jp/contests/practice/submissions/18710212 │
└───────────────────┴───────────────────────────────────────────────────────────┘
error: expected [200, 302], got 404 Not Found
  • 提出自体はちゃんとされている。
  • 直後にcargo compete w sするとちゃんと表示される。

今日はABCがあるのでその数時間前にはworkaroundを追加する。

[Feature Request] Open submitted result URL in a browser

Thank you for providing useful tools.
便利なツールを提供していただいてありがとうございます。

I execute the command as follows when submitted:
私は提出するときに次のようにコマンドを実行し、

cargo compete submit --no-test --no-watch 001

A browser is opened in a browser that is fixed after the displayed submission
表示された提出後に確定されるURLをブラウザで開いています

│ URL (detail) │ https://atcoder.jp/contests/math-and-algorithm/submissions/30714538

This is because the eshell environment of Emacs is not compatible with the process of updating the console in real time in the escape sequence.
というのも使っている Emacs の eshell という環境が、エスケープシーケンスでコンソールをリアルタイムに更新するような処理に対応していないためです。

Sorry to be compared to other tools, but at atcoder-cli simply, it is helped to open a browser after the submission.
他のツールと比較して申し訳ありませんが atcoder-cli では単に提出後のURLをブラウザを開いてくれるので助かっています。

cargo compete submit is only appreciated that there is a function that opens the URL after the submission to open the browser.
cargo compete submit のときに単に提出後のURLをブラウザで開く機能(オプション)があるとありがたいです。

Please consider.
ご検討お願いいたします。

`--src` option for the `test` command

$ cargo compete t a

のかわりに

$ cargo compete t --src ./src/bin/a.rs

のようにできるとエディタから呼ぶときに便利なのでは。

[Feature Request] ascending order of date for `cargo compete submit` results

It would be great if cargo compete submit command has option to print submission results in ascending order of date, because descending order is hard to see the latest result if terminal height is small.

current:

$ cargo compete submit practice-a
│ 2021-09-19 08:46:14 +09:00 │ A - Welcome to AtCoder  │ Rust (1.42.0) │ WJ                          │
│ 2021-09-19 08:21:23 +09:00 │ A - Welcome to AtCoder  │ Rust (1.42.0) │ AC  │    17 ms │    2484 KB │
│ 2021-09-18 23:20:40 +09:00 │ A - Welcome to AtCoder  │ Rust (1.42.0) │ AC  │    19 ms │    2492 KB │
│ 2021-09-18 23:14:15 +09:00 │ A - Welcome to AtCoder  │ Rust (1.42.0) │ AC  │   104 ms │    2892 KB │
│ 2021-09-18 19:07:02 +09:00 │ A - Welcome to AtCoder  │ Rust (1.42.0) │ AC  │     3 ms │    2116 KB │

preferable (I think):

$ cargo compete submit practice-a
│ 2021-09-18 19:07:02 +09:00 │ A - Welcome to AtCoder  │ Rust (1.42.0) │ AC  │     3 ms │    2116 KB │
│ 2021-09-18 23:14:15 +09:00 │ A - Welcome to AtCoder  │ Rust (1.42.0) │ AC  │   104 ms │    2892 KB │
│ 2021-09-18 23:20:40 +09:00 │ A - Welcome to AtCoder  │ Rust (1.42.0) │ AC  │    19 ms │    2492 KB │
│ 2021-09-19 08:21:23 +09:00 │ A - Welcome to AtCoder  │ Rust (1.42.0) │ AC  │    17 ms │    2484 KB │
│ 2021-09-19 08:46:14 +09:00 │ A - Welcome to AtCoder  │ Rust (1.42.0) │ WJ                          │

Rust 1.57.0 on Codeforces

Codeforces での Rust のバージョンが 1.57.0 になったのでそれに合わせてAPIの引数などを書き換えます

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.