Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscerie authored Nov 9, 2023
2 parents 8f86135 + 92afa63 commit ea02fe2
Show file tree
Hide file tree
Showing 24 changed files with 570 additions and 64 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Excludes are now respected for single files.
- Added `no-exclude` cli flag to disable excludes.
- When given in standard library format, additional information now shows up in `incorrect_standard_library_use` missing required parameter errors.
- Added new [`mixed_table` lint](https://kampfkarren.github.io/selene/lints/mixed_table.html), which will warn against mixed tables.
- Added `bit32.byteswap` to Luau standard library
- Added `buffer` library to Luau standard library

### Fixed
- `string.pack` and `string.unpack` now have proper function signatures in the Lua 5.3 standard library.
- Moved `math.log` second argument addition from Lua 5.3 std lib to 5.2 std lib
- `undefined_variable` now correctly errors when defining multiple methods in undefined tables
- Corrected `os.exit` definition in Lua 5.2 standard library
- Fixed `manual_table_clone` incorrectly warning when loop and table are defined at different depths

## [0.25.0](https://github.com/Kampfkarren/selene/releases/tag/0.25.0) - 2023-03-12
### Added
Expand Down
120 changes: 106 additions & 14 deletions Cargo.lock

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

12 changes: 7 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
FROM rust:1.64-bullseye AS selene-builder
ARG RUST_VERSION="1"

FROM rust:${RUST_VERSION}-bullseye AS selene-builder
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install g++ && \
cargo install --branch main --git https://github.com/Kampfkarren/selene selene

FROM rust:1.64-bullseye AS selene-light-builder
FROM rust:${RUST_VERSION}-bullseye AS selene-light-builder
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install g++ && \
cargo install --no-default-features --branch main --git https://github.com/Kampfkarren/selene selene

FROM rust:1.64-alpine3.14 AS selene-musl-builder
FROM rust:${RUST_VERSION}-alpine AS selene-musl-builder
RUN apk add g++ && \
cargo install --branch main --git https://github.com/Kampfkarren/selene selene

FROM rust:1.64-alpine3.14 AS selene-light-musl-builder
FROM rust:${RUST_VERSION}-alpine AS selene-light-musl-builder
RUN apk add g++ && \
cargo install --no-default-features --branch main --git https://github.com/Kampfkarren/selene selene

Expand All @@ -32,4 +34,4 @@ CMD ["/selene"]

FROM bash AS selene-light-musl
COPY --from=selene-light-musl-builder /usr/local/cargo/bin/selene /
CMD ["/selene"]
CMD ["/selene"]
1 change: 1 addition & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- [incorrect_standard_library_use](./lints/incorrect_standard_library_use.md)
- [manual_table_clone](./lints/manual_table_clone.md)
- [mismatched_arg_count](./lints/mismatched_arg_count.md)
- [mixed_table](./lints/mixed_table.md)
- [multiple_statements](./lints/multiple_statements.md)
- [must_use](./lints/must_use.md)
- [parenthese_conditions](./lints/parenthese_conditions.md)
Expand Down
1 change: 1 addition & 0 deletions docs/src/lints/manual_table_clone.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Very little outside this exact pattern is matched. This is the list of circumsta
- Any usage of the output variable in between the definition and the loop (as determined by position in code).
- If the input variable is not a plain locally initialized variable. For example, `self.state[key] = value` will not lint.
- If the input variable is not defined as a completely empty table.
- If the loop and input variable are defined at different depths.

---

Expand Down
14 changes: 14 additions & 0 deletions docs/src/lints/mixed_table.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# mixed_table
## What it does
Checks for mixed tables (tables that act as both an array and dictionary).

## Why this is bad
Mixed tables harms readability and are prone to bugs. There is almost always a better alternative.

## Example
```lua
local foo = {
"array field",
bar = "dictionary field",
}
```
2 changes: 1 addition & 1 deletion docs/src/usage/std.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ globals:
- type: table
- type: number
deprecated:
message: "`table.getn` has been superceded by #."
message: "`table.getn` has been superseded by #."
replace:
- "#%1"
```
Expand Down
2 changes: 1 addition & 1 deletion selene-lib/default_std/lua51.yml
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ globals:
- type: table
- type: number
deprecated:
message: "`table.getn` has been superceded by #."
message: "`table.getn` has been superseded by #."
replace:
- "#%1"
must_use: true
Expand Down
Loading

0 comments on commit ea02fe2

Please sign in to comment.