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

Fix shebang language detection #471

Merged
merged 7 commits into from Mar 23, 2020
Merged

Fix shebang language detection #471

merged 7 commits into from Mar 23, 2020

Conversation

@solanav
Copy link
Contributor

solanav commented Mar 22, 2020

Closes #431.

Adds the shebang_paths property to languages.json.

Also adds from_file_extension and from_shebang_path to LanguageType, making from_path more clear.

@solanav

This comment has been minimized.

Copy link
Contributor Author

solanav commented Mar 22, 2020

I ended up using

match extension {
    Some(extension) => LanguageType::from_file_extension(extension.as_str()),
    None => LanguageType::from_shebang_path(&entry),
}

because I had some problems with the .map().or_else(), and this way looks clearer.

Copy link
Owner

XAMPPRocky left a comment

Thank you for your PR, I've left some final pieces of feedback, once those have been addressed I would be happy to merge this in!

src/language/language_type.hbs.rs Outdated Show resolved Hide resolved
src/language/language_type.hbs.rs Outdated Show resolved Hide resolved
src/language/language_type.hbs.rs Outdated Show resolved Hide resolved
src/language/language_type.hbs.rs Outdated Show resolved Hide resolved
@solanav solanav requested a review from XAMPPRocky Mar 22, 2020
@XAMPPRocky

This comment has been minimized.

Copy link
Owner

XAMPPRocky commented Mar 23, 2020

Looks good! It seems it's now failing the test suite now though.

src/language/language_type.hbs.rs Outdated Show resolved Hide resolved
src/language/language_type.hbs.rs Outdated Show resolved Hide resolved
@XAMPPRocky

This comment has been minimized.

Copy link
Owner

XAMPPRocky commented Mar 23, 2020

Thank you again for your PR, and congrats on your first contribution! 🎉

