repo_name
stringlengths
1
62
dataset
stringclasses
1 value
lang
stringclasses
11 values
pr_id
int64
1
20.1k
owner
stringlengths
2
34
reviewer
stringlengths
2
39
diff_hunk
stringlengths
15
262k
code_review_comment
stringlengths
1
99.6k
jolpica-f1
github_2023
others
81
jolpica
jolpica
@@ -0,0 +1,204 @@ +# Races + +Gets list of races + +**URL** : `/ergast/f1/races` + +--- + +## Route Parameters: + +### Season + +**Filters for races only from a specified season. Year numbers are valid as is 'current' to get the current season** + +`/{season}/` -> ex: `/ergast/f1/2024/races` + +**Note**: To utilize th...
Would be great if all the possible keys inside a race object could be defined, whether they are conditional or not. No worries if you're unsure of the details, we can iterate on the docs as we spot things.
jolpica-f1
github_2023
python
51
jolpica
jolpica
@@ -4,11 +4,22 @@ from django.db import models +from jolpica.formula_one.models.session import SessionType + if TYPE_CHECKING: from . import Session, SessionEntry from .managed_views import DriverChampionship, TeamChampionship +class RoundType(models.TextChoices): + """The type of round""" + + ...
This should be using SessionType. Round is made of sessions, of which some of those sessions are sprints. We don't want to put a round type here, as we'll just end up with a long list of all possible types and combinations of weekends. We should pick this up implicitly from the sessions found inside a round, as...
jolpica-f1
github_2023
python
51
jolpica
jolpica
@@ -38,6 +40,9 @@ class Meta: def __str__(self) -> str: return f"{self.season.year} {self.name}" + @property + def is_sprint_format(self) -> bool: + return self.sessions.filter(type__in=[SessionType.SPRINT_RACE, SessionType.SPRINT_QUALIFYING1]).exists()
I think it may be better to move this out of here, as it will require more application specific logic to do it right. e.g. all sprint formats? or just ones with points available / set pole position?
jolpica-f1
github_2023
python
51
jolpica
jolpica
@@ -29,7 +29,14 @@ def test_viewsets(client: APIClient, endpoint: str, path: Path, django_assert_ma "http://testserver/ergast/f1/", ) - with django_assert_max_num_queries(10): + if re.match(r"\d{4}.*$", endpoint): + max_queries = 30
I'll be able to bring this down within the 10 query limit with some django magic, so don't worry about this too much.
jolpica-f1
github_2023
python
51
jolpica
jolpica
@@ -118,6 +107,45 @@ def get_qualifying(self, race: Round): def get_sprint(self, race: Round): return self.get_session_date_time(race, SessionType.SPRINT_RACE) + def get_sprint_qualifying(self, race: Round): + return self.get_session_date_time(race, SessionType.SPRINT_QUALIFYING1) + + + cla...
nit-pick: no need for `_round` over `round` as this isn't a class attribute or accessible outside the function
jolpica-f1
github_2023
python
51
jolpica
jolpica
@@ -4,6 +4,8 @@ from django.db import models +from jolpica.formula_one.models.session import SessionType
Please run `make format`, this will clean up and lint the code base. Once I get around to it, it'll also be a requirement to merge via github actions checks.
jolpica-f1
github_2023
python
51
jolpica
jolpica
@@ -1,8 +1,9 @@ from datetime import timedelta -from typing import Any +from typing import Any, Optional
FYI: linting rules will replace `Optional` with `| None` after running `make format`
jolpica-f1
github_2023
python
51
jolpica
jolpica
@@ -118,6 +106,44 @@ def get_qualifying(self, race: Round): def get_sprint(self, race: Round): return self.get_session_date_time(race, SessionType.SPRINT_RACE) + def get_sprint_qualifying(self, race: Round): + return self.get_session_date_time(race, SessionType.SPRINT_QUALIFYING1) + + class...
Does this mean the value of both of these fields will always be identical?
jolpica-f1
github_2023
python
51
jolpica
jolpica
@@ -118,6 +106,44 @@ def get_qualifying(self, race: Round): def get_sprint(self, race: Round): return self.get_session_date_time(race, SessionType.SPRINT_RACE) + def get_sprint_qualifying(self, race: Round): + return self.get_session_date_time(race, SessionType.SPRINT_QUALIFYING1) + + class...
This line is the reason for the large amount of queries. In the view we prefetch the sessions, however this line doesn't use that cache as it performs further filtering (and so has to fetch from the DB again). This results in a query per round. To resolve this we can do some filtering locally in python
jolpica-f1
github_2023
python
52
jolpica
jolpica
@@ -33,7 +33,22 @@ def test_viewsets(client: APIClient, endpoint: str, path: Path, django_assert_ma response = client.get(f"/ergast/f1/{endpoint}") assert response.status_code == 200 + # fetch the same data without the .json suffix and ensure that it matches exactly, + # except for the difference ...
```suggestion html_response = client.get(f"/ergast/f1/{endpoint}".replace(".json", "/"), follow=True) # we need follow=True because the non-json endpoint will redirect from no trailing slash to trailing slash ``` Would this change remove the need for follow?
jolpica-f1
github_2023
python
52
jolpica
jolpica
@@ -69,6 +69,28 @@ def test_viewsets(client: APIClient, endpoint: str, path: Path, django_assert_ma assert result == expected +@pytest.mark.parametrize( + ["endpoint1", "endpoint2"], + [ + # Check json & non-json formats return same data + ("circuits/monza", "circuits/monza.json"), + ...
I've moved these tests into their own test case. Your changes were much more thorough, however they increased testing time by ~25%, which I'd like to avoid if possible. Hope that makes sense
jolpica-f1
github_2023
python
52
jolpica
jolpica
@@ -54,7 +54,7 @@ class ErgastRouter(routers.DefaultRouter): season_criteria = r"(?P<season_year>[0-9]{4}|current)" round_criteria = r"(?P<race_round>[0-9]{1,2}|next|last)" season_round_criteria = f"({season_criteria}/({round_criteria}/)?)?" -regex_criteria = season_round_criteria + f"({'|'.join(criteria)})*" +regex...
Simplified the change to only add the negative lookahead in 1 spot
jolpica-f1
github_2023
python
53
jolpica
jolpica
@@ -165,7 +165,7 @@ class Meta: class ListResultsSerializer(serializers.ListSerializer): - def to_representation(self, data: QuerySet[SessionEntry]) -> Any: + def to_representation(self, data: list[SessionEntry]) -> Any: is_single = False is_qualifying = self.child.results_list_name == "Qua...
I believe it can sometimes be a single instance as in this case here. Since its being updated anyways, could you swap it for `list[SessionEntry] | SessionEntry`? (Unless the assumption in the code is wrong)
mdk2
github_2023
others
46
malforge
malware-dev
@@ -1,84 +1,92 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mdk.Extractor", "Mdk.Extractor\Mdk.Extractor.csproj", "{88AD81CF-B0C0-4D8A-B682-FC0133258810}"
What's with all the changes in _this_ file?
mdk2
github_2023
csharp
46
malforge
malware-dev
@@ -69,6 +69,8 @@ public async Task<Document> ProcessAsync(Document document, IPackContext context //since "#define " is 8 in length
You don't need to parse the value yourself. Take a look at how the #if is parsed. It's already parsed for you, you only need to take the first token and sanity-check it.
mdk2
github_2023
csharp
46
malforge
malware-dev
@@ -69,6 +69,8 @@ public async Task<Document> ProcessAsync(Document document, IPackContext context //since "#define " is 8 in length string extractedDefineString = tmpStr.Substring(8); allExistingLocalDefineBuilder.Add(extractedDefineString);
This shouldn't be necessary anymore at all.
mdk2
github_2023
csharp
46
malforge
malware-dev
@@ -33,6 +33,18 @@ public async Task<Document> ProcessAsync(Document document, IPackContext context Stack<Block> stack = new(); stack.Push(root); var needsMacroCheck = false; + + + ImmutableHashSet<string>.Builder allExistingLocalDefineBuilder = ImmutableHashSet.CreateBuilder<string>()...
You just need the allSymbols list. You could probably use a HashSet<string> in place of a list for quick duplicate rejection. Either way there's no need for multiple lists here, everything must end up in the same place anyway.
mdk2
github_2023
csharp
46
malforge
malware-dev
@@ -33,6 +33,18 @@ public async Task<Document> ProcessAsync(Document document, IPackContext context Stack<Block> stack = new(); stack.Push(root); var needsMacroCheck = false; + + + ImmutableHashSet<string>.Builder allExistingLocalDefineBuilder = ImmutableHashSet.CreateBuilder<string>()...
As mentioned, add these to the allSymbols list
mdk2
github_2023
csharp
46
malforge
malware-dev
@@ -95,8 +119,12 @@ public async Task<Document> ProcessAsync(Document document, IPackContext context stack.Peek().Children.Add(textBlock); } + + List<string> allSymbols = allExistingLocalDefineBuilder.ToList(); ; + var result = new StringBuilder(); - root.Evaluate(context....
allSymbols will never be null when you've made the above changes
mdk2
github_2023
csharp
46
malforge
malware-dev
@@ -244,12 +283,27 @@ readonly struct Token(Kind kind, TextSpan span, string? value = null) abstract class Block { public List<Block> Children { get; } = new(); - public abstract void Evaluate(IImmutableSet<string> macros, StringBuilder result); + public abstract void Evaluate(List<stri...
If you change to a HashSet<string> you don't need to explicitly check if the define already exists
mdk2
github_2023
csharp
46
malforge
malware-dev
@@ -64,12 +67,8 @@ public async Task<Document> ProcessAsync(Document document, IPackContext context if (tokens[0].Kind == Kind.Define) { - TextLine textLineTL = line; - string tmpStr = textLineTL.ToString(); - //since "#define " is 8 i...
This isn't necessary, is it? The block is adding it.
alloy-mev
github_2023
others
8
leruaa
leruaa
@@ -1,6 +1,6 @@ [package] name = "alloy-mev" -version = "0.2.1" +version = "0.3.0"
Can you change the version to 0.2.2 please? As there are no breaking change from 0.2.1
Luminol
github_2023
others
57
LuminolMC
HaHaWTH
@@ -20,7 +20,7 @@ See also [This issue](https://github.com/isaacs/github/issues/1681), and then yo ## Development Environment -Before coding, you need these softwares / tools as Dev Environment. +Before coding, you need these pieces of software / tools as Dev Environment. - `git` - `JDK 17 or higher`
JDK 21
Luminol
github_2023
others
52
LuminolMC
HaHaWTH
@@ -0,0 +1,195 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Suisuroru <qwertyuiop14077@qq.com> +Date: Thu, 20 Feb 2025 01:00:28 +0800 +Subject: [PATCH] Merge Barrels-and-enderchests-6-rows of Purpur to luminol + + +diff --git a/net/minecraft/server/players/PlayerList.java b/net/mine...
Unnecessary diffs here
Luminol
github_2023
others
52
LuminolMC
HaHaWTH
@@ -0,0 +1,195 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Suisuroru <qwertyuiop14077@qq.com> +Date: Thu, 20 Feb 2025 01:00:28 +0800 +Subject: [PATCH] Merge Barrels-and-enderchests-6-rows of Purpur to luminol + + +diff --git a/net/minecraft/server/players/PlayerList.java b/net/mine...
Same as above
Luminol
github_2023
others
52
LuminolMC
HaHaWTH
@@ -0,0 +1,195 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Suisuroru <qwertyuiop14077@qq.com> +Date: Thu, 20 Feb 2025 01:00:28 +0800 +Subject: [PATCH] Merge Barrels-and-enderchests-6-rows of Purpur to luminol + + +diff --git a/net/minecraft/server/players/PlayerList.java b/net/mine...
Rename to `enderChestSlotCount`.
Luminol
github_2023
others
40
LuminolMC
HaHaWTH
@@ -0,0 +1,237 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Quentin GAVOILLE <quentin.gavoille@gmail.com> +Date: Tue, 7 Jan 2025 18:32:38 +0100 +Subject: [PATCH] Toggle-Hopper-Optimization + + +diff --git a/src/main/java/me/earthme/luminol/config/modules/optimizations/HopperOptimiza...
The `return` statement is missing here, is this intentional?
Integrated-Design-Diffusion-Model
github_2023
python
115
chairc
github-advanced-security[bot]
@@ -101,12 +101,12 @@ logger.info(msg="[Web]: Finish generation.") - return jsonify({"code": 200, "msg": "success!", "data": json.dumps(re_json, ensure_ascii=False)}), 200 + return JSONResponse({"code": 200, "msg": "success!", "data": json.dumps(re_json, ensure_ascii=False)}) except Exce...
## Information exposure through an exception [Stack trace information](1) flows to this location and may be exposed to an external user. [Show more details](https://github.com/chairc/Integrated-Design-Diffusion-Model/security/code-scanning/3)
Integrated-Design-Diffusion-Model
github_2023
python
99
chairc
github-advanced-security[bot]
@@ -0,0 +1,121 @@ +#!/usr/bin/env python +# -*- coding:utf-8 -*- +""" + @Date : 2024/11/4 23:04 + @Author : chairc + @Site : https://github.com/chairc +""" +import os +import sys +import json +import logging +import uuid + +import coloredlogs + +from flask import Flask, request, jsonify +from torchvision i...
## Information exposure through an exception [Stack trace information](1) flows to this location and may be exposed to an external user. [Show more details](https://github.com/chairc/Integrated-Design-Diffusion-Model/security/code-scanning/2)
Integrated-Design-Diffusion-Model
github_2023
python
99
chairc
github-advanced-security[bot]
@@ -0,0 +1,121 @@ +#!/usr/bin/env python +# -*- coding:utf-8 -*- +""" + @Date : 2024/11/4 23:04 + @Author : chairc + @Site : https://github.com/chairc +""" +import os +import sys +import json +import logging +import uuid + +import coloredlogs + +from flask import Flask, request, jsonify +from torchvision i...
## Flask app is run in debug mode A Flask app appears to be run in debug mode. This may allow an attacker to run arbitrary code through the debugger. [Show more details](https://github.com/chairc/Integrated-Design-Diffusion-Model/security/code-scanning/1)
yet-another-retnet
github_2023
python
22
fkodom
fkodom
@@ -216,9 +216,9 @@ def retention_chunkwise( torch.arange(key.size(2), device=key.device, dtype=key.dtype) + 1, "n -> () () n ()", ) - states = einsum(key, value, "b h n d1, b h n d2 -> b h n d1 d2") state_decays = decay_gammas ** (key.size(2) - inner_pos) - state = einsum(states, stat...
This is awesome 🔥 Great find, and thanks for another excellent PR!
rimage
github_2023
others
263
SalOne22
Mikachu2333
@@ -59,26 +60,37 @@ impl std::str::FromStr for ResizeValue { type Err = anyhow::Error; fn from_str(s: &str) -> Result<Self, Self::Err> { + let s = s.trim().to_lowercase(); + match s { s if s.starts_with('@') => Ok(Self::Multiplier(s[1..].parse()?)), s if s.ends_with...
if w is contained, that means user input the height of pic. So, why `(?P<width>\d+)`? it should be `(?P<height>\d+)`
rimage
github_2023
others
263
SalOne22
Mikachu2333
@@ -40,7 +40,13 @@ impl OperationsTrait for Resize { fn execute_impl(&self, image: &mut Image) -> Result<(), ImageErrors> { let (src_width, src_height) = image.dimensions(); - let (dst_width, dst_height) = self.new_dimensions; + let (mut dst_width, mut dst_height) = self.new_dimensions;
Actually, this is not elegant, but it's simple and easy to implement
rimage
github_2023
others
243
SalOne22
SalOne22
@@ -1,33 +1,64 @@ [package] -name = "rimage" -version = "0.11.0-next.2" -edition = "2021" -description = "Optimize images natively with best-in-class codecs" -license = "MIT OR Apache-2.0" -readme = "README.md" -authors = ["Vladyslav Vladinov <vladinov.dev@gmail.com>"] -keywords = ["image", "compression", "encoder"] -...
remove here indentation
rimage
github_2023
others
243
SalOne22
SalOne22
@@ -0,0 +1,32 @@ +extern crate winres; +use winres::VersionInfo; + +fn main() { + // only run if target os is windows + if std::env::var("CARGO_CFG_TARGET_OS").unwrap() != "windows" { + println!( + "cargo:warning={:#?}", + "This build script is only for windows target, skipping..." + ...
better use here package info from env variables: - `CARGO_PKG_VERSION` — The full version of your package. - `CARGO_PKG_VERSION_MAJOR` — The major version of your package. - `CARGO_PKG_VERSION_MINOR` — The minor version of your package. - `CARGO_PKG_VERSION_PATCH` — The patch version of your package.
rimage
github_2023
others
226
SalOne22
SalOne22
@@ -55,6 +62,56 @@ pub fn decode<P: AsRef<Path>>(f: P) -> Result<Image, ImageErrors> { return Image::from_decoder(decoder); }; + #[cfg(feature = "tiff")] + if f.as_ref() + .extension() + .is_some_and(|f| f.eq_ignore_ascii_case("tiff") |...
Move this to codecs module. We have exported modules for other users of zune-image so they can use ours codecs
rimage
github_2023
others
226
SalOne22
SalOne22
@@ -55,6 +62,56 @@ pub fn decode<P: AsRef<Path>>(f: P) -> Result<Image, ImageErrors> { return Image::from_decoder(decoder); }; + #[cfg(feature = "tiff")] + if f.as_ref() + .extension() + .is_some_and(|f| f.eq_ignore_ascii_case("tiff") |...
Use `format` macro for messages
rimage
github_2023
others
194
SalOne22
Mikachu2333
@@ -9,7 +10,29 @@ pub mod preprocessors; pub mod utils; pub fn cli() -> Command { - command!().arg_required_else_help(true).codecs() + command!() + .arg_required_else_help(true) + .after_help(indoc! {r#"List of supported codecs
I would like to know if Rust supports displaying the syntax in Markdown format directly, or we should re-format it to make the display of the command-line interface clear and easy to understand.
rimage
github_2023
others
194
SalOne22
Mikachu2333
@@ -9,7 +10,29 @@ pub mod preprocessors; pub mod utils; pub fn cli() -> Command { - command!().arg_required_else_help(true).codecs() + command!() + .arg_required_else_help(true) + .after_help(indoc! {r#"List of supported codecs + + | Image Format | Decoder | Encoder ...
According to the pull: [#166](vscode-file://vscode-app/d:/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-sandbox/workbench/workbench.html), rimage support many format like gif, tga, ico ,etc. should we add it to the help info?
rimage
github_2023
others
194
SalOne22
Mikachu2333
@@ -14,19 +14,20 @@ pub fn cli() -> Command { .arg_required_else_help(true) .after_help(indoc! {r#"List of supported codecs - | Image Format | Decoder | Encoder | - | ------------ | ------------- | ----------------------- | - | bmp | zune-bmp ...
In my opinion, the help information inside the program should be concise and clear, and all possible options must be provided, so I removed some minor information. ReadMe file can be extremely detailed, but the program should still be as concise and easy to understand as possible
rimage
github_2023
others
194
SalOne22
Mikachu2333
@@ -14,25 +14,29 @@ pub fn cli() -> Command { .arg_required_else_help(true) .after_help(indoc! {r#"List of supported codecs -| Image Format | Input | Output | Note | -| ------------- | ----- | ------ | ----------- | -| avif | O | O | Static only | -| bmp | O |...
ok, I'll remove it.
rimage
github_2023
others
194
SalOne22
Mikachu2333
@@ -9,7 +10,31 @@ pub mod preprocessors; pub mod utils; pub fn cli() -> Command { - command!().arg_required_else_help(true).codecs() + command!() + .arg_required_else_help(true) + .after_help(indoc! {r#"List of supported codecs + + +| Image Format | Input | Output | Note | +| -------...
Need to consistent with actual commands
rimage
github_2023
others
195
SalOne22
Mikachu2333
@@ -62,6 +146,11 @@ For library usage check [Docs.rs](https://docs.rs/rimage/latest/rimage/) - Resize - Quantization +## Known bugs
Wrong! This bug was fixed successfully according to the [pull: #189](https://github.com/SalOne22/rimage/pull/189) What we discuss is about the `-d` option, the `-d` option should be palced to the end of the command
rimage
github_2023
others
195
SalOne22
Mikachu2333
@@ -56,12 +140,33 @@ For library usage check [Docs.rs](https://docs.rs/rimage/latest/rimage/) | psd | zune-psd | X | Input only | | jpeg-xl | jxl-oxide | zune-jpegxl | Lossless Output only ...
Don't know the encoder and decoder of these format, need to fill in
rimage
github_2023
others
195
SalOne22
Mikachu2333
@@ -148,21 +148,23 @@ For library usage check [Docs.rs](https://docs.rs/rimage/latest/rimage/) ## Known bugs -- **`-d` arg must be placed at the end of command** due to a rust bug [#72653](https://github.com/rust-lang/rust/issues/72653). - -- Dir path end with `\`, `\\` or `/` may cause rimage crashes, you'd bette...
OK
rimage
github_2023
others
187
SalOne22
SalOne22
@@ -37,19 +37,19 @@ For library usage check [Docs.rs](https://docs.rs/rimage/latest/rimage/) ### List of supported Codecs -| Image Format | Decoder | Encoder | -| ------------ | ------------- | ----------------------- | -| bmp | zune-bmp | - | -| jpeg ...
Does `-` not implies that encoding (output) not supported?
rimage
github_2023
others
187
SalOne22
SalOne22
@@ -1,5 +1,5 @@ use clap::Command; pub fn farbfeld() -> Command { - Command::new("farbfeld").about("Encode images into Farbfeld format") + Command::new("farbfeld").about("Encode images into Farbfeld format. (Uncommon)")
Why do we need `Common` and `Uncommon` remarks? Users that use this app must know about images they want.
rimage
github_2023
others
187
SalOne22
SalOne22
@@ -3,24 +3,24 @@ use clap::{arg, value_parser, Command}; pub fn mozjpeg() -> Command { Command::new("mozjpeg") .alias("moz") - .about("Encode images into JPEG format using MozJpeg codec") + .about("Encode images into JPEG format using MozJpeg codec. (RECOMMANDED and Small)")
typo, should be "RECOMMENDED"
rimage
github_2023
others
187
SalOne22
SalOne22
@@ -17,38 +17,38 @@ impl Preprocessors for Command { .next_help_heading("Preprocessors") .args([ #[cfg(feature = "resize")] - arg!(--resize <RESIZE> "Resize the image(s) according to the specified criteria") - .long_help(indoc! {"Resize the im...
maybe add that this value is in percentages?
rimage
github_2023
others
187
SalOne22
SalOne22
@@ -17,38 +17,38 @@ impl Preprocessors for Command { .next_help_heading("Preprocessors") .args([ #[cfg(feature = "resize")] - arg!(--resize <RESIZE> "Resize the image(s) according to the specified criteria") - .long_help(indoc! {"Resize the im...
And remove here "out of 100"
rimage
github_2023
others
125
SalOne22
SalOne22
@@ -42,28 +42,35 @@ Options: -V, --version Print version General: - -q, --quality <QUALITY> Optimization quality [default: 75] - -f, --codec <CODEC> Image codec to use [default: mozjpeg] - -o, --output <DIR> Write output file(s) to <DIR> - -r, --recursive Saves output file(s) preserving ...
in `clap.rs` different hints are separated like this: `[range: 1 - 100] [default: 75]` Also range should be placed before default, because of the clap help generation
rimage
github_2023
others
125
SalOne22
SalOne22
@@ -42,28 +42,35 @@ Options: -V, --version Print version General: - -q, --quality <QUALITY> Optimization quality [default: 75] - -f, --codec <CODEC> Image codec to use [default: mozjpeg] - -o, --output <DIR> Write output file(s) to <DIR> - -r, --recursive Saves output file(s) preserving ...
I prefer lowercase in hints, to be more consistent with clap help generation
rimage
github_2023
others
125
SalOne22
SalOne22
@@ -42,28 +42,35 @@ Options: -V, --version Print version General: - -q, --quality <QUALITY> Optimization quality [default: 75] - -f, --codec <CODEC> Image codec to use [default: mozjpeg] - -o, --output <DIR> Write output file(s) to <DIR> - -r, --recursive Saves output file(s) preserving ...
May be also add `[possible values: ...]` hint, but not required
rimage
github_2023
others
125
SalOne22
SalOne22
@@ -78,6 +85,16 @@ List of available resize filters: - `mitchell` => Resize using Mitchell-Netravali filter - `lanczos3` => Resize using Sinc-windowed Sinc with radius of 3 +## Example
If not hard, please add examples for image resizing and quantization
rimage
github_2023
others
59
SalOne22
github-advanced-security[bot]
@@ -0,0 +1,42 @@ +use std::path::{Path, PathBuf}; + +/// Gets common path inside a array of paths +pub fn common_path(paths: &[PathBuf]) -> Option<PathBuf> { + if paths.len() < 2 { + return None; + } + + let mut iter = paths.into_iter(); + + let mut ret = iter.next()?.clone(); + + for path in iter...
redundant clone [Show more details](https://github.com/SalOne22/rimage/security/code-scanning/2)
rimage
github_2023
others
59
SalOne22
github-advanced-security[bot]
@@ -0,0 +1,42 @@ +use std::path::{Path, PathBuf}; + +/// Gets common path inside a array of paths +pub fn common_path(paths: &[PathBuf]) -> Option<PathBuf> { + if paths.len() < 2 { + return None; + } + + let mut iter = paths.into_iter();
this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice` [Show more details](https://github.com/SalOne22/rimage/security/code-scanning/3)
rimage
github_2023
others
51
SalOne22
github-advanced-security[bot]
@@ -446,6 +447,58 @@ Ok(ImageData::new(width as usize, height as usize, &buf)) } + + fn decode_avif(&self) -> Result<ImageData, DecodingError> { + use libavif_sys::*; + + let image = unsafe { avifImageCreateEmpty() }; + let decoder = unsafe { avifDecoderCreate() }; + let d...
calls to `std::mem::forget` with a reference instead of an owned value. Forgetting a reference does nothing [Show more details](https://github.com/SalOne22/rimage/security/code-scanning/1)
arethetypeswrong.github.io
github_2023
others
235
arethetypeswrong
andrewbranch
@@ -37,3 +37,7 @@ When this problem occurs for the `node10` resolution option but not any others, In this example, an import of `"pkg/subpath"` can be used in Node 12+ and modern bundlers, but would fail to resolve in Node 10. Accordingly, TypeScript’s `--moduleResolution node10` (also confusingly known as `node`, bec...
I’m fine with this addition if it’s rolled into the previous section rather than a new h2. The suggestion isn’t applicable to the problem generally; it’s specific to the `"exports"` cause spelled out above. ```suggestion > You can use the [`--profile node16` option on the CLI](https://github.com/arethetypeswrong/...
arethetypeswrong.github.io
github_2023
others
220
arethetypeswrong
andrewbranch
@@ -24,3 +24,15 @@ This problem can occur with `tsc` alone if the library author compiles with `--m The problem can also occur when compiling with an unsupported combination of settings, like `--moduleResolution node16 --module esnext`. When either `module` or `moduleResolution` is set to `node16` or `nodenext`, the o...
This isn’t true in general; it’s only true for ESM-mode files
arethetypeswrong.github.io
github_2023
others
220
arethetypeswrong
andrewbranch
@@ -24,3 +24,15 @@ This problem can occur with `tsc` alone if the library author compiles with `--m The problem can also occur when compiling with an unsupported combination of settings, like `--moduleResolution node16 --module esnext`. When either `module` or `moduleResolution` is set to `node16` or `nodenext`, the o...
I don’t really agree with this advice. Ideally, declaration files should only be bundled when the JavaScript files are bundled.
arethetypeswrong.github.io
github_2023
typescript
201
arethetypeswrong
andrewbranch
@@ -0,0 +1,29 @@ +import type { RenderOptions } from "./render/index.js"; + +type Profile = Pick<Required<RenderOptions>, "ignoreResolutions">; + +export const profiles = { + strict: { + ignoreResolutions: [], + }, + node16: { + ignoreResolutions: ["node10"], + }, + "esm-only": { + ignoreResolutions: ["no...
Can we remove this one? I can’t think of a good reason why something should pass `node16` but fail `bundler`.
arethetypeswrong.github.io
github_2023
others
201
arethetypeswrong
andrewbranch
@@ -181,6 +181,25 @@ attw <file-name> --ignore-rules <rules...> In the config file, `ignoreRules` can be an array of strings. +#### Ignore Resolutions
The README changes need to be updated.
arethetypeswrong.github.io
github_2023
others
186
arethetypeswrong
jason-ha
@@ -1,4 +1,4 @@ -lockfileVersion: '6.0' +lockfileVersion: '9.0'
pnpm v6 != pnpm lockfile version 6. for example pnpm v8 uses lockfile version 6. The package.json lists pnpm requirement as >= v8, but 8 does not have support for lockfile version 9. (I don't know where a good reference is for pnpm lockfile versions.) I thought pnpm v8 would work with Node 21; so, was there confusio...
arethetypeswrong.github.io
github_2023
typescript
166
arethetypeswrong
andrewbranch
@@ -0,0 +1,8 @@ +import type { Exports } from "cjs-module-lexer"; +import { init, parse as cjsParse } from "cjs-module-lexer"; + +await init();
Hmm... I guess this is the best option for the moment, but I’ll probably make a breaking change at some point to make the analysis itself async instead of having TLA.
arethetypeswrong.github.io
github_2023
others
177
arethetypeswrong
andrewbranch
@@ -5,7 +5,8 @@ "rootDir": "src", "types": ["ts-expose-internals-conditionally", "node"], "outDir": "./dist", - "sourceMap": true + "sourceMap": true, + "allowSyntheticDefaultImports": true
This is implied by `--module nodenext` ```suggestion "sourceMap": true ```
arethetypeswrong.github.io
github_2023
others
174
arethetypeswrong
srenatus
@@ -15,7 +15,7 @@ This problem indicates that TypeScript can’t find any file with a supported fi
☝️ [There's another one](https://github.com/arethetypeswrong/arethetypeswrong.github.io/pull/174/files#diff-c2d00d4f3e471929d7d29bdf358d6af82ab425c7344c8a099c46909f1fb9ae84R9) -- "Consequnces" -- would you mind including that? I was just about to open a PR myself, but since you're already on it 😎
arethetypeswrong.github.io
github_2023
typescript
156
arethetypeswrong
andrewbranch
@@ -1,3 +1,7 @@ +import packlist from "npm-packlist"; +import Arborist from "@npmcli/arborist"; +import { extname, join } from "path";
This code runs in a web worker, and I don’t think I have anything configured to polyfill Node.js built-ins. I’ve avoided using them so far.
arethetypeswrong.github.io
github_2023
typescript
156
arethetypeswrong
andrewbranch
@@ -13,13 +13,21 @@ import type { import { allBuildTools, getResolutionKinds } from "../utils.js"; import type { CheckPackageOptions } from "../checkPackage.js"; -function getEntrypoints(fs: Package, exportsObject: any, options: CheckPackageOptions | undefined): string[] { +const extensions = new Set([".jsx", ".tsx...
Use `!ts.isDeclarationFileName(f)`; there are `.d.mts`, `.d.cts`, `.d.css.ts`, and infinitely more
arethetypeswrong.github.io
github_2023
typescript
156
arethetypeswrong
andrewbranch
@@ -13,13 +13,21 @@ import type { import { allBuildTools, getResolutionKinds } from "../utils.js"; import type { CheckPackageOptions } from "../checkPackage.js"; -function getEntrypoints(fs: Package, exportsObject: any, options: CheckPackageOptions | undefined): string[] { +const extensions = new Set([".jsx", ".tsx...
I think it was an existing bug that there are early returns in here; I don’t see why either “proxy directories” or these files shouldn’t interact with`--include-entrypoints` and `--exclude-entrypoints`. I can rearrange all this in a different PR though if you don’t want to touch it here.
arethetypeswrong.github.io
github_2023
others
126
arethetypeswrong
andrewbranch
@@ -14,6 +14,10 @@ This project attempts to analyze npm package contents for issues with their Type * [🚭 Unexpected module syntax](./docs/problems/UnexpectedModuleSyntax.md) * [🥴 Internal resolution error](./docs/problems/InternalResolutionError.md) +## CLI + +You can use this project from CLI. Check out the [CLI...
```suggestion You can check packages on disk with [`@arethetypeswrong/cli`](https://npmjs.com/@arethetypeswrong/cli). See [its README](./packages/cli/README.md) for usage. ```
arethetypeswrong.github.io
github_2023
others
26
arethetypeswrong
thomasballinger
@@ -131,6 +131,18 @@ attw --vertical <package-name> In the config file, `vertical` can be a boolean value. +#### Flipped + +Flip the table (so that the resolution kinds are the table's head, and the entry points label the table's rows). + +In the CLI: `--flipped`, `-F` + +```shell +attw --flipped <package-name> +`...
```suggestion In the config file, `flipped` can be a boolean value. ```
arethetypeswrong.github.io
github_2023
typescript
26
arethetypeswrong
andrewbranch
@@ -0,0 +1,140 @@ +#!/usr/bin/env node + +import * as core from "@arethetypeswrong/core"; +import { Option, program } from "commander"; +import chalk from "chalk"; +import { readFile } from "fs/promises"; +import { FetchError } from "node-fetch"; + +import * as tabular from "./render/index.js"; +import { readConfig } f...
All these versions can be set dynamically, right?
arethetypeswrong.github.io
github_2023
typescript
26
arethetypeswrong
andrewbranch
@@ -0,0 +1,140 @@ +#!/usr/bin/env node + +import * as core from "@arethetypeswrong/core"; +import { Option, program } from "commander"; +import chalk from "chalk"; +import { readFile } from "fs/promises"; +import { FetchError } from "node-fetch"; + +import * as tabular from "./render/index.js"; +import { readConfig } f...
I think these two should be switched—I assume 99% of the utility of having a CLI is for checking something local, the file should be the positional argument IMO. Let’s also combine the package name option with `--version` into a single `--from-npm` that takes a package spec. That way, I can add `--from-url` for #6 late...
arethetypeswrong.github.io
github_2023
typescript
26
arethetypeswrong
andrewbranch
@@ -0,0 +1,140 @@ +#!/usr/bin/env node + +import * as core from "@arethetypeswrong/core"; +import { Option, program } from "commander"; +import chalk from "chalk"; +import { readFile } from "fs/promises"; +import { FetchError } from "node-fetch"; + +import * as tabular from "./render/index.js"; +import { readConfig } f...
What do you think about `--format {table,table-flipped,ascii,json}`? (Not attached to table-flipped or ascii as names, if you have suggestions.)
arethetypeswrong.github.io
github_2023
typescript
26
arethetypeswrong
andrewbranch
@@ -0,0 +1,140 @@ +#!/usr/bin/env node + +import * as core from "@arethetypeswrong/core"; +import { Option, program } from "commander"; +import chalk from "chalk"; +import { readFile } from "fs/promises"; +import { FetchError } from "node-fetch"; + +import * as tabular from "./render/index.js"; +import { readConfig } f...
I feel like this should be the default—I’m not even sure it needs to be configurable, since you can just use shell features to ignore a non-zero exit code if you really need to.
arethetypeswrong.github.io
github_2023
typescript
55
arethetypeswrong
andrewbranch
@@ -253,19 +177,40 @@ export function createMultiCompilerHost(fs: Package): MultiCompilerHost { }; } - function createTraceCollector() { - const traces: string[] = []; - return { - trace: (message: string) => traces.push(message), - read: () => { - const result = traces.slice(); - ...
Methods are declared on the class prototype so they can be shared between all instances. This is a class field, which is initialized on each instance during construction (equivalent to doing `Object.defineProperty(this, "trace", ...)` in the constructor). This has a perf/memory cost as compared to a true method, but of...
arethetypeswrong.github.io
github_2023
others
47
arethetypeswrong
andrewbranch
@@ -1,5 +1,12 @@ # @arethetypeswrong/cli +## 0.2.1 + +### Patch Changes + +- Updated dependencies [7c3a377] + - @arethetypeswrong/core@0.3.0
I think I want to make `@arethetypeswrong/cli` [linked](https://github.com/changesets/changesets/blob/main/docs/linked-packages.md) to `@arethetypeswrong/core`. It feels like a major or minor bump of core should necessitate the same in the CLI, but not vice versa. I think I need to add ```json { "linked": [["@ar...
volvo2mqtt
github_2023
others
109
Dielee
Dielee
@@ -21,6 +21,8 @@ options: port: "auto_port" username: "auto_user" password: "auto_password" + mqtt_options:
The setting to disable the homeassistant topic is not necessary in the configuration for the ha addon. Please remove it.
volvo2mqtt
github_2023
others
109
Dielee
Dielee
@@ -1,5 +1,6 @@ CONF_updateInterval=300 CONF_babelLocale='de' CONF_mqtt='@json {"broker": "mqtt", "username": "", "password": ""}' +CONF_mqtt_options='@json {"volvo_topic": "homeassistant/[domain]"}'
Please move the `volvo_topic` inside the `mqtt` section. Maybe we should rename it to `base_topic`.
volvo2mqtt
github_2023
others
109
Dielee
Dielee
@@ -41,6 +43,8 @@ schema: port: str username: str? password: str? + mqtt_options:
The setting to disable the homeassistant topic is not necessary in the configuration for the ha addon. Please remove it.
volvo2mqtt
github_2023
others
109
Dielee
Dielee
@@ -1,6 +1,5 @@ CONF_updateInterval=300 CONF_babelLocale='de' -CONF_mqtt='@json {"broker": "mqtt", "username": "", "password": ""}' -CONF_mqtt_options='@json {"volvo_topic": "homeassistant/[domain]"}' +CONF_mqtt='@json {"broker": "mqtt", "username": "", "password": "", "base_topic": "homeassistant/[domain]"}'
Maybe it's better to leave the `base_topic` empty, as you are using `homeassistant/[domain]` as default inside `mqtt.py` line 53 ?
volvo2mqtt
github_2023
python
109
Dielee
Dielee
@@ -46,22 +46,22 @@ def connect(): mqtt_client = client -def parse_volvo_topic(domain): - volvo_topic = settings["mqtt_options"]["volvo_topic"] +def parse_base_topic(domain): + base_topic = settings["mqtt"]["base_topic"]
Please check here if the mqtt setting contains `base_topic`, if not, this will throw a KeyError.
NaLLM
github_2023
typescript
17
neo4j
jharris4
@@ -1,35 +1,100 @@ -import { useState } from "react"; +import { useCallback, useEffect, useState } from "react"; import ChatContainer from "./ChatContainer"; import type { ChatMessageObject } from "./ChatMessage"; import ChatInput from "./ChatInput"; -import { fetchQuestionAnswer } from "./utils/fetch-utils"; +impor...
should be import type here?
NaLLM
github_2023
typescript
17
neo4j
jharris4
@@ -1,35 +1,100 @@ -import { useState } from "react"; +import { useCallback, useEffect, useState } from "react"; import ChatContainer from "./ChatContainer"; import type { ChatMessageObject } from "./ChatMessage"; import ChatInput from "./ChatInput"; -import { fetchQuestionAnswer } from "./utils/fetch-utils"; +impor...
might be smart to explicitly flag the last message as being incomplete or something, even though message being an empty string could technically be used to denote that...
NaLLM
github_2023
typescript
17
neo4j
jharris4
@@ -1,35 +1,100 @@ -import { useState } from "react"; +import { useCallback, useEffect, useState } from "react"; import ChatContainer from "./ChatContainer"; import type { ChatMessageObject } from "./ChatMessage"; import ChatInput from "./ChatInput"; -import { fetchQuestionAnswer } from "./utils/fetch-utils"; +impor...
hmm, did you really mean to use the setters as the 2nd arguments to useEffect here? Maybe that works, but for readability I'd suggest/prefer just using the values instead of the setters... :-)
NaLLM
github_2023
python
17
neo4j
jharris4
@@ -38,28 +43,27 @@ class Payload(BaseModel): neo4j_connection = Neo4jDatabase( - host=os.environ.get("NEO4J_URL", "bolt://neo4j:7687"), - user=os.environ.get("NEO4J_USER", "neo4j"), - password=os.environ.get( - "NEO4J_PASS", "pleaseletmein") + host="bolt://neo4j:7687", user="neo4j", password="p...
any specific reason for removing the env variable usage here?
NaLLM
github_2023
python
17
neo4j
jharris4
@@ -38,28 +43,27 @@ class Payload(BaseModel): neo4j_connection = Neo4jDatabase( - host=os.environ.get("NEO4J_URL", "bolt://neo4j:7687"), - user=os.environ.get("NEO4J_USER", "neo4j"), - password=os.environ.get( - "NEO4J_PASS", "pleaseletmein") + host="bolt://neo4j:7687", user="neo4j", password="p...
you're fired! :-D
NaLLM
github_2023
python
17
neo4j
jharris4
@@ -119,11 +130,80 @@ async def root(payload: Payload): return {"detail": "missing request body"} try: results = text2cypher.run(payload.question) - return {"output": summarize_results.run(payload.question, results['output']), "generated_cypher": results['generated_cypher']} + retur...
might be good to format this such that the client/front-end can tell it's the cypher query?
NaLLM
github_2023
python
17
neo4j
tomasonjo
@@ -36,27 +37,30 @@ def get_system_message(self) -> str: Do not respond to any questions that might ask anything else than for you to construct a Cypher statement. Do not include any text except the generated Cypher statement. """ + system += "Que...
The question is not really part of the system message, but of the user message. Would make more sense to prefix this in the user message
NaLLM
github_2023
others
4
neo4j
oskarhane
@@ -0,0 +1,16 @@ +# Chat with knowledge graph + +This use-case is designed to allow you to retrieve information from any Neo4j database using natural language. +You can use any your Neo4j databases, or you can create a Neo4j Sandbox project to test out this use case. +If you are not using a Sandbox instance, make sure ...
Does docker compose build the image?
FoodExpirationDates
github_2023
others
284
lorenzovngl
lorenzovngl
@@ -57,13 +62,15 @@ fun MyScaffold( navController: NavHostController, navDestination: String? = null, showSnackbar: MutableState<Boolean>, - content: @Composable () -> Unit + searchQuery : MutableState<String>,
Whenever possible, if you introduce a new parameter, add a default. This prevent you from having to change all calls of the function. Think about the situation in which a function is called 100 times. ```suggestion searchQuery : MutableState<String> = mutableStateOf(""), ```
FoodExpirationDates
github_2023
others
284
lorenzovngl
lorenzovngl
@@ -167,10 +175,13 @@ fun MyScaffoldPreview() { } MyScaffold( navController = navController, - showSnackbar = showSnackbar + showSnackbar = showSnackbar, + searchQuery = mutableStateOf("")
Change no longer necessary after introducing a default. ```suggestion showSnackbar = showSnackbar ```
FoodExpirationDates
github_2023
others
284
lorenzovngl
lorenzovngl
@@ -167,10 +175,13 @@ fun MyScaffoldPreview() { } MyScaffold( navController = navController, - showSnackbar = showSnackbar + showSnackbar = showSnackbar, + searchQuery = mutableStateOf("") ) { + MainScr...
Change no longer necessary after introducing a default. ```suggestion navController = rememberNavController() ```
FoodExpirationDates
github_2023
others
284
lorenzovngl
lorenzovngl
@@ -38,7 +38,7 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import com.lorenzovainigli.foodexpirationdates.BuildConfig +import com.google.android.datatransport.BuildConfig
Wrong, please revert this.
FoodExpirationDates
github_2023
others
284
lorenzovngl
lorenzovngl
@@ -45,7 +47,8 @@ import kotlin.math.min fun MainScreen( activity: MainActivity? = null, navController: NavHostController, - showSnackbar: MutableState<Boolean>? = null + showSnackbar: MutableState<Boolean>? = null, + searchQuery: MutableState<String>
Same consideration as in `MyScaffold`: add a default value. ```suggestion searchQuery: MutableState<String> = mutableStateOf("") ```
FoodExpirationDates
github_2023
others
284
lorenzovngl
lorenzovngl
@@ -54,16 +57,31 @@ fun MainScreen( ) { val itemsState = activity?.viewModel?.getDates()?.collectAsState(emptyList()) val items = itemsState?.value ?: getItemsForPreview(LocalContext.current) - if (items.isNotEmpty()) { + + val filteredItems = items.filter { + it.foodName...
Since it's commented, you can remove it.
FoodExpirationDates
github_2023
others
284
lorenzovngl
lorenzovngl
@@ -82,14 +100,16 @@ fun MainScreen( } } +@SuppressLint("UnrememberedMutableState") @RequiresApi(Build.VERSION_CODES.O) @Preview @Composable fun MainScreenPreview() { FoodExpirationDatesTheme { Surface { MainScreen( - navController = rememberNavController() + ...
You can remove it after introducing the default value. ```suggestion navController = rememberNavController() ```
FoodExpirationDates
github_2023
others
284
lorenzovngl
lorenzovngl
@@ -82,14 +100,16 @@ fun MainScreen( } } +@SuppressLint("UnrememberedMutableState")
To be removed
FoodExpirationDates
github_2023
others
284
lorenzovngl
lorenzovngl
@@ -18,6 +19,7 @@ import com.lorenzovainigli.foodexpirationdates.view.composable.screen.Screen import com.lorenzovainigli.foodexpirationdates.view.composable.screen.SettingsScreen class DefaultPreviews { + @SuppressLint("UnrememberedMutableState")
To be removed
FoodExpirationDates
github_2023
others
284
lorenzovngl
lorenzovngl
@@ -29,12 +31,13 @@ class DefaultPreviews { val showSnackbar = remember { mutableStateOf(false) } - MyScaffold(navController = navController, showSnackbar = showSnackbar) { - Navigation(navController = navController, showSnackbar = showSnackbar, start...
Same as above