Skip to content

Commit

Permalink
Add clippy and Rustfmt to CI (#320)
Browse files Browse the repository at this point in the history
* Fix clippy lints, add clippy to CI

* Add Rustfmt to CI, and intentionally fail it

* Fix format
  • Loading branch information
Kampfkarren committed Oct 31, 2021
1 parent 9d56902 commit df18fe2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
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

0 comments on commit df18fe2

Please sign in to comment.