@XAMPPRocky XAMPPRocky merged commit 5cf5bd2 into XAMPPRocky:master Mar 23, 2020
100 checks passed
100 checks passed
install-cross (linux-musl)
Details
install-cross (apple-darwin)
Details
windows (stable, i686-pc-windows-msvc)
Details
windows (stable, x86_64-pc-windows-msvc)
Details
windows (beta, i686-pc-windows-msvc)
Details
windows (beta, x86_64-pc-windows-msvc)
Details
windows (nightly, i686-pc-windows-msvc)
Details
windows (nightly, x86_64-pc-windows-msvc)
Details
macos (stable, x86_64-apple-darwin)
Details
macos (stable, aarch64-apple-ios)
Details
macos (stable, x86_64-apple-ios)
Details
macos (beta, x86_64-apple-darwin)
Details
macos (beta, aarch64-apple-ios)
Details
macos (beta, x86_64-apple-ios)
Details
macos (nightly, x86_64-apple-darwin)
Details
macos (nightly, aarch64-apple-ios)
Details
macos (nightly, x86_64-apple-ios)
Details
linux (stable, aarch64-unknown-linux-gnu)
Details
linux (stable, aarch64-unknown-linux-musl)
Details
linux (stable, arm-unknown-linux-gnueabi)
Details
linux (stable, arm-unknown-linux-gnueabihf)
Details
linux (stable, arm-unknown-linux-musleabi)
Details
linux (stable, arm-unknown-linux-musleabihf)
Details
linux (stable, armv5te-unknown-linux-musleabi)
Details
linux (stable, armv7-unknown-linux-gnueabihf)
Details
linux (stable, armv7-unknown-linux-musleabihf)
Details
linux (stable, i586-unknown-linux-gnu)
Details
linux (stable, i586-unknown-linux-musl)
Details
linux (stable, i686-unknown-linux-gnu)
Details
linux (stable, i686-unknown-linux-musl)
Details
linux (stable, mips-unknown-linux-gnu)
Details
linux (stable, mips-unknown-linux-musl)
Details
linux (stable, mips64-unknown-linux-gnuabi64)
Details
linux (stable, mips64el-unknown-linux-gnuabi64)
Details
linux (stable, mipsel-unknown-linux-gnu)
Details
linux (stable, mipsel-unknown-linux-musl)
Details
linux (stable, powerpc-unknown-linux-gnu)
Details
linux (stable, powerpc64-unknown-linux-gnu)
Details
linux (stable, powerpc64le-unknown-linux-gnu)
Details
linux (stable, s390x-unknown-linux-gnu)
Details
linux (stable, x86_64-unknown-linux-gnu)
Details
linux (stable, x86_64-unknown-linux-musl)
Details
linux (stable, sparc64-unknown-linux-gnu)
Details
linux (stable, aarch64-linux-android)
Details
linux (stable, arm-linux-androideabi)
Details
linux (stable, armv7-linux-androideabi)
Details
linux (stable, i686-linux-android)
Details
linux (stable, x86_64-linux-android)
Details
linux (stable, x86_64-unknown-netbsd)
Details
linux (stable, sparcv9-sun-solaris)
Details
linux (stable, x86_64-sun-solaris)
Details
linux (beta, aarch64-unknown-linux-gnu)
Details
linux (beta, aarch64-unknown-linux-musl)
Details
linux (beta, arm-unknown-linux-gnueabi)
Details
linux (beta, arm-unknown-linux-gnueabihf)
Details
linux (beta, arm-unknown-linux-musleabi)
Details
linux (beta, arm-unknown-linux-musleabihf)
Details
linux (beta, armv5te-unknown-linux-musleabi)
Details
linux (beta, armv7-unknown-linux-gnueabihf)
Details
linux (beta, armv7-unknown-linux-musleabihf)
Details
linux (beta, i586-unknown-linux-gnu)
Details
linux (beta, i586-unknown-linux-musl)
Details
linux (beta, i686-unknown-linux-gnu)
Details
linux (beta, i686-unknown-linux-musl)
Details
linux (beta, mips-unknown-linux-gnu)
Details
linux (beta, mips-unknown-linux-musl)
Details
linux (beta, mips64-unknown-linux-gnuabi64)
Details
linux (beta, mips64el-unknown-linux-gnuabi64)
Details
linux (beta, mipsel-unknown-linux-gnu)
Details
linux (beta, mipsel-unknown-linux-musl)
Details
linux (beta, powerpc-unknown-linux-gnu)
Details
linux (beta, powerpc64-unknown-linux-gnu)
Details
linux (beta, powerpc64le-unknown-linux-gnu)
Details
linux (beta, s390x-unknown-linux-gnu)
Details
linux (beta, x86_64-unknown-linux-gnu)
Details
linux (beta, x86_64-unknown-linux-musl)
Details
linux (beta, sparc64-unknown-linux-gnu)
Details
linux (beta, aarch64-linux-android)
Details
linux (beta, arm-linux-androideabi)
Details
linux (beta, armv7-linux-androideabi)
Details
linux (beta, i686-linux-android)
Details
linux (beta, x86_64-linux-android)
Details
linux (beta, x86_64-unknown-netbsd)
Details
linux (beta, sparcv9-sun-solaris)
Details
linux (beta, x86_64-sun-solaris)
Details
linux (nightly, aarch64-unknown-linux-gnu)
Details
linux (nightly, aarch64-unknown-linux-musl)
Details
linux (nightly, arm-unknown-linux-gnueabi)
Details
linux (nightly, arm-unknown-linux-gnueabihf)
Details
linux (nightly, arm-unknown-linux-musleabi)
Details
linux (nightly, arm-unknown-linux-musleabihf)
Details
linux (nightly, armv5te-unknown-linux-musleabi)
Details
linux (nightly, armv7-unknown-linux-gnueabihf)
Details
linux (nightly, armv7-unknown-linux-musleabihf)
Details
linux (nightly, i586-unknown-linux-gnu)
Details
linux (nightly, i586-unknown-linux-musl)
Details
linux (nightly, i686-unknown-linux-gnu)
Details
linux (nightly, i686-unknown-linux-musl)
Details
linux (nightly, mips-unknown-linux-gnu)
Details
linux (nightly, mips-unknown-linux-musl)
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants
You can’t perform that action at this time.