Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add clippy and Rustfmt to CI #320

Merged
merged 3 commits into from
Oct 31, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Run clippy
run: cargo clippy
- name: Run Rustfmt
run: cargo fmt -- --check
- name: Run tests (selene, all features)
run: cargo test
working-directory: selene
Expand Down
35 changes: 20 additions & 15 deletions selene/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,31 +404,36 @@ fn start(matches: opts::Options) {
}

Err(_) => {
if cfg!(feature = "roblox") && config.std.split('+').any(|name| name == "roblox") {
if !Path::new("roblox.toml").exists() {
eprint!("Roblox standard library could not be found in this directory. ");
eprintln!("We are automatically generating one for you now!");

eprint!("By the way, you can do this manually in the future if you need ");
eprint!("to use new Roblox features with: ");
eprintln!("`selene generate-roblox-std`.");

if let Err(error) = generate_roblox_std(false) {
error!("Could not create roblox standard library: {}", error);
std::process::exit(1);
}
if cfg!(feature = "roblox")
&& config.std.split('+').any(|name| name == "roblox")
&& !Path::new("roblox.toml").exists()
{
eprint!("Roblox standard library could not be found in this directory. ");
eprintln!("We are automatically generating one for you now!");

eprint!("By the way, you can do this manually in the future if you need ");
eprint!("to use new Roblox features with: ");
eprintln!("`selene generate-roblox-std`.");

if let Err(error) = generate_roblox_std(false) {
error!("Could not create roblox standard library: {}", error);
std::process::exit(1);
}
}

let missing_files: Vec<PathBuf> = config.std
let missing_files: Vec<PathBuf> = config
.std
.split('+')
.map(|name| format!("{}.toml", name))
.map(|name| PathBuf::from(&name))
.filter(|path| !path.exists())
.collect();

if !missing_files.is_empty() {
eprintln!("`std = \"{}\"`, but some files could not be found:", config.std);
eprintln!(
"`std = \"{}\"`, but some files could not be found:",
config.std
);

for path in missing_files {
eprintln!(" `{}`", path.display());
Expand Down