Skip to content

Commit

Permalink
Fix #426 - 0.21.1 [release]
Browse files Browse the repository at this point in the history
  • Loading branch information
Kampfkarren committed Sep 19, 2022
1 parent 266bda8 commit 55f7b61
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [Unreleased](https://github.com/Kampfkarren/selene/compare/0.20.0...HEAD)

## [0.21.1](https://github.com/Kampfkarren/selene/releases/tag/0.21.0) - 2022-09-19
### Fixed
- Fixed not being able to use projects without selene.toml.

## [0.21.0](https://github.com/Kampfkarren/selene/releases/tag/0.21.0) - 2022-09-17

### Added
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion selene-lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "selene-lib"
version = "0.21.0"
version = "0.21.1"
license = "MPL-2.0"
authors = ["Kampfkarren <[email protected]>"]
description = "A library for linting Lua code. You probably want selene instead."
Expand Down
12 changes: 9 additions & 3 deletions selene-lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,25 @@ impl Error for CheckerError {}
pub struct CheckerConfig<V> {
pub config: HashMap<String, V>,
pub rules: HashMap<String, RuleVariation>,
pub std: String,
pub std: Option<String>,

// Not locked behind Roblox feature so that selene.toml for Roblox will
// run even without it.
pub roblox_std_source: RobloxStdSource,
}

impl<V> CheckerConfig<V> {
pub fn std(&self) -> &str {
self.std.as_deref().unwrap_or("lua51")
}
}

impl<V> Default for CheckerConfig<V> {
fn default() -> Self {
CheckerConfig {
config: HashMap::new(),
rules: HashMap::new(),
std: "".to_owned(),
std: None,
roblox_std_source: RobloxStdSource::default(),
}
}
Expand Down Expand Up @@ -210,7 +216,7 @@ macro_rules! use_rules {

context: Context {
standard_library,
standard_library_is_set: !config.std.is_empty(),
standard_library_is_set: config.std.is_some(),
},

config,
Expand Down
4 changes: 2 additions & 2 deletions selene/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "selene"
version = "0.21.0"
version = "0.21.1"
license = "MPL-2.0"
authors = ["Kampfkarren <[email protected]>"]
description = "A blazing-fast modern Lua linter written in Rust"
Expand All @@ -23,7 +23,7 @@ glob = "0.3"
lazy_static = "1.4"
num_cpus = "1.10"
profiling = { version = "1.0.6" }
selene-lib = { path = "../selene-lib", version = "=0.21.0", default-features = false }
selene-lib = { path = "../selene-lib", version = "=0.21.1", default-features = false }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_yaml = "0.8.24"
Expand Down
6 changes: 3 additions & 3 deletions selene/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ fn start(mut matches: opts::Options) {
let current_dir = std::env::current_dir().unwrap();

let standard_library =
match standard_library::collect_standard_library(&config, &config.std, &current_dir) {
match standard_library::collect_standard_library(&config, config.std(), &current_dir) {
Ok(Some(library)) => library,

Ok(None) => {
Expand All @@ -441,7 +441,7 @@ fn start(mut matches: opts::Options) {

Err(error) => {
let missing_files: Vec<_> = config
.std
.std()
.split('+')
.filter(|name| {
!PathBuf::from(format!("{name}.yml")).exists()
Expand All @@ -453,7 +453,7 @@ fn start(mut matches: opts::Options) {
if !missing_files.is_empty() {
eprintln!(
"`std = \"{}\"`, but some libraries could not be found:",
config.std
config.std()
);

for library_name in missing_files {
Expand Down

0 comments on commit 55f7b61

Please sign in to comment.